- 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.
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).
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.
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.
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)
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.
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.
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".