From 60094d73434a1c2b876c6ecdc8bdadc7ceba931c Mon Sep 17 00:00:00 2001 From: David Teller Date: Tue, 28 Jun 2022 20:12:08 +0200 Subject: [PATCH 1/6] MSC 3840: Ignore invites Signed-off: David Teller --- proposals/3840-ignore-invites.md | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 proposals/3840-ignore-invites.md diff --git a/proposals/3840-ignore-invites.md b/proposals/3840-ignore-invites.md new file mode 100644 index 000000000..030b0568e --- /dev/null +++ b/proposals/3840-ignore-invites.md @@ -0,0 +1,67 @@ +# MSC3840: Ignoring invites + +Matrix supports an event "m.ignored_user_list" to entirely ignore some users. + +In some cases, ignoring the user is the wrong granularity, e.g. we may wish to: + +- ignore invites to rooms entirely; +- ignore invites from some servers entirely. + +While both features are pretty easy to implement client-side, standardizing how this preference +is stored as part of the account is necessary to make sure that users can share this ignore list +across devices and sessions. + +## Proposal + + +Matrix currently supports a type `m.ignored_users_list` with content: + +| Content | Type | Description | +|---------|------|-------------| +| `ignored_users` | A maps of user ids to `{}` | A list of users to ignore | + + +We adopt a similar `m.ignored_invites` with content: + +| Content | Type | Description | +|---------|------|-------------| +| `ignored_user_ids` | optional `string[]` | Ignore invites from these users. | +| `ignored_servers` | optional `string[]` | Ignore invites from users in these homeservers. | +| `ignored_room_ids` | optional `string[]` | Ignore invites towards these rooms. | + +### Client behaviour + +If a user modifies `m.ignored_invites`, discard silently any matching pending invite +currently displayed. + +### Server behaviour + +Wherever the server could filter out an event because of a `m.ignored_users_list`: +- if the event is an invite; and +- if `m.ignored_invites` is present in the recipient user's account; and +- if the issuer is part of `ignored_user_ids` or the issuer is an account on `ignored_servers` or the invite room is part of `ignored_room_ids`, then filter out the event silently. + + +The behavior of both client and server is expanded to also ignore any event issued from a server +in `ignore_servers` wherever we would ignore an event from a user in `ignore_users`. + +## Potential issues + +There is a risk that the list of ignored invites of some users may grow a lot, which might have +performance impact, both during initial sync and during filtering. We believe that this risk is +limited. If necessary, clients may decide to cleanup ignored invites after some time. + +## Alternatives + +Can't think of any right now. + +## Security considerations + +Can't think of any right now. + +## Unstable prefix + +During testing, `m.ignored_invites` should be prefixed `org.matrix.msc3840.ignored_invites`. + +Fields `ignored_user_ids`, `ignored_servers`, `ignored_room_ids` of this new event should remain unprefixed. + From f53bc197b3d5b322a4073f1fbe08fb59189653c2 Mon Sep 17 00:00:00 2001 From: David Teller Date: Wed, 29 Jun 2022 09:36:21 +0200 Subject: [PATCH 2/6] WIP: Typo fix --- proposals/3840-ignore-invites.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/proposals/3840-ignore-invites.md b/proposals/3840-ignore-invites.md index 030b0568e..903147d58 100644 --- a/proposals/3840-ignore-invites.md +++ b/proposals/3840-ignore-invites.md @@ -41,10 +41,6 @@ Wherever the server could filter out an event because of a `m.ignored_users_list - if `m.ignored_invites` is present in the recipient user's account; and - if the issuer is part of `ignored_user_ids` or the issuer is an account on `ignored_servers` or the invite room is part of `ignored_room_ids`, then filter out the event silently. - -The behavior of both client and server is expanded to also ignore any event issued from a server -in `ignore_servers` wherever we would ignore an event from a user in `ignore_users`. - ## Potential issues There is a risk that the list of ignored invites of some users may grow a lot, which might have From ff031fb0a62e09234f1cdf0b5347dc836ea2a0f6 Mon Sep 17 00:00:00 2001 From: David Teller Date: Thu, 30 Jun 2022 07:30:30 +0200 Subject: [PATCH 3/6] WIP: Adding ignored_event_ids --- proposals/3840-ignore-invites.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proposals/3840-ignore-invites.md b/proposals/3840-ignore-invites.md index 903147d58..2295fa12d 100644 --- a/proposals/3840-ignore-invites.md +++ b/proposals/3840-ignore-invites.md @@ -28,6 +28,7 @@ We adopt a similar `m.ignored_invites` with content: | `ignored_user_ids` | optional `string[]` | Ignore invites from these users. | | `ignored_servers` | optional `string[]` | Ignore invites from users in these homeservers. | | `ignored_room_ids` | optional `string[]` | Ignore invites towards these rooms. | +| `ignored_event_ids` | optional `string[]` | Ignore specific invites. | ### Client behaviour @@ -39,7 +40,7 @@ currently displayed. Wherever the server could filter out an event because of a `m.ignored_users_list`: - if the event is an invite; and - if `m.ignored_invites` is present in the recipient user's account; and -- if the issuer is part of `ignored_user_ids` or the issuer is an account on `ignored_servers` or the invite room is part of `ignored_room_ids`, then filter out the event silently. +- if the event id is in `ignored_event_ids` or the issuer is part of `ignored_user_ids` or the issuer is an account on `ignored_servers` or the invite room is part of `ignored_room_ids`, then filter out the event silently. ## Potential issues From fd918ab6c202630eee81c2cb97e3832c874482a4 Mon Sep 17 00:00:00 2001 From: David Teller Date: Thu, 30 Jun 2022 10:45:21 +0200 Subject: [PATCH 4/6] WIP: Moving everything client-side --- proposals/3840-ignore-invites.md | 33 ++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/proposals/3840-ignore-invites.md b/proposals/3840-ignore-invites.md index 2295fa12d..93991f687 100644 --- a/proposals/3840-ignore-invites.md +++ b/proposals/3840-ignore-invites.md @@ -28,7 +28,15 @@ We adopt a similar `m.ignored_invites` with content: | `ignored_user_ids` | optional `string[]` | Ignore invites from these users. | | `ignored_servers` | optional `string[]` | Ignore invites from users in these homeservers. | | `ignored_room_ids` | optional `string[]` | Ignore invites towards these rooms. | -| `ignored_event_ids` | optional `string[]` | Ignore specific invites. | +| `ignored_invites` | optional `Invite[]` | Ignore specific invites. | + +where `Invite` is + +| Content | Type | Description | +|------------|--------|-------------| +| `room_id` | string | The room in which the user is invited. | +| `user_id` | string | The user who issued the invite. | +| `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | ### Client behaviour @@ -37,20 +45,33 @@ currently displayed. ### Server behaviour -Wherever the server could filter out an event because of a `m.ignored_users_list`: -- if the event is an invite; and -- if `m.ignored_invites` is present in the recipient user's account; and -- if the event id is in `ignored_event_ids` or the issuer is part of `ignored_user_ids` or the issuer is an account on `ignored_servers` or the invite room is part of `ignored_room_ids`, then filter out the event silently. +None. + +This is handled entirely client-side. ## Potential issues +### Event size + There is a risk that the list of ignored invites of some users may grow a lot, which might have performance impact, both during initial sync and during filtering. We believe that this risk is limited. If necessary, clients may decide to cleanup ignored invites after some time. +### Sync size + +With this proposal, the server will repeat invites at each `/sync`. In time, this can grow expensive. + +If necessary, clients may decide to convert ignored invites into rejected invites after a while. + ## Alternatives -Can't think of any right now. +### Server-side filtering + +Just as `m.ignored_users_list` is handled mostly on the server, we could handle `m.ignored_invites` +largely on the server. However, this would make it much harder to undo erroneous ignores (i.e. +implementing some sort of recovery from trashcan) on the client. + +So we prefer handling things on the client, even if this may require more traffic. ## Security considerations From 3531287f1fff98a44de364e137e95106d450d56e Mon Sep 17 00:00:00 2001 From: David Teller Date: Fri, 1 Jul 2022 15:27:15 +0200 Subject: [PATCH 5/6] WIP: We need timestamps --- proposals/3840-ignore-invites.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/proposals/3840-ignore-invites.md b/proposals/3840-ignore-invites.md index 93991f687..a6c884847 100644 --- a/proposals/3840-ignore-invites.md +++ b/proposals/3840-ignore-invites.md @@ -25,11 +25,32 @@ We adopt a similar `m.ignored_invites` with content: | Content | Type | Description | |---------|------|-------------| -| `ignored_user_ids` | optional `string[]` | Ignore invites from these users. | -| `ignored_servers` | optional `string[]` | Ignore invites from users in these homeservers. | -| `ignored_room_ids` | optional `string[]` | Ignore invites towards these rooms. | +| `ignored_user_ids` | optional `User[]` | Ignore invites from these users. | +| `ignored_servers` | optional `Server[]` | Ignore invites from users in these homeservers. | +| `ignored_room_ids` | optional `Room[]` | Ignore invites towards these rooms. | | `ignored_invites` | optional `Invite[]` | Ignore specific invites. | +where `Server` is + +| Content | Type | Description | +|------------|--------|-------------| +| `domain` | string | The server to ignore. | +| `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | + +where `Room` is + +| Content | Type | Description | +|------------|--------|-------------| +| `room_id` | string | The room to ignore. | +| `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | + +where `User` is + +| Content | Type | Description | +|------------|--------|-------------| +| `user_id` | string | The user to ignore. | +| `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | + where `Invite` is | Content | Type | Description | From 124e62b2db7e4ea3edfe6699a0b178d42797f4f3 Mon Sep 17 00:00:00 2001 From: David Teller Date: Thu, 7 Jul 2022 18:18:28 +0100 Subject: [PATCH 6/6] WIP: Applying feedback Turning fields of `m.ignored_invites` into a map instead of (essentially) a list of tuples. This guarantees unicity and may simplify implementation. --- proposals/3840-ignore-invites.md | 34 ++++++-------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/proposals/3840-ignore-invites.md b/proposals/3840-ignore-invites.md index a6c884847..3dc1dad93 100644 --- a/proposals/3840-ignore-invites.md +++ b/proposals/3840-ignore-invites.md @@ -25,39 +25,17 @@ We adopt a similar `m.ignored_invites` with content: | Content | Type | Description | |---------|------|-------------| -| `ignored_user_ids` | optional `User[]` | Ignore invites from these users. | -| `ignored_servers` | optional `Server[]` | Ignore invites from users in these homeservers. | -| `ignored_room_ids` | optional `Room[]` | Ignore invites towards these rooms. | -| `ignored_invites` | optional `Invite[]` | Ignore specific invites. | +| `ignored_user_ids` | optional map `UserId` => `IgnoreMetadata` | Ignore invites from these users. | +| `ignored_servers` | optional map `domain` => `IgnoreMetadata` | Ignore invites from users in these homeservers. | +| `ignored_room_ids` | optional map `RoomId` => `IgnoreMetadata` | Ignore invites towards these rooms. | +| `ignored_invites` | optional map `RoomId` => map `UserId` => `IgnoreMetadata` | Ignore specific invites. | -where `Server` is +where `IgnoreMetadata` is | Content | Type | Description | |------------|--------|-------------| -| `domain` | string | The server to ignore. | -| `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | - -where `Room` is - -| Content | Type | Description | -|------------|--------|-------------| -| `room_id` | string | The room to ignore. | -| `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | - -where `User` is - -| Content | Type | Description | -|------------|--------|-------------| -| `user_id` | string | The user to ignore. | -| `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | - -where `Invite` is - -| Content | Type | Description | -|------------|--------|-------------| -| `room_id` | string | The room in which the user is invited. | -| `user_id` | string | The user who issued the invite. | | `ts` | timestamp | The instant at which the invite was received. Used for visual purposes (i.e. order by most recent) and/or cleanup. | +| `reason` | optional string | A human-readable reason for ignoring the invite. | ### Client behaviour