FIX: Fill acting_user field instead of target_user in history

FIX: Fill acting_user field instead of target_user in history

diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 1ca9d9b..93f9401 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -232,7 +232,7 @@ class UsersController < ApplicationController
       if current_user.staff? && current_user != user
         StaffActionLogger.new(current_user).log_update_email(user)
       else
-        UserHistory.create!(action: UserHistory.actions[:update_email], target_user_id: user.id)
+        UserHistory.create!(action: UserHistory.actions[:update_email], acting_user_id: user.id)
       end
     end
 
@@ -264,7 +264,7 @@ class UsersController < ApplicationController
       if current_user.staff? && current_user != user
         StaffActionLogger.new(current_user).log_destroy_email(user)
       else
-        UserHistory.create(action: UserHistory.actions[:destroy_email], target_user_id: user.id)
+        UserHistory.create(action: UserHistory.actions[:destroy_email], acting_user_id: user.id)
       end
     end
 
diff --git a/lib/email_updater.rb b/lib/email_updater.rb
index bac085b..d615f7b 100644
--- a/lib/email_updater.rb
+++ b/lib/email_updater.rb
@@ -38,7 +38,7 @@ class EmailUpdater
     if @guardian.is_staff? && @guardian.user != @user
       StaffActionLogger.new(@guardian.user).log_add_email(@user)
     else
-      UserHistory.create!(action: UserHistory.actions[:add_email], target_user_id: @user.id)
+      UserHistory.create!(action: UserHistory.actions[:add_email], acting_user_id: @user.id)
     end
 
     if @guardian.is_staff? && !@user.staff?

GitHub sha: 84dfaad1

1 Like

This should be tested.

1 Like

tested per: DEV: Add test (#10064)