about summary refs log tree commit diff
path: root/app/lib/activitypub/activity
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-09-19 00:22:39 +0200
committerGitHub <noreply@github.com>2019-09-19 00:22:39 +0200
commitfebcdad2e2c98aee62b55ee21bdf0debf7c6fd6b (patch)
tree1a99988dd7a46824527e59ee1861aa72ad7412ce /app/lib/activitypub/activity
parentab646fac5f582fe9bef22d8b9a4995fbb4b42d7d (diff)
parent2ecc7106d7fc222ca84777fc279e9f46f80afd5a (diff)
Merge pull request #1221 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/lib/activitypub/activity')
-rw-r--r--app/lib/activitypub/activity/create.rb10
-rw-r--r--app/lib/activitypub/activity/move.rb11
2 files changed, 10 insertions, 11 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index dea7fd43c..e69193b71 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -408,15 +408,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
   end
 
   def check_for_spam
-    spam_check = SpamCheck.new(@status)
-
-    return if spam_check.skip?
-
-    if spam_check.spam?
-      spam_check.flag!
-    else
-      spam_check.remember!
-    end
+    SpamCheck.perform(@status)
   end
 
   def forward_for_reply
diff --git a/app/lib/activitypub/activity/move.rb b/app/lib/activitypub/activity/move.rb
index d7a5f595c..6c6a2b967 100644
--- a/app/lib/activitypub/activity/move.rb
+++ b/app/lib/activitypub/activity/move.rb
@@ -10,10 +10,13 @@ class ActivityPub::Activity::Move < ActivityPub::Activity
 
     target_account = ActivityPub::FetchRemoteAccountService.new.call(target_uri)
 
-    return if target_account.nil? || !target_account.also_known_as.include?(origin_account.uri)
+    if target_account.nil? || target_account.suspended? || !target_account.also_known_as.include?(origin_account.uri)
+      unmark_as_processing!
+      return
+    end
 
     # In case for some reason we didn't have a redirect for the profile already, set it
-    origin_account.update(moved_to_account: target_account) if origin_account.moved_to_account_id.nil?
+    origin_account.update(moved_to_account: target_account)
 
     # Initiate a re-follow for each follower
     origin_account.followers.local.select(:id).find_in_batches do |follower_accounts|
@@ -40,4 +43,8 @@ class ActivityPub::Activity::Move < ActivityPub::Activity
   def mark_as_processing!
     redis.setex("move_in_progress:#{@account.id}", PROCESSING_COOLDOWN, true)
   end
+
+  def unmark_as_processing!
+    redis.del("move_in_progress:#{@account.id}")
+  end
 end