mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 06:51:27 +08:00
ensures only one banner topic at all time
This commit is contained in:
@ -177,12 +177,7 @@ class TopicsController < ApplicationController
|
||||
topic = Topic.find_by(id: params[:topic_id].to_i)
|
||||
guardian.ensure_can_moderate!(topic)
|
||||
|
||||
# TODO: only one banner at the same time
|
||||
|
||||
topic.archetype = Archetype.banner
|
||||
topic.add_moderator_post(current_user, I18n.t("archetypes.banner.message.make"))
|
||||
|
||||
topic.save
|
||||
topic.make_banner!(current_user)
|
||||
|
||||
render nothing: true
|
||||
end
|
||||
@ -191,10 +186,7 @@ class TopicsController < ApplicationController
|
||||
topic = Topic.find_by(id: params[:topic_id].to_i)
|
||||
guardian.ensure_can_moderate!(topic)
|
||||
|
||||
topic.archetype = Archetype.default
|
||||
topic.add_moderator_post(current_user, I18n.t("archetypes.banner.message.remove"))
|
||||
|
||||
topic.save
|
||||
topic.remove_banner!(current_user)
|
||||
|
||||
render nothing: true
|
||||
end
|
||||
|
Reference in New Issue
Block a user