FIX: log name changes only when the name is actually updated

This commit is contained in:
Arpit Jalan
2018-11-30 15:30:34 +05:30
parent fc0b7c9e26
commit 059e36a6ff
2 changed files with 6 additions and 2 deletions

View File

@@ -123,9 +123,9 @@ class UserUpdater
update_muted_users(attributes[:muted_usernames])
end
name_changed = user.name_changed?
if (saved = (!save_options || user.user_option.save) && user_profile.save && user.save) &&
(attributes[:name].present? && old_user_name.casecmp(attributes.fetch(:name)) != 0) ||
(attributes[:name].blank? && old_user_name.present?)
(name_changed && old_user_name.casecmp(attributes.fetch(:name)) != 0)
StaffActionLogger.new(@actor).log_name_change(
user.id,