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,
|
"email": user.email,
|
||||||
"roles": sorted(user.public_roles()),
|
"roles": sorted(user.public_roles()),
|
||||||
"avatar_changed": old_avatar != cur_avatar,
|
"avatar_changed": old_avatar != cur_avatar,
|
||||||
"date_deletion_requested": user.date_deletion_requested.isoformat()
|
"date_deletion_requested": isoformat(user.date_deletion_requested),
|
||||||
if user.date_deletion_requested else None,
|
"confirmed_email_at": isoformat(user.confirmed_email_at),
|
||||||
"confirmed_email_at": user.confirmed_email_at.isoformat()
|
|
||||||
if user.confirmed_email_at else None,
|
|
||||||
# FIXME(anna): add nickname
|
# FIXME(anna): add nickname
|
||||||
}
|
}
|
||||||
json_payload = json.dumps(payload).encode()
|
json_payload = json.dumps(payload).encode()
|
||||||
@ -156,3 +154,10 @@ def modified_user_to_webhooks(sender, user: UserModel, **kwargs):
|
|||||||
for hook in hooks:
|
for hook in hooks:
|
||||||
log.debug("Sending to %s, %s", hook, hook.url)
|
log.debug("Sending to %s, %s", hook, hook.url)
|
||||||
hook.send(json_payload, sess)
|
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