FIX: Improvements to like button for archived topics (#17951)

* FIX: Do not allow to remove like if topic is archived

* FIX: Always show like button

The like button used to be hidden if the topic was archived and it had
no likes. This commit changes that to always show the like button, but
with a not-allowed cursor if the topic is archived.
This commit is contained in:
Bianca Nenciu
2022-08-22 14:58:02 +03:00
committed by GitHub
parent 33a2624f09
commit ec8306835d
6 changed files with 58 additions and 41 deletions

View File

@ -55,6 +55,14 @@ RSpec.describe PostSerializer do
expect(notify_user_action).to eq(nil)
end
it "shows like for archived topics even if user cannot act" do
post = Fabricate(:post)
post.topic.update!(archived: true)
serializer = PostSerializer.new(post, scope: Guardian.new(actor), root: false)
expect(serializer.as_json[:actions_summary].map { |a| a[:id] }).to include(PostActionType.types[:like])
end
end
context "with a post with reviewable content" do