mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: log name changes only when the name is actually updated
This commit is contained in:
@@ -123,9 +123,9 @@ class UserUpdater
|
|||||||
update_muted_users(attributes[:muted_usernames])
|
update_muted_users(attributes[:muted_usernames])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
name_changed = user.name_changed?
|
||||||
if (saved = (!save_options || user.user_option.save) && user_profile.save && user.save) &&
|
if (saved = (!save_options || user.user_option.save) && user_profile.save && user.save) &&
|
||||||
(attributes[:name].present? && old_user_name.casecmp(attributes.fetch(:name)) != 0) ||
|
(name_changed && old_user_name.casecmp(attributes.fetch(:name)) != 0)
|
||||||
(attributes[:name].blank? && old_user_name.present?)
|
|
||||||
|
|
||||||
StaffActionLogger.new(@actor).log_name_change(
|
StaffActionLogger.new(@actor).log_name_change(
|
||||||
user.id,
|
user.id,
|
||||||
|
|||||||
@@ -308,6 +308,10 @@ describe UserUpdater do
|
|||||||
UserUpdater.new(acting_user, user).update(name: 'JiM TOm')
|
UserUpdater.new(acting_user, user).update(name: 'JiM TOm')
|
||||||
end.to_not change { UserHistory.count }
|
end.to_not change { UserHistory.count }
|
||||||
|
|
||||||
|
expect do
|
||||||
|
UserUpdater.new(acting_user, user).update(bio_raw: 'foo bar')
|
||||||
|
end.to_not change { UserHistory.count }
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
UserUpdater.new(acting_user, user_without_name).update(bio_raw: 'foo bar')
|
UserUpdater.new(acting_user, user_without_name).update(bio_raw: 'foo bar')
|
||||||
end.to_not change { UserHistory.count }
|
end.to_not change { UserHistory.count }
|
||||||
|
|||||||
Reference in New Issue
Block a user