about summary refs log tree commit diff
path: root/app/lib/activitypub
diff options
context:
space:
mode:
authornightpool <nightpool@cybre.space>2019-06-15 11:46:08 -0400
committerchr <chr@cybre.space>2021-03-01 21:43:23 -0800
commit5792d4daf50549ed84e139b8abce4680322ac6d7 (patch)
treed6ac193126a5e3a93f59023a0579750007e66bca /app/lib/activitypub
parent4f9f95d38f997c2b139c5310e824847fe102adb5 (diff)
don't send spammy mentions
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r--app/lib/activitypub/activity.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb
index 2b5d3ffc2..85a3370ee 100644
--- a/app/lib/activitypub/activity.rb
+++ b/app/lib/activitypub/activity.rb
@@ -98,7 +98,7 @@ class ActivityPub::Activity
     crawl_links(status)
 
     notify_about_reblog(status) if reblog_of_local_account?(status) && !reblog_by_following_group_account?(status)
-    notify_about_mentions(status)
+    notify_about_mentions(status) unless spammy_mentions?(status)
 
     # Only continue if the status is supposed to have arrived in real-time.
     # Note that if @options[:override_timestamps] isn't set, the status
@@ -117,6 +117,11 @@ class ActivityPub::Activity
     status.reblog? && status.account.group? && status.reblog.account.following?(status.account)
   end
 
+  def spammy_mentions?(status)
+    status.has_non_mention_links? &&
+    @account.followers.local.count == 0
+  end
+
   def notify_about_reblog(status)
     NotifyService.new.call(status.reblog.account, :reblog, status)
   end