Commit Graph

29 Commits

Author SHA1 Message Date
Gnuxie
558cbb3cae
Remove the need to call /initialSync in getMessagesByUserIn. (#297)
* Remove the need to call `/initialSync` in `getMessagesByUserIn`.

At the moment we call `/initialSync` to give a `from` token to `/messages`.
In this PR we instead do not provide a `from` token when calling `/messages`,
which has recently been permitted in the spec
Technically this is still unstable in the spec
https://spec.matrix.org/unstable/client-server-api/#get_matrixclientv3roomsroomidmessages
https://github.com/matrix-org/matrix-spec/pull/1002

Synapse has supported this for over 2 years and Element web depends on it for threads.
https://github.com/matrix-org/matrix-js-sdk/pull/2065

Given that redactions are super heavy in Mjolnir already and have been reported
as barely functional on matrix.org I believe we should also adopt this approach as
if for some reason the spec did change before the next release (1.3) (extremely unlikely) we can revert this commit.
2022-05-24 11:16:52 +01:00
David Teller
e05616b327
New command !mjolnir since <date or duration> <kick | ban | show> <limit> [reason] [...rooms] (#238)
A new command `since` to affect all users who have joined a protected room since a given date.
2022-03-21 10:39:15 +01:00
David Teller
eb7f5f6b3e
Reduce stackspam (#237)
This should cut a lot on the noise in logs.
2022-02-25 17:59:34 +01:00
Jess Porter
a58c7d3f1a
move LogProxy.logMessage to Mjolnir.logMessage (#194) 2022-02-15 15:44:41 +00:00
Jess Porter
58e228be7d
make roomIds param on replaceRoomIdsWithPills a Set<string> (#146) 2022-02-02 17:35:02 +00:00
Jess Porter
f70d97e4d9
enable noImplicitAny (#209) 2022-02-02 12:43:05 +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
a88a494f7a Let's not overwrite the error message when we're fixing the stack. 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
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
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
David Teller
2e22154870 Lint: Enabling 'strictNullChecks' 2021-07-22 08:40:29 +02:00
Travis Ralston
ff4cbc018f Update matrix-bot-sdk and use request cleaning function 2021-07-01 15:11:27 -06:00
Travis Ralston
635f9ba03f Prioritize bans over redactions, and queue redactions faster
This could do with some cleanup, particularly around the part where it uses a callback.
2020-06-12 08:15:48 -06:00
Travis Ralston
46bc6a1a0f Bump bot-sdk version to handle published aliases better 2020-05-11 21:31:47 -06:00
Travis Ralston
9e18a6dfff Add additional safety around room alias resolution for pills
Just fall back to not caring if we have to.
2020-05-11 21:30:22 -06:00
Travis Ralston
232a6e2bb9 Use room aliases in permission errors too 2020-04-15 08:12:42 -06:00
Travis Ralston
f6a856ed4a Resolve room aliases in messages
Fixes https://github.com/matrix-org/mjolnir/issues/47
2020-04-15 08:12:42 -06:00
Travis Ralston
6f80a17558 Improve redaction handling 2020-04-14 16:49:20 -06:00
Travis Ralston
959162c4a3 Support automatically redacting users for certain ban reasons 2019-12-09 19:56:12 -07:00
Travis Ralston
6753e7f780 Allow the redact command to take globs 2019-12-09 19:43:41 -07:00
Travis Ralston
bb6d457f98 Fix timeline filter 2019-10-18 16:38:27 +01:00
Travis Ralston
78b73153b7 Add a redact command 2019-10-09 15:53:37 +01:00
Travis Ralston
d32ad18f3a Update server ACLs when they change 2019-09-27 14:26:57 -06:00