mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:34:31 +08:00
Topic Auto-Close: admins and mods can set a topic to automatically close after a number of days
This commit is contained in:
@ -15,7 +15,8 @@ class TopicsController < ApplicationController
|
||||
:unmute,
|
||||
:set_notifications,
|
||||
:move_posts,
|
||||
:clear_pin]
|
||||
:clear_pin,
|
||||
:autoclose]
|
||||
|
||||
before_filter :consider_user_for_promotion, only: :show
|
||||
|
||||
@ -97,6 +98,16 @@ class TopicsController < ApplicationController
|
||||
toggle_mute(false)
|
||||
end
|
||||
|
||||
def autoclose
|
||||
requires_parameter(:auto_close_days)
|
||||
@topic = Topic.where(id: params[:topic_id].to_i).first
|
||||
guardian.ensure_can_moderate!(@topic)
|
||||
@topic.auto_close_days = params[:auto_close_days]
|
||||
@topic.auto_close_user = current_user
|
||||
@topic.save
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
def destroy
|
||||
topic = Topic.where(id: params[:id]).first
|
||||
guardian.ensure_can_delete!(topic)
|
||||
|
Reference in New Issue
Block a user