mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 21:09:23 -05:00
JOIN state_events rather than parsing unrecognized_keys to pull out member state_keys
This commit is contained in:
parent
3d73383d18
commit
b216b36892
@ -218,7 +218,7 @@ class ApplicationServiceStore(SQLBaseStore):
|
|||||||
# less obvious.
|
# less obvious.
|
||||||
|
|
||||||
# get all rooms matching the room ID regex.
|
# get all rooms matching the room ID regex.
|
||||||
room_entries = yield self.get_all_rooms() # RoomEntry list
|
room_entries = yield self.get_all_rooms()
|
||||||
matching_room_list = set([
|
matching_room_list = set([
|
||||||
r["room_id"] for r in room_entries if
|
r["room_id"] for r in room_entries if
|
||||||
service.is_interested_in_room(r["room_id"])
|
service.is_interested_in_room(r["room_id"])
|
||||||
|
@ -43,7 +43,6 @@ from synapse.util.logutils import log_function
|
|||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -161,8 +160,9 @@ class StreamStore(SQLBaseStore):
|
|||||||
|
|
||||||
# select all the events between from/to with a sensible limit
|
# select all the events between from/to with a sensible limit
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT e.event_id, e.room_id, e.type, e.unrecognized_keys, "
|
"SELECT e.event_id, e.room_id, e.type, s.state_key, "
|
||||||
"e.stream_ordering FROM events AS e "
|
"e.stream_ordering FROM events AS e LEFT JOIN state_events as s ON "
|
||||||
|
"e.event_id = s.event_id "
|
||||||
"WHERE e.stream_ordering > ? AND e.stream_ordering <= ? "
|
"WHERE e.stream_ordering > ? AND e.stream_ordering <= ? "
|
||||||
"ORDER BY stream_ordering ASC LIMIT %(limit)d "
|
"ORDER BY stream_ordering ASC LIMIT %(limit)d "
|
||||||
) % {
|
) % {
|
||||||
@ -174,13 +174,7 @@ class StreamStore(SQLBaseStore):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
if row["type"] == EventTypes.Member:
|
if row["type"] == EventTypes.Member:
|
||||||
# load up the content to inspect if some user the AS is
|
if service.is_interested_in_user(row.get("state_key")):
|
||||||
# interested in was invited to a room. We'll be passing this
|
|
||||||
# through _get_events_txn later, so ignore the fact that this
|
|
||||||
# may be a redacted event.
|
|
||||||
event_content = json.loads(row["unrecognized_keys"])
|
|
||||||
if (service.is_interested_in_user(
|
|
||||||
event_content.get("state_key"))):
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user