about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-08-08 23:03:28 +0200
committerGitHub <noreply@github.com>2019-08-08 23:03:28 +0200
commit898dacf83eaaec8ba02d4e44dd9901521d79a898 (patch)
treef13a666c37d53ad289ae5e4303e2f7ac2053cac9 /app/models
parent41aac1ba3a247b2178699e529239a7f3b8eb6edc (diff)
Fix weekly usage not being displayed correctly in hashtag admin UI (#11524)
Fix percentages in usage breakdown having too many digits

Change trending hashtags to only ask for review if a hashtag enters
the top 3 position in the set, since it's the only items shown in
the default web UI
Diffstat (limited to 'app/models')
-rw-r--r--app/models/trending_tags.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/trending_tags.rb b/app/models/trending_tags.rb
index 594ae9520..3d60a7fea 100644
--- a/app/models/trending_tags.rb
+++ b/app/models/trending_tags.rb
@@ -6,6 +6,7 @@ class TrendingTags
   EXPIRE_TRENDS_AFTER  = 1.day.seconds
   THRESHOLD            = 5
   LIMIT                = 10
+  REVIEW_THRESHOLD     = 3
 
   class << self
     include Redisable
@@ -60,7 +61,7 @@ class TrendingTags
         old_rank = redis.zrevrank(key, tag.id)
 
         redis.zadd(key, score, tag.id)
-        request_review!(tag) if (old_rank.nil? || old_rank > LIMIT) && redis.zrevrank(key, tag.id) <= LIMIT && !tag.trendable? && tag.requires_review? && !tag.requested_review?
+        request_review!(tag) if (old_rank.nil? || old_rank > REVIEW_THRESHOLD) && redis.zrevrank(key, tag.id) <= REVIEW_THRESHOLD && !tag.trendable? && tag.requires_review? && !tag.requested_review?
       end
 
       redis.expire(key, EXPIRE_TRENDS_AFTER)