mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 14:52:46 +08:00
UX: Require a confirmation if approving a post in a closed topic
This commit is contained in:
parent
b3ec3fac93
commit
817661aed9
|
@ -13,9 +13,18 @@ class ReviewableQueuedPost < Reviewable
|
||||||
def build_actions(actions, guardian, args)
|
def build_actions(actions, guardian, args)
|
||||||
|
|
||||||
unless approved?
|
unless approved?
|
||||||
actions.add(:approve_post) do |a|
|
|
||||||
a.icon = 'check'
|
if topic&.closed?
|
||||||
a.label = "reviewables.actions.approve_post.title"
|
actions.add(:approve_post_closed) do |a|
|
||||||
|
a.icon = 'check'
|
||||||
|
a.label = "reviewables.actions.approve_post.title"
|
||||||
|
a.confirm_message = "reviewables.actions.approve_post.confirm_closed"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
actions.add(:approve_post) do |a|
|
||||||
|
a.icon = 'check'
|
||||||
|
a.label = "reviewables.actions.approve_post.title"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,6 +115,10 @@ class ReviewableQueuedPost < Reviewable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def perform_approve_post_closed(performed_by, args)
|
||||||
|
perform_approve_post(performed_by, args)
|
||||||
|
end
|
||||||
|
|
||||||
def perform_reject_post(performed_by, args)
|
def perform_reject_post(performed_by, args)
|
||||||
# Backwards compatibility, new code should listen for `reviewable_transitioned_to`
|
# Backwards compatibility, new code should listen for `reviewable_transitioned_to`
|
||||||
DiscourseEvent.trigger(:rejected_post, self)
|
DiscourseEvent.trigger(:rejected_post, self)
|
||||||
|
|
|
@ -4521,6 +4521,7 @@ en:
|
||||||
title: "Approve"
|
title: "Approve"
|
||||||
approve_post:
|
approve_post:
|
||||||
title: "Approve Post"
|
title: "Approve Post"
|
||||||
|
confirm_closed: "This topic is closed. Would you like to create the post anyway?"
|
||||||
reject_post:
|
reject_post:
|
||||||
title: "Reject Post"
|
title: "Reject Post"
|
||||||
approve_user:
|
approve_user:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user