Commit Graph

394 Commits

Author SHA1 Message Date
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
David Teller
06e5f00b2d
Intercept /report and display human-readable abuse reports in the moderation room - Resolves #38 (#135)
* Intercept /report and display human-readable abuse reports in the moderation room - Resolves #38
2021-10-07 14:42:08 +02:00
Gnuxie
725d400650
Merge pull request #136 from matrix-org/gnuxie/mx-tester
An Integration test setup that can be used with mx-tester
2021-09-30 16:48:14 +01:00
gnuxie
4d46d4dd34 Move integration test config file
it now lives in config/ because it was being loaded there by the tests before it could be copied to there from the test directory
2021-09-30 16:02:58 +01:00
gnuxie
776c1fe063 Tidy logging in integration tests 2021-09-30 15:52:06 +01:00
gnuxie
400af48e6e Move Mjolnir setup and configuration to a sensible place. 2021-09-27 16:04:01 +01:00
gnuxie
c29cfe370a make yarn test only runs unit tests for now while we sortout CI setup 2021-09-27 15:34:06 +01:00
gnuxie
ea6bfd24cb Add info about mx-tester and integration tests to README 2021-09-27 15:34:06 +01:00
gnuxie
49301b630b Add mx-tester.yml that matches test/integration/config/harness.yaml 2021-09-27 15:33:15 +01:00
gnuxie
21d79475e3 Add manual launch script for working with mx-tester 2021-09-27 15:33:15 +01:00
gnuxie
ac075fd22e Remove dependencies from old test harness 2021-09-27 15:33:15 +01:00
gnuxie
b838caee09 Add script for manual testing with mx-tester 2021-09-27 15:33:15 +01:00
gnuxie
0a6b122f5c Tidy up documentation and test utils 2021-09-27 15:33:15 +01:00
gnuxie
a86afd3cc8 Remove old test harness 2021-09-24 18:25:28 +01:00
gnuxie
ff216f4918 Give mjolnir a clean history in each test 2021-09-24 18:25:28 +01:00
gnuxie
68aa717826 Rework integration tests to work with mx-tester 2021-09-24 18:25:27 +01:00
gnuxie
67e20e2415 Move files in preperation for mx-tester 2021-09-24 18:25:27 +01:00
gnuxie
3a948015d0 missing license header 2021-09-24 18:25:27 +01:00
gnuxie
6a1ce742ae Add config for test harness. 2021-09-24 18:25:27 +01:00
gnuxie
b0ee846534 Update package.json and yarn.lock to include harness dependencies. 2021-09-24 18:25:27 +01:00
gnuxie
1d2da60bee Allow relative paths for mjolnir data
These are relative to the project directory.
2021-09-24 18:25:27 +01:00
gnuxie
57ef8ab7fe Tidy up test harness. 2021-09-24 18:25:27 +01:00
gnuxie
1a1eb5fadd Basic harness, starts synapse and mjolnir. 2021-09-24 18:25:27 +01:00
gnuxie
7e44cf99c1 Move test harness files to new structure 2021-09-24 18:25:27 +01:00
Gnuxie
002e4ee749 Create docker-compose for testing purposes 2021-09-24 18:25:27 +01:00
Gnuxie
c262bc26db
Merge pull request #108 from chirayudesai/protection-media
Add a new protection, MessageIsMedia
2021-09-24 14:59:11 +01:00
Chirayu Desai
69ace9cfa5 Add a new protection, MessageIsMedia
* Simply redacts any media sent to the room, by anyone
* Meant to serve as a temporary measure to prevent image spam,
  in conjunction with FirstMessageIsImage
2021-09-24 16:57:16 +05:30
gnuxie
7ea05629e3 v1.1.20 2021-09-17 12:10:48 +01:00
Gnuxie
7b7130b39f
Merge pull request #132 from matrix-org/gnuxie/remove-messages-sync
Use `rooms/initialSync` instead of `sync` to fetch room history. See https://github.com/matrix-org/synapse/issues/10842.
2021-09-17 12:08:05 +01:00
gnuxie
6edf503a9c Use rooms/initialSync instead of sync to fetch room history.
See https://github.com/matrix-org/synapse/issues/10842.
For the time being this seems to be the only way to avoid requests
that take several minutes for synapse to complete and timeout.
2021-09-17 12:02:14 +01:00
Gnuxie
4ca18b1bfc
Merge pull request #130 from matrix-org/gnuxie/change-ban-redact-order
Gnuxie/change ban redact order
2021-09-16 17:40:53 +01:00
gnuxie
5acc38c8b5 EventRedactionQueue documentation improvements from review 2021-09-16 17:10:59 +01:00
gnuxie
ad199cc7d7 Use a Map for queueing redactions by roomId. 2021-09-15 12:18:55 +01:00