This repository was archived by the owner on Mar 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +12
-12
lines changed
synapse/storage/databases/main Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Original file line number Diff line number Diff line change
1
+ Stop reading from column `user_id` of table `profiles`.
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ def get_users_paginate_txn(
198
198
txn : LoggingTransaction ,
199
199
) -> Tuple [List [JsonDict ], int ]:
200
200
filters = []
201
- args = [self . hs . config . server . server_name ]
201
+ args : list = []
202
202
203
203
# Set ordering
204
204
order_by_column = UserSortOrder (order_by ).value
@@ -265,7 +265,7 @@ def get_users_paginate_txn(
265
265
266
266
sql_base = f"""
267
267
FROM users as u
268
- LEFT JOIN profiles AS p ON u.name = '@' || p.user_id || ':' || ?
268
+ LEFT JOIN profiles AS p ON u.name = p.full_user_id
269
269
LEFT JOIN erased_users AS eu ON u.name = eu.user_id
270
270
{ where_clause }
271
271
"""
Original file line number Diff line number Diff line change @@ -697,7 +697,7 @@ def get_users_media_usage_paginate_txn(
697
697
txn : LoggingTransaction ,
698
698
) -> Tuple [List [JsonDict ], int ]:
699
699
filters = []
700
- args = [self . hs . config . server . server_name ]
700
+ args : list = []
701
701
702
702
if search_term :
703
703
filters .append ("(lmr.user_id LIKE ? OR displayname LIKE ?)" )
@@ -733,7 +733,7 @@ def get_users_media_usage_paginate_txn(
733
733
734
734
sql_base = """
735
735
FROM local_media_repository as lmr
736
- LEFT JOIN profiles AS p ON lmr.user_id = '@' || p.user_id || ':' || ?
736
+ LEFT JOIN profiles AS p ON lmr.user_id = p.full_user_id
737
737
{}
738
738
GROUP BY lmr.user_id, displayname
739
739
""" .format (
Original file line number Diff line number Diff line change @@ -409,23 +409,22 @@ def _populate_user_directory_process_users_txn(
409
409
txn , users_to_work_on
410
410
)
411
411
412
- # Next fetch their profiles. Note that the `user_id` here is the
413
- # *localpart*, and that not all users have profiles.
412
+ # Next fetch their profiles. Note that not all users have profiles.
414
413
profile_rows = self .db_pool .simple_select_many_txn (
415
414
txn ,
416
415
table = "profiles" ,
417
- column = "user_id " ,
418
- iterable = [ get_localpart_from_id ( u ) for u in users_to_insert ] ,
416
+ column = "full_user_id " ,
417
+ iterable = list ( users_to_insert ) ,
419
418
retcols = (
420
- "user_id " ,
419
+ "full_user_id " ,
421
420
"displayname" ,
422
421
"avatar_url" ,
423
422
),
424
423
keyvalues = {},
425
424
)
426
425
profiles = {
427
- f"@ { row ['user_id' ] } : { self . server_name } " : _UserDirProfile (
428
- f"@ { row ['user_id' ] } : { self . server_name } " ,
426
+ row ["full_user_id" ] : _UserDirProfile (
427
+ row ["full_user_id" ] ,
429
428
row ["displayname" ],
430
429
row ["avatar_url" ],
431
430
)
Original file line number Diff line number Diff line change @@ -1418,7 +1418,7 @@ def test_deactivate_user_erase_true_no_profile(self) -> None:
1418
1418
# To test deactivation for users without a profile, we delete the profile information for our user.
1419
1419
self .get_success (
1420
1420
self .store .db_pool .simple_delete_one (
1421
- table = "profiles" , keyvalues = {"user_id " : "user" }
1421
+ table = "profiles" , keyvalues = {"full_user_id " : "@ user:test " }
1422
1422
)
1423
1423
)
1424
1424
You can’t perform that action at this time.
0 commit comments