Skip to content

Commit 63774aa

Browse files
Gargronhiyuki2578
authored andcommitted
Fix weekly usage not being displayed correctly in hashtag admin UI (mastodon#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
1 parent 0276a42 commit 63774aa

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

app/controllers/admin/tags_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def current_week_days
7171
now = Time.now.utc.beginning_of_day.to_date
7272

7373
(Date.commercial(now.cwyear, now.cweek)..now).map do |date|
74-
date.to_time.utc.beginning_of_day.to_i
74+
date.to_time(:utc).beginning_of_day.to_i
7575
end
7676
end
7777
end

app/models/trending_tags.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class TrendingTags
66
EXPIRE_TRENDS_AFTER = 1.day.seconds
77
THRESHOLD = 5
88
LIMIT = 10
9+
REVIEW_THRESHOLD = 3
910

1011
class << self
1112
include Redisable
@@ -60,7 +61,7 @@ def increment_vote!(tag, at_time)
6061
old_rank = redis.zrevrank(key, tag.id)
6162

6263
redis.zadd(key, score, tag.id)
63-
request_review!(tag) if (old_rank.nil? || old_rank > LIMIT) && redis.zrevrank(key, tag.id) <= LIMIT && !tag.trendable? && tag.requires_review? && !tag.requested_review?
64+
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?
6465
end
6566

6667
redis.expire(key, EXPIRE_TRENDS_AFTER)

app/views/admin/tags/show.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@
4141
- @usage_by_domain.each do |(domain, count)|
4242
%tr
4343
%th= domain || site_hostname
44-
%td= "#{number_with_delimiter((count.to_f / @tag.history[0][:uses].to_f) * 100)}%"
44+
%td= number_to_percentage((count / @tag.history[0][:uses].to_f) * 100)
4545
%td= number_with_delimiter count

0 commit comments

Comments
 (0)