about summary refs log tree commit diff
diff options
context:
space:
mode:
authortrwnh <a@trwnh.com>2022-11-17 03:55:59 -0600
committerGitHub <noreply@github.com>2022-11-17 10:55:59 +0100
commit7fdeed5fbca1b6b761029870f02a3f812288f0aa (patch)
tree15ccdf8ac6b21b3e90eed1e3ea4fcfb5b818839e
parent72618ebf038cceead08a2f6233c2cdbbe04f8f37 (diff)
Make tag following idempotent (#20860)
-rw-r--r--app/controllers/api/v1/tags_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/api/v1/tags_controller.rb b/app/controllers/api/v1/tags_controller.rb
index 32f71bdce..0966ee469 100644
--- a/app/controllers/api/v1/tags_controller.rb
+++ b/app/controllers/api/v1/tags_controller.rb
@@ -12,7 +12,7 @@ class Api::V1::TagsController < Api::BaseController
   end
 
   def follow
-    TagFollow.create!(tag: @tag, account: current_account, rate_limit: true)
+    TagFollow.first_or_create!(tag: @tag, account: current_account, rate_limit: true)
     render json: @tag, serializer: REST::TagSerializer
   end