mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-20 10:55:09 +03:00
Handle current batch number being null
This commit is contained in:
parent
3c446d0a81
commit
7285afa4be
1 changed files with 4 additions and 2 deletions
|
@ -212,7 +212,8 @@ class ProfileHandler(BaseHandler):
|
||||||
if new_displayname == '':
|
if new_displayname == '':
|
||||||
new_displayname = None
|
new_displayname = None
|
||||||
|
|
||||||
new_batchnum = (yield self.store.get_latest_profile_replication_batch_number()) + 1
|
cur_batchnum = yield self.store.get_latest_profile_replication_batch_number()
|
||||||
|
new_batchnum = 0 if cur_batchnum is None else cur_batchnum + 1
|
||||||
|
|
||||||
yield self.store.set_profile_displayname(
|
yield self.store.set_profile_displayname(
|
||||||
target_user.localpart, new_displayname, new_batchnum
|
target_user.localpart, new_displayname, new_batchnum
|
||||||
|
@ -267,7 +268,8 @@ class ProfileHandler(BaseHandler):
|
||||||
if not by_admin and target_user != requester.user:
|
if not by_admin and target_user != requester.user:
|
||||||
raise AuthError(400, "Cannot set another user's avatar_url")
|
raise AuthError(400, "Cannot set another user's avatar_url")
|
||||||
|
|
||||||
new_batchnum = yield self.store.get_latest_profile_replication_batch_number() + 1
|
cur_batchnum = yield self.store.get_latest_profile_replication_batch_number()
|
||||||
|
new_batchnum = 0 if cur_batchnum is None else cur_batchnum + 1
|
||||||
|
|
||||||
yield self.store.set_profile_avatar_url(
|
yield self.store.set_profile_avatar_url(
|
||||||
target_user.localpart, new_avatar_url, new_batchnum,
|
target_user.localpart, new_avatar_url, new_batchnum,
|
||||||
|
|
Loading…
Reference in a new issue