mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:08:15 +08:00
FEATURE: Site setting to display user avatars in user menu (#24514)
This commit is contained in:

committed by
GitHub

parent
e4c373194d
commit
ee05f57e2d
@ -32,7 +32,10 @@ RSpec.describe NotificationsController do
|
||||
context "when logged in" do
|
||||
context "as normal user" do
|
||||
fab!(:user) { sign_in(Fabricate(:user)) }
|
||||
fab!(:notification) { Fabricate(:notification, user: user) }
|
||||
fab!(:acting_user) { Fabricate(:user) }
|
||||
fab!(:notification) do
|
||||
Fabricate(:notification, user: user, data: { username: acting_user.username }.to_json)
|
||||
end
|
||||
|
||||
describe "#index" do
|
||||
it "should succeed for recent" do
|
||||
@ -424,6 +427,20 @@ RSpec.describe NotificationsController do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with `show_user_menu_avatars` setting enabled" do
|
||||
before { SiteSetting.show_user_menu_avatars = true }
|
||||
|
||||
it "serializes acting_user_avatar_template into notifications" do
|
||||
get "/notifications.json"
|
||||
|
||||
notifications = response.parsed_body["notifications"]
|
||||
expect(notifications).not_to be_empty
|
||||
notifications.each do |notification|
|
||||
expect(notification["acting_user_avatar_template"]).to be_present
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "should succeed" do
|
||||
|
@ -7051,6 +7051,18 @@ RSpec.describe UsersController do
|
||||
expect(notifications.size).to eq(1)
|
||||
expect(notifications.first["data"]["bookmark_id"]).to eq(bookmark_with_reminder.id)
|
||||
end
|
||||
|
||||
context "with `show_user_menu_avatars` setting enabled" do
|
||||
before { SiteSetting.show_user_menu_avatars = true }
|
||||
|
||||
it "serializes acting_user_avatar into notifications" do
|
||||
get "/u/#{user.username}/user-menu-bookmarks"
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
first_notification = response.parsed_body["notifications"].first
|
||||
expect(first_notification["acting_user_avatar_template"]).to be_present
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user