]> cat aescling's git repositories - mastodon.git/commitdiff
Fix being able to appeal a strike unlimited times (#18529)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 26 May 2022 20:08:12 +0000 (22:08 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Fri, 27 May 2022 03:55:21 +0000 (23:55 -0400)
Peculiarity of the `has_one` association is that the convenience
creation method deletes the previous association even if the new
one is invalid

app/services/appeal_service.rb

index 1397c50f5faa7966ae87f21822d0821f3db1aec0..cef9be05fd04367326f3cb25a4e8eeec5172791f 100644 (file)
@@ -14,7 +14,8 @@ class AppealService < BaseService
   private
 
   def create_appeal!
-    @appeal = @strike.create_appeal!(
+    @appeal = Appeal.create!(
+      strike: @strike,
       text: @text,
       account: @strike.target_account
     )