FIX: sidebar_list_destination on CurrentUserSerializer (#18660)

Before, `sidebar_list_destination` was an attribute on UserOptionSerializer. The problem was that this attribute was added to user model only when the user entered the preferences panel. We want that attribute to be available all the time, therefore it was moved to CurrentUserSerializer.
This commit is contained in:
Krzysztof Kotlarek
2022-10-19 11:48:36 +11:00
committed by GitHub
parent 99d9c933c6
commit 45bdfa1c84
10 changed files with 34 additions and 56 deletions

View File

@ -388,5 +388,14 @@ RSpec.describe CurrentUserSerializer do
end
end
describe "#sidebar_list_destination" do
it "returns choosen value or default" do
expect(serializer.as_json[:sidebar_list_destination]).to eq(SiteSetting.default_sidebar_list_destination)
user.user_option.update!(sidebar_list_destination: "unread_new")
expect(serializer.as_json[:sidebar_list_destination]).to eq("unread_new")
end
end
include_examples "#display_sidebar_tags", described_class
end