about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-05-26 22:49:47 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-05-26 22:49:47 +0200
commit7c6fff34d059c90eafdb1beeb2597a9606453582 (patch)
treec1376f9a3a7533c2d43fc9e281c92d168e941846 /app/services
parenta33a0f69523298520704b98d4dc7fdd1accae642 (diff)
parent52f4e834f293c9fdbf5805639d022ac4e3856b75 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'app/services')
-rw-r--r--app/services/appeal_service.rb3
-rw-r--r--app/services/approve_appeal_service.rb3
-rw-r--r--app/services/report_service.rb2
-rw-r--r--app/services/unfollow_service.rb6
-rw-r--r--app/services/vote_service.rb2
5 files changed, 12 insertions, 4 deletions
diff --git a/app/services/appeal_service.rb b/app/services/appeal_service.rb
index 1397c50f5..cef9be05f 100644
--- a/app/services/appeal_service.rb
+++ b/app/services/appeal_service.rb
@@ -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
     )
diff --git a/app/services/approve_appeal_service.rb b/app/services/approve_appeal_service.rb
index 37a08b46e..96aaaa7d0 100644
--- a/app/services/approve_appeal_service.rb
+++ b/app/services/approve_appeal_service.rb
@@ -52,8 +52,9 @@ class ApproveAppealService < BaseService
   end
 
   def undo_mark_statuses_as_sensitive!
+    representative_account = Account.representative
     @strike.statuses.includes(:media_attachments).each do |status|
-      UpdateStatusService.new.call(status, @current_account.id, sensitive: false) if status.with_media?
+      UpdateStatusService.new.call(status, representative_account.id, sensitive: false) if status.with_media?
     end
   end
 
diff --git a/app/services/report_service.rb b/app/services/report_service.rb
index 9d784c341..d251bb33f 100644
--- a/app/services/report_service.rb
+++ b/app/services/report_service.rb
@@ -57,7 +57,7 @@ class ReportService < BaseService
   end
 
   def reported_status_ids
-    @target_account.statuses.with_discarded.find(Array(@status_ids)).pluck(:id)
+    AccountStatusesFilter.new(@target_account, @source_account).results.with_discarded.find(Array(@status_ids)).pluck(:id)
   end
 
   def payload
diff --git a/app/services/unfollow_service.rb b/app/services/unfollow_service.rb
index 151f3674f..d83a60e4e 100644
--- a/app/services/unfollow_service.rb
+++ b/app/services/unfollow_service.rb
@@ -2,6 +2,8 @@
 
 class UnfollowService < BaseService
   include Payloadable
+  include Redisable
+  include Lockable
 
   # Unfollow and notify the remote user
   # @param [Account] source_account Where to unfollow from
@@ -13,7 +15,9 @@ class UnfollowService < BaseService
     @target_account = target_account
     @options        = options
 
-    unfollow! || undo_follow_request!
+    with_lock("relationship:#{[source_account.id, target_account.id].sort.join(':')}") do
+      unfollow! || undo_follow_request!
+    end
   end
 
   private
diff --git a/app/services/vote_service.rb b/app/services/vote_service.rb
index ccd04dbfc..114ec285c 100644
--- a/app/services/vote_service.rb
+++ b/app/services/vote_service.rb
@@ -7,6 +7,8 @@ class VoteService < BaseService
   include Lockable
 
   def call(account, poll, choices)
+    return if choices.empty?
+
     authorize_with account, poll, :vote?
 
     @account = account