mirror of
https://github.com/element-hq/synapse
synced 2024-09-05 04:50:06 +00:00
Remove uses of events.content
This commit is contained in:
parent
88cc9cc69e
commit
2fe3f848b9
3 changed files with 12 additions and 7 deletions
|
@ -594,7 +594,8 @@ class RoomStore(RoomWorkerStore, SearchStore):
|
||||||
|
|
||||||
while next_token:
|
while next_token:
|
||||||
sql = """
|
sql = """
|
||||||
SELECT stream_ordering, content FROM events
|
SELECT stream_ordering, json FROM events
|
||||||
|
JOIN event_json USING (event_id)
|
||||||
WHERE room_id = ?
|
WHERE room_id = ?
|
||||||
AND stream_ordering < ?
|
AND stream_ordering < ?
|
||||||
AND contains_url = ? AND outlier = ?
|
AND contains_url = ? AND outlier = ?
|
||||||
|
@ -606,8 +607,8 @@ class RoomStore(RoomWorkerStore, SearchStore):
|
||||||
next_token = None
|
next_token = None
|
||||||
for stream_ordering, content_json in txn:
|
for stream_ordering, content_json in txn:
|
||||||
next_token = stream_ordering
|
next_token = stream_ordering
|
||||||
content = json.loads(content_json)
|
event_json = json.loads(content_json)
|
||||||
|
content = event_json["content"]
|
||||||
content_url = content.get("url")
|
content_url = content.get("url")
|
||||||
thumbnail_url = content.get("info", {}).get("thumbnail_url")
|
thumbnail_url = content.get("info", {}).get("thumbnail_url")
|
||||||
|
|
||||||
|
|
|
@ -645,8 +645,9 @@ class RoomMemberStore(RoomMemberWorkerStore):
|
||||||
|
|
||||||
def add_membership_profile_txn(txn):
|
def add_membership_profile_txn(txn):
|
||||||
sql = ("""
|
sql = ("""
|
||||||
SELECT stream_ordering, event_id, events.room_id, content
|
SELECT stream_ordering, event_id, events.room_id, event_json.json
|
||||||
FROM events
|
FROM events
|
||||||
|
INNER JOIN event_json USING (event_id)
|
||||||
INNER JOIN room_memberships USING (event_id)
|
INNER JOIN room_memberships USING (event_id)
|
||||||
WHERE ? <= stream_ordering AND stream_ordering < ?
|
WHERE ? <= stream_ordering AND stream_ordering < ?
|
||||||
AND type = 'm.room.member'
|
AND type = 'm.room.member'
|
||||||
|
@ -667,7 +668,8 @@ class RoomMemberStore(RoomMemberWorkerStore):
|
||||||
event_id = row["event_id"]
|
event_id = row["event_id"]
|
||||||
room_id = row["room_id"]
|
room_id = row["room_id"]
|
||||||
try:
|
try:
|
||||||
content = json.loads(row["content"])
|
event_json = json.loads(row["json"])
|
||||||
|
content = event_json['content']
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,9 @@ class SearchStore(BackgroundUpdateStore):
|
||||||
|
|
||||||
def reindex_search_txn(txn):
|
def reindex_search_txn(txn):
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT stream_ordering, event_id, room_id, type, content, "
|
"SELECT stream_ordering, event_id, room_id, type, json, "
|
||||||
" origin_server_ts FROM events"
|
" origin_server_ts FROM events"
|
||||||
|
" JOIN event_json USING (event_id)"
|
||||||
" WHERE ? <= stream_ordering AND stream_ordering < ?"
|
" WHERE ? <= stream_ordering AND stream_ordering < ?"
|
||||||
" AND (%s)"
|
" AND (%s)"
|
||||||
" ORDER BY stream_ordering DESC"
|
" ORDER BY stream_ordering DESC"
|
||||||
|
@ -104,7 +105,8 @@ class SearchStore(BackgroundUpdateStore):
|
||||||
stream_ordering = row["stream_ordering"]
|
stream_ordering = row["stream_ordering"]
|
||||||
origin_server_ts = row["origin_server_ts"]
|
origin_server_ts = row["origin_server_ts"]
|
||||||
try:
|
try:
|
||||||
content = json.loads(row["content"])
|
event_json = json.loads(row["json"])
|
||||||
|
content = event_json["content"]
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue