mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FEATURE: Create revision when bulk moving topics (#10802)
This behavior can be configured with the new "create_revision_on_bulk_topic_moves" site setting. It's enabled by default.
This commit is contained in:
@ -86,9 +86,26 @@ class TopicsBulkAction
|
||||
end
|
||||
|
||||
def change_category
|
||||
topics.each do |t|
|
||||
if guardian.can_edit?(t)
|
||||
@changed_ids << t.id if t.change_category_to_id(@operation[:category_id])
|
||||
updatable_topics = topics.where.not(category_id: @operation[:category_id])
|
||||
|
||||
if SiteSetting.create_revision_on_bulk_topic_moves
|
||||
opts = {
|
||||
bypass_bump: true,
|
||||
validate_post: false,
|
||||
bypass_rate_limiter: true
|
||||
}
|
||||
|
||||
updatable_topics.each do |t|
|
||||
if guardian.can_edit?(t)
|
||||
changes = { category_id: @operation[:category_id] }
|
||||
@changed_ids << t.id if t.first_post.revise(@user, changes, opts)
|
||||
end
|
||||
end
|
||||
else
|
||||
updatable_topics.each do |t|
|
||||
if guardian.can_edit?(t)
|
||||
@changed_ids << t.id if t.change_category_to_id(@operation[:category_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user