BURs: don't update OP when approving BUR.
When approving or rejecting a BUR, don't edit the OP forum post to add an EDIT: line stating the request has been approved. Instead just let the embedded BUR state who it was approved by, and post a reply saying that the request has been approved.
This commit is contained in:
@@ -109,7 +109,7 @@ class DText
|
||||
end
|
||||
|
||||
if obj.is_approved?
|
||||
"The \"bulk update request ##{obj.id}\":/bulk_update_requests/#{obj.id} is active.\n\n#{embedded_script}"
|
||||
"The \"bulk update request ##{obj.id}\":/bulk_update_requests/#{obj.id} has been approved by <@#{obj.approver.pretty_name}>.\n\n#{embedded_script}"
|
||||
elsif obj.is_pending?
|
||||
"The \"bulk update request ##{obj.id}\":/bulk_update_requests/#{obj.id} is pending approval.\n\n#{embedded_script}"
|
||||
elsif obj.is_rejected?
|
||||
|
||||
@@ -1,28 +1,13 @@
|
||||
class ForumUpdater
|
||||
attr_reader :forum_topic, :forum_post
|
||||
attr_reader :forum_topic
|
||||
|
||||
def initialize(forum_topic, options = {})
|
||||
def initialize(forum_topic)
|
||||
@forum_topic = forum_topic
|
||||
@forum_post = options[:forum_post]
|
||||
end
|
||||
|
||||
def update(message)
|
||||
return if forum_topic.nil?
|
||||
|
||||
CurrentUser.scoped(User.system) do
|
||||
create_response(message)
|
||||
|
||||
if forum_post
|
||||
update_post(message)
|
||||
end
|
||||
forum_topic.forum_posts.create(body: message, skip_mention_notifications: true, creator: User.system)
|
||||
end
|
||||
end
|
||||
|
||||
def create_response(body)
|
||||
forum_topic.forum_posts.create(body: body, skip_mention_notifications: true, creator: User.system)
|
||||
end
|
||||
|
||||
def update_post(body)
|
||||
forum_post.update(body: "#{forum_post.body}\n\nEDIT: #{body}", skip_mention_notifications: true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,14 +60,7 @@ class BulkUpdateRequest < ApplicationRecord
|
||||
|
||||
module ApprovalMethods
|
||||
def forum_updater
|
||||
@forum_updater ||= begin
|
||||
post = if forum_topic
|
||||
forum_post || forum_topic.forum_posts.first
|
||||
else
|
||||
nil
|
||||
end
|
||||
ForumUpdater.new(forum_topic, forum_post: post)
|
||||
end
|
||||
@forum_updater ||= ForumUpdater.new(forum_topic)
|
||||
end
|
||||
|
||||
def approve!(approver)
|
||||
|
||||
Reference in New Issue
Block a user