about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-02-24 22:21:40 +0100
committerGitHub <noreply@github.com>2020-02-24 22:21:40 +0100
commit7face973fa1c7d6c18b06d427ea0b7a741d11466 (patch)
tree708b97d8d64c48648c03cc930328ccfc4ea7ae9e
parentcf4fe6caefc45e18c82d619933a9b5f662503aa4 (diff)
Fix dismissing an announcement twice raising an obscure error (#13124)
-rw-r--r--app/controllers/api/v1/announcements_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/api/v1/announcements_controller.rb b/app/controllers/api/v1/announcements_controller.rb
index 1e692ff75..ee79fc19f 100644
--- a/app/controllers/api/v1/announcements_controller.rb
+++ b/app/controllers/api/v1/announcements_controller.rb
@@ -11,7 +11,7 @@ class Api::V1::AnnouncementsController < Api::BaseController
   end
 
   def dismiss
-    AnnouncementMute.create!(account: current_account, announcement: @announcement)
+    AnnouncementMute.find_or_create_by!(account: current_account, announcement: @announcement)
     render_empty
   end