mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-22 04:34:28 +03:00
hide_profile: false should mean not to hide the profile :/
This commit is contained in:
parent
08919847c1
commit
82886e4c8f
3 changed files with 6 additions and 4 deletions
|
@ -274,9 +274,9 @@ class BaseProfileHandler(BaseHandler):
|
||||||
"""
|
"""
|
||||||
Sets the 'active' flag on a user profile. If set to false, the user account is
|
Sets the 'active' flag on a user profile. If set to false, the user account is
|
||||||
considered deactivated or hidden.
|
considered deactivated or hidden.
|
||||||
If 'hide' is true, then we just try hide the user rather than deactivate it.
|
If 'hide' is true, then we interpret active=False as a request to try to hide the
|
||||||
This means withholding it from replication (and mark it as inactive) rather than
|
user rather than deactivating it. This means withholding the profile from replication
|
||||||
clearing the profile from the HS DB.
|
(and mark it as inactive) rather than clearing the profile from the HS DB.
|
||||||
Note that unlike set_displayname and set_avatar_url, this does *not* perform
|
Note that unlike set_displayname and set_avatar_url, this does *not* perform
|
||||||
authorization checks! This is because the only place it's used currently is
|
authorization checks! This is because the only place it's used currently is
|
||||||
in account deactivation where we've already done these checks anyway.
|
in account deactivation where we've already done these checks anyway.
|
||||||
|
|
|
@ -52,7 +52,7 @@ class AccountDataServlet(RestServlet):
|
||||||
if account_data_type == "im.vector.hide_profile":
|
if account_data_type == "im.vector.hide_profile":
|
||||||
user = UserID.from_string(user_id)
|
user = UserID.from_string(user_id)
|
||||||
hide_profile = body.get('hide_profile')
|
hide_profile = body.get('hide_profile')
|
||||||
yield self._profile_handler.set_active(user, hide_profile, True)
|
yield self._profile_handler.set_active(user, not hide_profile, True)
|
||||||
|
|
||||||
max_id = yield self.store.add_account_data_for_user(
|
max_id = yield self.store.add_account_data_for_user(
|
||||||
user_id, account_data_type, body
|
user_id, account_data_type, body
|
||||||
|
|
|
@ -153,6 +153,8 @@ class ProfileWorkerStore(SQLBaseStore):
|
||||||
"batch": batchnum,
|
"batch": batchnum,
|
||||||
}
|
}
|
||||||
if not active and not hide:
|
if not active and not hide:
|
||||||
|
# we are deactivating for real (not in hide mode)
|
||||||
|
# so clear the profile.
|
||||||
values["avatar_url"] = None
|
values["avatar_url"] = None
|
||||||
values["displayname"] = None
|
values["displayname"] = None
|
||||||
return self._simple_upsert(
|
return self._simple_upsert(
|
||||||
|
|
Loading…
Reference in a new issue