FEATURE: add full editing access to queued posts (#5047)

For pending new topics: the body of the post, title, categories
and the tags are editable.

For pending new replies: only the body is applicable and thus
editable

DISCUSSION: https://meta.discourse.org/t/66754
This commit is contained in:
Kyle Zhao
2017-08-15 12:44:05 -04:00
committed by Sam
parent 1146772deb
commit c3249f6e93
6 changed files with 196 additions and 16 deletions

View File

@ -20,10 +20,17 @@ class QueuedPostsController < ApplicationController
def update
qp = QueuedPost.where(id: params[:id]).first
if params[:queued_post][:raw].present?
qp.update_column(:raw, params[:queued_post][:raw])
update_params = params[:queued_post]
qp.raw = update_params[:raw] if update_params[:raw].present?
unless qp.topic_id
qp.post_options['title'] = update_params[:title] if update_params[:title].present?
qp.post_options['category'] = update_params[:category_id].to_i if update_params[:category_id].present?
qp.post_options['tags'] = update_params[:tags] if update_params[:tags].present?
end
qp.save(validate: false)
state = params[:queued_post][:state]
begin
if state == 'approved'