Merge branch 'main' into glitch-soc/merge-upstream
This commit is contained in:
@@ -164,8 +164,8 @@ class Admin::AccountAction
|
||||
|
||||
def reports
|
||||
@reports ||= begin
|
||||
if type == 'none' && with_report?
|
||||
[report]
|
||||
if type == 'none'
|
||||
with_report? ? [report] : []
|
||||
else
|
||||
Report.where(target_account: target_account).unresolved
|
||||
end
|
||||
|
||||
@@ -11,11 +11,11 @@ class Trends::History
|
||||
end
|
||||
|
||||
def uses
|
||||
redis.mget(*@days.map { |day| day.key_for(:uses) }).map(&:to_i).sum
|
||||
with_redis { |redis| redis.mget(*@days.map { |day| day.key_for(:uses) }).map(&:to_i).sum }
|
||||
end
|
||||
|
||||
def accounts
|
||||
redis.pfcount(*@days.map { |day| day.key_for(:accounts) })
|
||||
with_redis { |redis| redis.pfcount(*@days.map { |day| day.key_for(:accounts) }) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,19 +33,21 @@ class Trends::History
|
||||
attr_reader :day
|
||||
|
||||
def accounts
|
||||
redis.pfcount(key_for(:accounts))
|
||||
with_redis { |redis| redis.pfcount(key_for(:accounts)) }
|
||||
end
|
||||
|
||||
def uses
|
||||
redis.get(key_for(:uses))&.to_i || 0
|
||||
with_redis { |redis| redis.get(key_for(:uses))&.to_i || 0 }
|
||||
end
|
||||
|
||||
def add(account_id)
|
||||
redis.pipelined do
|
||||
redis.incrby(key_for(:uses), 1)
|
||||
redis.pfadd(key_for(:accounts), account_id)
|
||||
redis.expire(key_for(:uses), EXPIRE_AFTER)
|
||||
redis.expire(key_for(:accounts), EXPIRE_AFTER)
|
||||
with_redis do |redis|
|
||||
redis.pipelined do |pipeline|
|
||||
pipeline.incrby(key_for(:uses), 1)
|
||||
pipeline.pfadd(key_for(:accounts), account_id)
|
||||
pipeline.expire(key_for(:uses), EXPIRE_AFTER)
|
||||
pipeline.expire(key_for(:accounts), EXPIRE_AFTER)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user