do_change_full_name: Include original name in RealmAuditLog.

This commit is contained in:
Tim Abbott 2017-08-16 16:17:54 -07:00
parent 4b72b461e5
commit 98aae162dc

View File

@ -2007,12 +2007,13 @@ def do_change_password(user_profile, password, commit=True,
def do_change_full_name(user_profile, full_name, acting_user):
# type: (UserProfile, Text, UserProfile) -> None
old_name = user_profile.full_name
user_profile.full_name = full_name
user_profile.save(update_fields=["full_name"])
event_time = timezone_now()
RealmAuditLog.objects.create(realm=user_profile.realm, acting_user=acting_user,
modified_user=user_profile, event_type='user_full_name_changed',
event_time=event_time)
event_time=event_time, extra_data=old_name)
payload = dict(email=user_profile.email,
user_id=user_profile.id,
full_name=user_profile.full_name)