Bulk move many topics from one category to another

AI-generated summary

Bulk Move Many Topics from One Category to Another

tobiaseigen is looking to consolidate multiple categories into one and wants to bulk move many topics without bumping them. They also want to tag topics with a category-equivalent tag before moving them.

Bulk Tag/Move Topics through the UI:

For small categories or subsets of topics, the bulk selection tool can be used.

Move All Topics from One Category to Another:

To do this, enter the site’s container and use the following rake tasks:

  1. Find category IDs: rake categories:list
  2. Move topics: rake categories:move_topics[<starting_category_id>,<destination_category_id>]

Bulk Tag All Topics Within a Category:

To convert a category to a tag, use the following rake task:

rake tags:bulk_tag_category["<tag>|<tag>",<category_id>]

This will remove existing tags. To append tags instead, add true as a third argument:

rake tags:bulk_tag_category["<tag>|<tag>",<category_id>,true]

Important: Take a backup before making major bulk changes and be aware of notification settings.

Is there a query to bulk move many topics from one category to another? I want to consolidate many categories into one category and would like to make the move quickly and all at once, and also not bump the topics.

Bonus: also want to tag topics first with a category-equivalent tag before moving them.

Grateful for any queries or recipes. Many thanks! I’d even write it up as a howto topic if it’s good. :slightly_smiling:

我已经清理了这个主题,并添加了解决 OP 中问题的当前最佳选项。如果有什么遗漏或您发现任何问题,请随时回复。

:warning: 在进行任何重大批量更改之前,请务必备份以防万一……

通过 UI 批量标记/移动主题:

对于小型类别或主题子集,批量选择工具可能就足够了(请参阅此帖子末尾关于通知的说明)。

将一个类别中的所有主题移动到另一个类别

首先进入您的站点容器:

cd /var/discourse
./launcher enter app

批量标记类别中的所有主题:

首先进入您的站点容器:

cd /var/discourse
./launcher enter app

我不能 100% 确定这些方法会触发哪种类型的通知,但如果您担心并想绝对确保不会发送通知,我建议在进行此操作时检查以下设置:

  • disable_category_edit_notifications
  • disable_tags_edit_notifications

@tshenry 你真是帮了我大忙!非常感谢!