Commit Graph

326 Commits

Author SHA1 Message Date
jesopo
c2661105db reimplement htmlEscape 2022-02-01 21:52:29 +00:00
jesopo
0b7da86b9c enable noImplicitAny 2022-02-01 21:51:47 +00:00
Gnuxie
0cde70e846
Merge pull request #199 from matrix-org/gnuxie/remove-axios
Remove axios (from tests)
2022-01-27 09:25:32 +00:00
gnuxie
f481ec84d3 Make sure we stop clients after they have started, not before.
Yeah it's a long story.
2022-01-26 16:25:43 +00:00
gnuxie
17a1d02af8 Fix uses of old interface for registration helper in tests. 2022-01-25 18:23:14 +00:00
gnuxie
9e96d399c0 Remove axios from the test suite, it is unnecessary.
It's probably also got problems.
2022-01-25 18:22:34 +00:00
Jess Porter
423a34bebe
runtime persistent settings system (#158) 2022-01-25 14:47:50 +00:00
David Teller
c7a96a3afe
Retry requests in case of throttling (#178)
* Retry requests in case of throttling


Co-authored-by: gnuxie <gnuxie@element.io>
2022-01-25 12:19:44 +00:00
David Teller
baa9129fa5 [CI] We need to wait until Mjölnir's start is complete before proceeding with tests.
Hopefully, this should fix the (latest) race conditions we've been seeing during CI.
2022-01-24 16:13:18 +01:00
Gnuxie
13032413b2
Merge pull request #166 from matrix-org/gnuxie/ruleserver
Gnuxie/ruleserver
2022-01-21 13:07:58 +00:00
gnuxie
afb0fd5a23 Skip policy consumption test when the rule server is not enabled 2022-01-21 12:28:59 +00:00
gnuxie
4537cf0d8a Add test for ruleserver policy consumption.
Ensures that the consumer of the ruleserver rules is enforcing them.
2022-01-21 12:13:04 +00:00
gnuxie
7ee3ce1dd2 rename onReactionTo to getFirstReaction 2022-01-21 12:13:04 +00:00
gnuxie
1a65122b0d Initial Ruleserver prototype.
This is an experimental ruleserver that will serve the combined rules from
the active policy lists to a Synapse module over a web api.
This makes it easier to communicate changes in policy lists to Synapse workers
that do not have an immediate view over all of the policy rooms at
the same time.
This also allows us to express moderation actions to the homeserver
beyond what is currently expressible via MSC2313 policy
lists.
2022-01-21 12:13:04 +00:00
Gnuxie
47e3d8ae2c
Merge pull request #191 from matrix-org/gnuxie/manual-test-cleanup
Improvements to manual testing with the test:manual script.
2022-01-21 10:23:17 +00:00
gnuxie
9048322709 Improvements to manual testing with the test:manual script.
- Use the configured username & password when registering the test user to run Mjolnir with (was hardcoded).
- Remove bogus imports from the helper that have accidentally been introduced with VSCode.
- Keep `enable_registration: true` in the homeserver config to save time.
2022-01-21 10:11:01 +00:00
Gnuxie
c61d883578
Merge pull request #192 from matrix-org/gnuxie/node-14
Bump minimum node version to 14
2022-01-19 17:11:41 +00:00
gnuxie
dacbc1cde5 Bump minimum node version to >=14
Needed to merge https://github.com/matrix-org/mjolnir/pull/186 & node 12 is approaching EOL.
2022-01-19 16:46:18 +00:00
Gnuxie
6d911ab33b
Merge pull request #190 from matrix-org/gnuxie/mjolnir-overreact
Stop reacting to reports Mjolnir didn't send in report manager.
2022-01-18 17:40:56 +00:00
gnuxie
6a723eaa1b Stop reacting to reports Mjolnir didn't send in report manager. 2022-01-18 11:08:17 +00:00
Jess Porter
941d10b015
never mutate config.managementRoom in-place (#184) 2022-01-17 16:24:12 +00:00
dependabot[bot]
4490f9ba82 Bump follow-redirects from 1.14.4 to 1.14.7
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.4...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-17 12:22:15 +01:00
David Teller
5c000b2fee CI: Waiting until Synapse is ready 2022-01-07 14:06:10 +01:00
David Teller
a88a494f7a Let's not overwrite the error message when we're fixing the stack. 2022-01-07 14:06:10 +01:00
David Teller
d9c30f586a Reduce throttling
With the default configuration, we are throttled extremely often. This
eventually causes timeouts.
2022-01-07 14:06:10 +01:00
David Teller
7f07caca3f [CI] Retry registration attempts 2022-01-07 14:06:10 +01:00
David Teller
c48a1e8ffc Let's make sure that we can still check for errors with concise error handling 2022-01-07 14:06:10 +01:00
David Teller
3f2039f6a7 Let's use getRequestFn/setRequestFn to keep errors readable 2022-01-07 14:06:10 +01:00
David Teller
9a8fed1695 Slightly cleaner MatrixClient wrapping 2022-01-07 14:06:10 +01:00
David Teller
57746f7fb4 Wrap MatrixClient into something that displays nicer error messages 2022-01-07 14:06:10 +01:00
David Teller
1592440bc9
Abuse Report UX: Keep the text shorter (#152)
* Abuse Report UX: Keep the text shorter

* ReportManager: Clarifying why some actions are disabled
2021-12-10 09:09:32 +01:00
Graham Christensen
438db2d2ab
README: Link to main instead of master (#159)
Master was renamed to main at some point, let's update the README to say so too.
2021-12-07 12:26:21 +01:00
Gnuxie
e034049353
Merge pull request #143 from matrix-org/gnuxie/banlist-change-watching
Provide notice showing how a BanList has changed after updating.
2021-11-29 12:07:52 +00:00
gnuxie
33011ddb04 Store BanList rules only in the room state cache.
We do this so that there is only one source of truth for which rules
are active and it simplifies de-duplicating rules of conflicting event
types (e.g. m.room.rule.user vs m.policy.rule.user).
2021-11-29 11:45:22 +00:00
gnuxie
0bbfe93a4b Use MSC2313 m.policy.rule.* for rules and always prefer these types.
The reason for doing this is because otherwise there may be duplicate
rules under different state types for the same entity.
This simplifies the process of modifying or invalidating rules affecting
an entity because the rule with the most recent type will always be
preferred.
2021-11-29 11:45:22 +00:00
gnuxie
7aee14bf5c Add test for banList changes 2021-11-29 11:45:22 +00:00
gnuxie
9c47fc917a Provide notice showing how a BanList has changed after updating.
Only shows changes to lists made by other accounts (than the one used by Mjolnir).
Displays when rules are added, removed and modified by either replacing the state event or redacting them.
2021-11-29 11:45:22 +00:00
jess
1bf3ecac6d
consistently use 'alias' in ensureAliasedRoomExists (#155) 2021-11-19 17:09:58 +00:00
David Teller
1446b261d8 CI: Clarifying that the reverse proxy should be up *before* Synapse. 2021-11-18 14:54:46 +01:00
David Teller
15510adc27 v1.2.0 2021-11-18 13:03:38 +01:00
David Teller
a21415a04c
Give the ability to moderators to react quickly to /report abuse reports. (#137) 2021-11-09 13:15:49 +01:00
Gnuxie
e7195678d4
Merge pull request #138 from matrix-org/gnuxie/timeline-weirdness
Fix various issues with timeline pagination (getMessagesByUserIn)

- Ensures the callback that is provided to getMessagesByUserIn is only called when there are relevant events (Ie never called with an empty array)
- Changes getMessagesByUserIn to await on the callback it has been given. (This stops async callbacks failing outside of the context which they were provided if the caller awaits on getMessagesByUserIn).
- Changes getMessagesByUserIn to return a promise that resolves when either: limit has been reached, no relevant events could be found or there is no more timeline to paginate.
- Fixes an issue where a sync filter was being given to `rooms/messages` which led to Mjolnir paginating the entire timeline in situations where it was not necessary (e.g. exact sender was given)
2021-10-20 12:22:22 +01:00
gnuxie
7a20b5a212 Fix helloTest hooks running before global hooks. 2021-10-20 12:11:00 +01:00
gnuxie
c52084c58a Stop managing client from utils and require the caller to (tests)
Specifically `onReactionTo` was starting and stopping the client
argument it was given, which could be problematic if the caller
didn't expect that or didn't want it to.
2021-10-20 11:44:25 +01:00
gnuxie
7773949631 Fix indentation in fixtures.ts 2021-10-20 11:00:44 +01:00
gnuxie
6c1a502f34 Integration tests for redaction commands.
This is important now that both timeline pagination and
how the callbacks are now awaited during pagination
have been changed.
2021-10-20 11:00:44 +01:00
gnuxie
911707ab2e await the callback in getUserMessagesIn
This is so that the context of failing callbacks are not lost.
We also await during pagination and not after so that if a call to the callback fails, we will not call it again.
2021-10-20 11:00:44 +01:00
gnuxie
fefe29e98b Improve readability of getMessagesByUser 2021-10-20 11:00:44 +01:00
gnuxie
743f6d043a Fix filter when paginating history in getMessagesByUser.
Related to https://github.com/matrix-org/mjolnir/pull/132.
The old code would call `/sync` with this filter. If a token was
provided in the response of `/sync` for earlier messages, it would
then use this same filter to call `/rooms/messages`. However, this
filter does not do anything on that endpoint when we know the id of
the sender, as it requires a RoomEventFilter and there is no warning
or error from synapse about the structure of the filter being wrong.
This was not noticed until after the related PR because `/sync` with
the filter would usually be able to provide a user's
entire history in one room. This is because in most cases a user is banned/redacted
shortly after joining a room.
In the case that `/rooms/messages` was called for more events, the method would
always paginate the timeline up until the limit or the end of the room
history, which is only the expected behavior when matching the sender
with a "glob".
2021-10-19 16:28:55 +01:00
gnuxie
4e8315be44 Add regression test for timeline pagination. 2021-10-19 16:28:55 +01:00