Fix redacted events being returned in search results ordered by "recent" (#6522)
This commit is contained in:
parent
25f1244329
commit
5bfd8855d6
|
@ -0,0 +1 @@
|
||||||
|
Prevent redacted events from being returned during message search.
|
|
@ -385,7 +385,7 @@ class SearchStore(SearchBackgroundUpdateStore):
|
||||||
"""
|
"""
|
||||||
clauses = []
|
clauses = []
|
||||||
|
|
||||||
search_query = search_query = _parse_query(self.database_engine, search_term)
|
search_query = _parse_query(self.database_engine, search_term)
|
||||||
|
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ class SearchStore(SearchBackgroundUpdateStore):
|
||||||
"""
|
"""
|
||||||
clauses = []
|
clauses = []
|
||||||
|
|
||||||
search_query = search_query = _parse_query(self.database_engine, search_term)
|
search_query = _parse_query(self.database_engine, search_term)
|
||||||
|
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
|
@ -606,7 +606,12 @@ class SearchStore(SearchBackgroundUpdateStore):
|
||||||
|
|
||||||
results = list(filter(lambda row: row["room_id"] in room_ids, results))
|
results = list(filter(lambda row: row["room_id"] in room_ids, results))
|
||||||
|
|
||||||
events = yield self.get_events_as_list([r["event_id"] for r in results])
|
# We set redact_behaviour to BLOCK here to prevent redacted events being returned in
|
||||||
|
# search results (which is a data leak)
|
||||||
|
events = yield self.get_events_as_list(
|
||||||
|
[r["event_id"] for r in results],
|
||||||
|
redact_behaviour=EventRedactBehaviour.BLOCK,
|
||||||
|
)
|
||||||
|
|
||||||
event_map = {ev.event_id: ev for ev in events}
|
event_map = {ev.event_id: ev for ev in events}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue