FEATURE: Site setting to display user avatars in user menu (#24514)

This commit is contained in:
Mark VanLandingham
2023-12-07 11:30:44 -06:00
committed by GitHub
parent e4c373194d
commit ee05f57e2d
26 changed files with 314 additions and 15 deletions

View File

@ -806,4 +806,34 @@ RSpec.describe Notification do
expect(notification.shelved_notification).to be_nil
end
end
describe ".populate_acting_user" do
fab!(:user1) { Fabricate(:user) }
fab!(:user2) { Fabricate(:user) }
fab!(:user3) { Fabricate(:user) }
fab!(:user4) { Fabricate(:user) }
fab!(:notification1) do
Fabricate(:notification, user: user, data: { username: user1.username }.to_json)
end
fab!(:notification2) do
Fabricate(:notification, user: user, data: { display_username: user2.username }.to_json)
end
fab!(:notification3) do
Fabricate(:notification, user: user, data: { mentioned_by_username: user3.username }.to_json)
end
fab!(:notification4) do
Fabricate(:notification, user: user, data: { invited_by_username: user4.username }.to_json)
end
it "Sets the acting_user correctly for each notification" do
Notification.populate_acting_user(
[notification1, notification2, notification3, notification4],
)
expect(notification1.acting_user).to eq(user1)
expect(notification2.acting_user).to eq(user2)
expect(notification3.acting_user).to eq(user3)
expect(notification4.acting_user).to eq(user4)
end
end
end