mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 21:19:21 -05:00
Fixed a bug with reactivating users with the admin API (#8362)
Fixes: #8359 Trying to reactivate a user with the admin API (`PUT /_synapse/admin/v2/users/<user_name>`) causes an internal server error. Seems to be a regression in #8033.
This commit is contained in:
parent
4da01f9c61
commit
8998217540
1
changelog.d/8362.bugfix
Normal file
1
changelog.d/8362.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fixed a regression in v1.19.0 with reactivating users through the admin API.
|
@ -100,7 +100,7 @@ class UserErasureStore(UserErasureWorkerStore):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# They are there, delete them.
|
# They are there, delete them.
|
||||||
self.simple_delete_one_txn(
|
self.db_pool.simple_delete_one_txn(
|
||||||
txn, "erased_users", keyvalues={"user_id": user_id}
|
txn, "erased_users", keyvalues={"user_id": user_id}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -874,6 +874,10 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||||||
)
|
)
|
||||||
self.render(request)
|
self.render(request)
|
||||||
self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"])
|
self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"])
|
||||||
|
self._is_erased("@user:test", False)
|
||||||
|
d = self.store.mark_user_erased("@user:test")
|
||||||
|
self.assertIsNone(self.get_success(d))
|
||||||
|
self._is_erased("@user:test", True)
|
||||||
|
|
||||||
# Attempt to reactivate the user (without a password).
|
# Attempt to reactivate the user (without a password).
|
||||||
request, channel = self.make_request(
|
request, channel = self.make_request(
|
||||||
@ -906,6 +910,7 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||||||
self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"])
|
self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"])
|
||||||
self.assertEqual("@user:test", channel.json_body["name"])
|
self.assertEqual("@user:test", channel.json_body["name"])
|
||||||
self.assertEqual(False, channel.json_body["deactivated"])
|
self.assertEqual(False, channel.json_body["deactivated"])
|
||||||
|
self._is_erased("@user:test", False)
|
||||||
|
|
||||||
def test_set_user_as_admin(self):
|
def test_set_user_as_admin(self):
|
||||||
"""
|
"""
|
||||||
@ -996,6 +1001,15 @@ class UserRestTestCase(unittest.HomeserverTestCase):
|
|||||||
# Ensure they're still alive
|
# Ensure they're still alive
|
||||||
self.assertEqual(0, channel.json_body["deactivated"])
|
self.assertEqual(0, channel.json_body["deactivated"])
|
||||||
|
|
||||||
|
def _is_erased(self, user_id, expect):
|
||||||
|
"""Assert that the user is erased or not
|
||||||
|
"""
|
||||||
|
d = self.store.is_user_erased(user_id)
|
||||||
|
if expect:
|
||||||
|
self.assertTrue(self.get_success(d))
|
||||||
|
else:
|
||||||
|
self.assertFalse(self.get_success(d))
|
||||||
|
|
||||||
|
|
||||||
class UserMembershipRestTestCase(unittest.HomeserverTestCase):
|
class UserMembershipRestTestCase(unittest.HomeserverTestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user