Files
discourse/plugins/chat/spec/serializer/user_serializer_spec.rb
Joffrey JAFFEUX 4c8420833e FEATURE: One-click chat reaction settings (#32150)
Adds a one-click chat reactions setting to the chat preferences page
where members can determine what one-click reactions are shown in chat.

- Frequent: This will be the default setting. (Automatically set based
on most used chat reactions)
- Custom: Members can choose up to three reactions they want to see in
their one-click chat/DM reactions menu. Defaults are `❤️`, `👍` ,
and `😄`.


![image](https://github.com/user-attachments/assets/8913db0e-d6ec-4347-ad91-2329206b127c)

This pull request is essentially the work of @dsims in
https://github.com/discourse/discourse/pull/31761

---------

Co-authored-by: dsims <1041068+dsims@users.noreply.github.com>
2025-04-04 09:15:13 +02:00

34 lines
1016 B
Ruby

# frozen_string_literal: true
RSpec.describe UserSerializer do
fab!(:user)
let(:serializer) { described_class.new(user, scope: Guardian.new(user), root: false) }
describe "#chat_separate_sidebar_mode" do
it "is present" do
expect(serializer.as_json[:user_option][:chat_separate_sidebar_mode]).to eq("default")
end
end
describe "#chat_quick_reaction_type" do
it "is present with default enum string" do
expect(serializer.as_json[:user_option][:chat_quick_reaction_type]).to eq("frequent")
end
end
describe "#chat_quick_reactions_custom" do
it "is present with default enum string" do
expect(serializer.as_json[:user_option][:chat_quick_reactions_custom]).to eq(nil)
end
context "with custom quick reactions" do
before { user.user_option.update!(chat_quick_reactions_custom: "tada|smiley") }
it "is present" do
expect(serializer.as_json[:user_option][:chat_quick_reactions_custom]).to eq("tada|smiley")
end
end
end
end