]> cat aescling's git repositories - mastodon.git/commitdiff
Exclude unlisted, private and direct toots from affecting trends (#7686)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 31 May 2018 14:47:28 +0000 (16:47 +0200)
committerGitHub <noreply@github.com>
Thu, 31 May 2018 14:47:28 +0000 (16:47 +0200)
app/lib/activitypub/activity/create.rb
app/services/process_hashtags_service.rb

index 869749f1ec4749c311b32dcd15ab8c05d3846937..00479fd9a5ddff1b5f8e587c3fee858aa09b34cc 100644 (file)
@@ -83,7 +83,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
     return if status.tags.include?(hashtag)
 
     status.tags << hashtag
-    TrendingTags.record_use!(hashtag, status.account, status.created_at)
+    TrendingTags.record_use!(hashtag, status.account, status.created_at) if status.public_visibility?
   rescue ActiveRecord::RecordInvalid
     nil
   end
index 0695922b86ed35580a4fd8c17f7c40be1ccf1100..cf7471c9893ebd39a82cf00658f01b1ff3439f3b 100644 (file)
@@ -7,7 +7,7 @@ class ProcessHashtagsService < BaseService
     tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).each do |name|
       tag = Tag.where(name: name).first_or_create(name: name)
       status.tags << tag
-      TrendingTags.record_use!(tag, status.account, status.created_at)
+      TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility?
     end
   end
 end