Add proper follow-user class to liquid when passed UserDecorator (#20101)
* Add proper follow-user class to liquid * Adjust test
This commit is contained in:
parent
dfe71c15a1
commit
d6d7eeeb59
2 changed files with 6 additions and 1 deletions
|
|
@ -186,8 +186,8 @@ module ApplicationHelper
|
|||
def follow_button(followable, style = "full", classes = "")
|
||||
return if followable == Users::DeletedUser
|
||||
|
||||
user_follow = followable.instance_of?(User) ? "follow-user" : ""
|
||||
followable_type = followable.class_name
|
||||
user_follow = followable_type.include?("User") ? "follow-user" : "" # User or UserDecorator
|
||||
followable_name = followable.name
|
||||
|
||||
tag.button(
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@ RSpec.describe UserTag, type: :liquid_tag do
|
|||
liquid = generate_user_tag(user.username)
|
||||
expect(liquid.render).to include("<img")
|
||||
end
|
||||
|
||||
it "renders the proper follow button for a user" do
|
||||
liquid = generate_user_tag(user.username)
|
||||
expect(liquid.render).to include("follow-user")
|
||||
end
|
||||
end
|
||||
|
||||
context "when given an invalid username" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue