User Changed webhook: add 'nickname' and 'old_nickname' #93582
@ -144,10 +144,8 @@ def modified_user_to_webhooks(sender, user: UserModel, **kwargs):
|
||||
"email": user.email,
|
||||
"roles": sorted(user.public_roles()),
|
||||
"avatar_changed": old_avatar != cur_avatar,
|
||||
"date_deletion_requested": user.date_deletion_requested.isoformat()
|
||||
if user.date_deletion_requested else None,
|
||||
"confirmed_email_at": user.confirmed_email_at.isoformat()
|
||||
if user.confirmed_email_at else None,
|
||||
"date_deletion_requested": isoformat(user.date_deletion_requested),
|
||||
"confirmed_email_at": isoformat(user.confirmed_email_at),
|
||||
# FIXME(anna): add nickname
|
||||
}
|
||||
json_payload = json.dumps(payload).encode()
|
||||
@ -156,3 +154,10 @@ def modified_user_to_webhooks(sender, user: UserModel, **kwargs):
|
||||
for hook in hooks:
|
||||
log.debug("Sending to %s, %s", hook, hook.url)
|
||||
hook.send(json_payload, sess)
|
||||
|
||||
|
||||
def isoformat(timestamp):
|
||||
"""None-safe timestamp.isoformat()."""
|
||||
if not timestamp:
|
||||
return None
|
||||
return timestamp.isoformat()
|
||||
|
Loading…
Reference in New Issue
Block a user