summary refs log tree commit diff
path: root/synapse/appservice/api.py
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2021-02-09 19:07:00 +0000
committerGitHub <noreply@github.com>2021-02-09 19:07:00 +0000
commit6bf58d8194ff7c89a1c8249bade78492bbfa0900 (patch)
treedbaccc690b25f7273562569ba25b09c8a0a90b0b /synapse/appservice/api.py
parentAdd complement running monolith synapse to buildkite pipeline (#80) (diff)
downloadsynapse-6bf58d8194ff7c89a1c8249bade78492bbfa0900.tar.xz
Add knocking support (#81)
Implement knocking as defined by https://github.com/matrix-org/matrix-doc/pull/2403

This is the base knocking stuff, taken from https://github.com/matrix-org/synapse/pull/6739
and does not include any public room directory changes.

While knocking hasn't merged yet on mainline due to waiting on getting Complement
into Synapse's CI, the code has been well-tested.
Diffstat (limited to 'synapse/appservice/api.py')
-rw-r--r--synapse/appservice/api.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py

index e366a982b8..5dcd9ea290 100644 --- a/synapse/appservice/api.py +++ b/synapse/appservice/api.py
@@ -18,7 +18,7 @@ from typing import TYPE_CHECKING, List, Optional, Tuple from prometheus_client import Counter -from synapse.api.constants import EventTypes, ThirdPartyEntityKind +from synapse.api.constants import EventTypes, Membership, ThirdPartyEntityKind from synapse.api.errors import CodeMessageException from synapse.events import EventBase from synapse.events.utils import serialize_event @@ -249,9 +249,14 @@ class ApplicationServiceApi(SimpleHttpClient): e, time_now, as_client_event=True, - is_invite=( + # If this is an invite or a knock membership event, and we're interested + # in this user, then include any stripped state alongside the event. + include_stripped_room_state=( e.type == EventTypes.Member - and e.membership == "invite" + and ( + e.membership == Membership.INVITE + or e.membership == Membership.KNOCK + ) and service.is_interested_in_user(e.state_key) ), )