Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Check that an appservice protocol has at least one service providing it #10532

Merged
merged 8 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10532.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Only report protocols that are implemented by at least one service, as required by the spec when handling `GET /_matrix/client/r0/thirdparty/protocols`.
Half-Shot marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 5 additions & 4 deletions synapse/handlers/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,6 @@ async def get_3pe_protocols(
protocols[p].append(info)

def _merge_instances(infos: List[JsonDict]) -> JsonDict:
if not infos:
return {}

# Merge the 'instances' lists of multiple results, but just take
# the other fields from the first as they ought to be identical
# copy the result so as not to corrupt the cached one
Expand All @@ -406,7 +403,11 @@ def _merge_instances(infos: List[JsonDict]) -> JsonDict:

return combined

return {p: _merge_instances(protocols[p]) for p in protocols.keys()}
return {
p: _merge_instances(protocols[p])
for p in protocols.keys()
if protocols[p]
clokep marked this conversation as resolved.
Show resolved Hide resolved
}

async def _get_services_for_event(
self, event: EventBase
Expand Down