DEV: Update display name in new quote format - Part 2 (#22104)

This change adds support retroactively updating display names in the new quote format when the user's name is changed. It happens through a background job that is triggered by a callback when a user is saved with a new name.
This commit is contained in:
Ted Johansson
2023-06-26 11:01:59 +08:00
committed by GitHub
parent 0b5d5b0d40
commit a183f14d09
7 changed files with 342 additions and 19 deletions

View File

@ -159,6 +159,19 @@ RSpec.describe User do
expect(SidebarSectionLink.exists?(linkable_type: "Tag", user_id: user.id)).to eq(false)
end
end
describe "#change_display_name" do
it "enqueues a job to retroactively update display name in quotes, etc." do
expect_enqueued_with(
job: :change_display_name,
args: {
user_id: user.id,
old_name: "Bruce Wayne",
new_name: "Batman",
},
) { user.update(name: "Batman") }
end
end
end
describe "Validations" do