|
| 1 | +# MSC3847: Ignoring invites using individual policy rooms |
| 2 | + |
| 3 | +Receiving unwanted invites is something that users currently need to live |
| 4 | +with on the Matrix network. To alleviate this, Matrix needs a mechanism to |
| 5 | +let users specify that they are not interested in invites from specific |
| 6 | +users or towards specific rooms. |
| 7 | + |
| 8 | +In this proposal, we introduce the necessary extensions to let users do |
| 9 | +this and to let clients perform filtering of unwanted invites. |
| 10 | + |
| 11 | +We proceed as follows: |
| 12 | + |
| 13 | +1. We build upon the mechanism of policy rooms, defined in MSC2313, and define |
| 14 | +a user's individual policy room, which may be created on behalf of the user by |
| 15 | +a Matrix client, and which is shared across all devices and clients of the user. |
| 16 | +2. We build upon the mechanism of recommendations, also defined in MSC2313, |
| 17 | +and create a new recommendation for ignoring invites from a specific user, from |
| 18 | +a specific server or towards a specific room. |
| 19 | + |
| 20 | + |
| 21 | +## Proposal |
| 22 | + |
| 23 | +### Background |
| 24 | + |
| 25 | +MSC2313 defines policy rooms. A policy room is a room in which rules such |
| 26 | +as the following may be published: |
| 27 | + |
| 28 | +```jsonc |
| 29 | +{ |
| 30 | + "type": "m.policy.rule.user", // Or `m.policy.rule.server` or `m.policy.rule.room`. |
| 31 | + "state_key": "rule_1", // Arbitrary. |
| 32 | + "content": { |
| 33 | + "entity": "@alice:example.org", |
| 34 | + "recommendation": "m.ban", |
| 35 | + "reason": "undesirable behaviour" |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +Policy rooms are designed to be associated with entire servers, communities, |
| 41 | +individual rooms or individual users, but there is no specification in MSC2313 |
| 42 | +clarifying how to associate an issuer with a policy room. |
| 43 | + |
| 44 | +### Associating a policy room with a user |
| 45 | + |
| 46 | +For individual users, we introduce a new event `m.policies`, designed |
| 47 | +to be used as part of account data. This event has content: |
| 48 | + |
| 49 | +| Content | Type | Description | |
| 50 | +|---------|------|-------------| |
| 51 | +| `room` | Room ID or Alias | The main room in which a user may publish policies to be applied on their behalf. | |
| 52 | + |
| 53 | +We expect that future MSCs will expand upon this event `m.policies` and add |
| 54 | +other rooms where policies are published by other users or communities but |
| 55 | +that the current user also wish to apply, e.g. for distributing trust. This |
| 56 | +is, however, beyond the scope of the current proposal. |
| 57 | + |
| 58 | +The expected behavior is that if a user Alice has a `m.policies` with `room` R, |
| 59 | +then: |
| 60 | + |
| 61 | +- whenever Alice issues a new policy from their client or another trusted agent, |
| 62 | + this policy will be stored in room R; |
| 63 | +- any client or trusted agent acting on behalf of Alice will monitor room R for |
| 64 | + new policies and apply the recommendations on behalf of Alice. |
| 65 | + |
| 66 | +### A recommendation for ignoring invites |
| 67 | + |
| 68 | +We expand the **`enum`** `recommendation` with the following value |
| 69 | + |
| 70 | +| Value | Description | |
| 71 | +|---------|-------------| |
| 72 | +| `m.invites.ignore` | The user's client should not display any invite from/to the entity specified in `entity`. | |
| 73 | + |
| 74 | +In particular, if Alice has a policy with `recommendation` `m.invites.ignore`: |
| 75 | + |
| 76 | +- if `type` is `m.policy.rule.user` and `entity` is Bob's User ID, Alice's clients will not display any invite issued by Bob; |
| 77 | +- if `type` is `m.policy.rule.room` and `entity` is the Room ID or alias of room Bobroom, Alice's clients will not display any invite issued to Bobroom; |
| 78 | +- if `type` is `m.policy.rule.server` and `entity` is the server name of server Bobverse, Alice's clients will not display any invite issued from any account from Bobverse or towards a room alias on the Bobverse. |
| 79 | + |
| 80 | +### Client behaviour |
| 81 | + |
| 82 | +If a new policy `m.invites.ignore` appears in Alice's individual policy room: |
| 83 | + |
| 84 | +- any pending invite currently displayed that matches the `entity` is removed from display; |
| 85 | +- any incoming invite that matches the `entity` is not displayed among invites. |
| 86 | + |
| 87 | +However, clients are expected to offer the ability to look at any ignored invite, |
| 88 | +in a manner similar to a trashcan/recycle bin/undelete mechanism for desktop file |
| 89 | +systems. |
| 90 | + |
| 91 | +Similarly, if a policy `m.invites.ignore` is redacted/amended, clients should show any |
| 92 | +invite that doesn't match any `m.invites.ignore` entity anymore. |
| 93 | + |
| 94 | +### Server behavior |
| 95 | + |
| 96 | +As recommended in MSC2313, if a policy `m.ban` appears in Alice's individual policy room: |
| 97 | + |
| 98 | +- if `type` is `m.policy.rule.user`, ignore any message or invite from the user `entity`, as per `m.ignored_users`; |
| 99 | +- if `type` is `m.policy.rule.room`, ignore any message in the room or invite from the room `entity`; |
| 100 | +- if `type` is `m.policy.rule.server`, ignore any message in any room on server `entity`, any message from any user on server `entity`, any invite towards any room on server `entity`, any invite from any user on server `entity`. |
| 101 | + |
| 102 | +## Potential issues |
| 103 | + |
| 104 | +### Number of events |
| 105 | + |
| 106 | +There is a risk that the list of ignored invites of some users may grow a lot, which might have |
| 107 | +performance impact, both during initial sync and during filtering. We believe that this risk is |
| 108 | +limited. If necessary, clients may decide to cleanup ignored invites after some time. |
| 109 | + |
| 110 | +### Sync size |
| 111 | + |
| 112 | +With this proposal, any invite ignored with `m.invites.ignore` will still show up at each `/sync`. |
| 113 | +In time, this can grow expensive. |
| 114 | + |
| 115 | +If necessary, clients may decide to convert ignored invites into rejected invites or `m.ban` |
| 116 | +after a while. |
| 117 | + |
| 118 | +## Alternatives |
| 119 | + |
| 120 | +### Server-side filtering |
| 121 | + |
| 122 | +Just as `m.ignored_users_list` is handled mostly on the server, we could handle `m.invites.ignore` |
| 123 | +largely on the server. However, this would make it much harder to undo erroneous ignores (i.e. |
| 124 | +implementing some sort of recovery from trashcan) on the client. |
| 125 | + |
| 126 | +So we prefer handling things on the client, even if this may require more traffic. |
| 127 | + |
| 128 | +## Security considerations |
| 129 | + |
| 130 | +Can't think of any right now. |
| 131 | + |
| 132 | +## Unstable prefix |
| 133 | + |
| 134 | +During testing: |
| 135 | + |
| 136 | +- `m.invites.ignore` should be prefixed `org.matrix.msc3847.invites.ignore`; |
| 137 | +- `m.policies` should be prefixed `org.matrix.msc3847.policies`. |
0 commit comments