mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
Use report_range
method in admin/tags to generate reporting period (#35465)
This commit is contained in:
parent
d065ec9298
commit
d2ef9ac04a
|
@ -5,6 +5,7 @@ module Admin
|
|||
before_action :set_tag, except: [:index]
|
||||
|
||||
PER_PAGE = 20
|
||||
PERIOD_DAYS = 6.days
|
||||
|
||||
def index
|
||||
authorize :tag, :index?
|
||||
|
@ -15,7 +16,7 @@ module Admin
|
|||
def show
|
||||
authorize @tag, :show?
|
||||
|
||||
@time_period = (6.days.ago.to_date...Time.now.utc.to_date)
|
||||
@time_period = report_range
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -24,7 +25,7 @@ module Admin
|
|||
if @tag.update(tag_params.merge(reviewed_at: Time.now.utc))
|
||||
redirect_to admin_tag_path(@tag.id), notice: I18n.t('admin.tags.updated_msg')
|
||||
else
|
||||
@time_period = (6.days.ago.to_date...Time.now.utc.to_date)
|
||||
@time_period = report_range
|
||||
|
||||
render :show
|
||||
end
|
||||
|
@ -36,6 +37,10 @@ module Admin
|
|||
@tag = Tag.find(params[:id])
|
||||
end
|
||||
|
||||
def report_range
|
||||
(PERIOD_DAYS.ago.to_date...Time.now.utc.to_date)
|
||||
end
|
||||
|
||||
def tag_params
|
||||
params
|
||||
.expect(tag: [:name, :display_name, :trendable, :usable, :listable])
|
||||
|
|
Loading…
Reference in New Issue
Block a user