mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-27 01:45:18 -04:00
Fix a bug where redactions were not being sent over federation if we did not have the original event. (#13813)
This commit is contained in:
parent
6a92944854
commit
a86b2f6837
6 changed files with 62 additions and 38 deletions
|
@ -474,7 +474,7 @@ class EventsWorkerStore(SQLBaseStore):
|
|||
return []
|
||||
|
||||
# there may be duplicates so we cast the list to a set
|
||||
event_entry_map = await self._get_events_from_cache_or_db(
|
||||
event_entry_map = await self.get_unredacted_events_from_cache_or_db(
|
||||
set(event_ids), allow_rejected=allow_rejected
|
||||
)
|
||||
|
||||
|
@ -509,7 +509,9 @@ class EventsWorkerStore(SQLBaseStore):
|
|||
continue
|
||||
|
||||
redacted_event_id = entry.event.redacts
|
||||
event_map = await self._get_events_from_cache_or_db([redacted_event_id])
|
||||
event_map = await self.get_unredacted_events_from_cache_or_db(
|
||||
[redacted_event_id]
|
||||
)
|
||||
original_event_entry = event_map.get(redacted_event_id)
|
||||
if not original_event_entry:
|
||||
# we don't have the redacted event (or it was rejected).
|
||||
|
@ -588,11 +590,16 @@ class EventsWorkerStore(SQLBaseStore):
|
|||
return events
|
||||
|
||||
@cancellable
|
||||
async def _get_events_from_cache_or_db(
|
||||
self, event_ids: Iterable[str], allow_rejected: bool = False
|
||||
async def get_unredacted_events_from_cache_or_db(
|
||||
self,
|
||||
event_ids: Iterable[str],
|
||||
allow_rejected: bool = False,
|
||||
) -> Dict[str, EventCacheEntry]:
|
||||
"""Fetch a bunch of events from the cache or the database.
|
||||
|
||||
Note that the events pulled by this function will not have any redactions
|
||||
applied, and no guarantee is made about the ordering of the events returned.
|
||||
|
||||
If events are pulled from the database, they will be cached for future lookups.
|
||||
|
||||
Unknown events are omitted from the response.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue