DEV: Allow freeze_original argument in topics controller & JS transformer (#30120)

PostMover has a new option called freeze_original implemented in this commit. It was previously unexposed in the controller. This PR permits the param in the controller, and passes it into PostMover.

Also, this applies a value transformer for move/merge payload options. In addition a plugin outlet in the move post modal. This allows plugins to add content to the modal, which can modify the payload (and use the freeze_original argument for example)
This commit is contained in:
Mark VanLandingham
2024-12-05 08:31:05 -06:00
committed by GitHub
parent 555ca4da55
commit 68e57190df
7 changed files with 101 additions and 0 deletions

View File

@ -857,6 +857,7 @@ class TopicsController < ApplicationController
params.permit(:participants)
params.permit(:chronological_order)
params.permit(:archetype)
params.permit(:freeze_original)
raise Discourse::InvalidAccess if params[:archetype] == "private_message" && !guardian.is_staff?
@ -869,6 +870,7 @@ class TopicsController < ApplicationController
args = {}
args[:destination_topic_id] = destination_topic_id.to_i
args[:chronological_order] = params[:chronological_order] == "true"
args[:freeze_original] = params[:freeze_original] == "true"
if params[:archetype].present?
args[:archetype] = params[:archetype]
@ -891,6 +893,7 @@ class TopicsController < ApplicationController
params.permit(:participants)
params.permit(:chronological_order)
params.permit(:archetype)
params.permit(:freeze_original)
topic = Topic.with_deleted.find_by(id: topic_id)
guardian.ensure_can_move_posts!(topic)
@ -1399,6 +1402,7 @@ class TopicsController < ApplicationController
].present?
args[:tags] = params[:tags] if params[:tags].present?
args[:chronological_order] = params[:chronological_order] == "true"
args[:freeze_original] = true if params[:freeze_original] == "true"
if params[:archetype].present?
args[:archetype] = params[:archetype]