Skip to content

Commit

Permalink
Fix not being able to follow more than one hashtag (mastodon#21285)
Browse files Browse the repository at this point in the history
Fixes regression from mastodon#20860
  • Loading branch information
ClearlyClaire committed Nov 21, 2022
1 parent 69378ea commit 51a33ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/tags_controller.rb
Expand Up @@ -12,7 +12,7 @@ def show
end

def follow
TagFollow.first_or_create!(tag: @tag, account: current_account, rate_limit: true)
TagFollow.create_with(rate_limit: true).find_or_create_by!(tag: @tag, account: current_account)
render json: @tag, serializer: REST::TagSerializer
end

Expand Down
4 changes: 4 additions & 0 deletions spec/controllers/api/v1/tags_controller_spec.rb
Expand Up @@ -33,7 +33,11 @@
end

describe 'POST #follow' do
let!(:unrelated_tag) { Fabricate(:tag) }

before do
TagFollow.create!(account: user.account, tag: unrelated_tag)

post :follow, params: { id: name }
end

Expand Down

0 comments on commit 51a33ce

Please sign in to comment.