Comment déplacer tous les sujets d'une catégorie vers un nouveau tag

Hello team discourse,
Do we have command line in order to move all topics of 1 category to new tag?
Do we have command line move all topics of subcategory to parent category?

  1. Navigate to the category with the posts you’d like to change
  2. Toggle the bulk select tool (upper left hand column header)
    image
  3. Click the Select All button
    image
  4. Click the Bulk Action wrench that appears on the upper right hand side
    image
  5. Click the button in the pop-up to make the appropriate change (Set Category or Append/Replace Tags)
    image

Thank @wesochuck, i know this feauture but each my subcategory have more 1000 topics difficult to load and setup them, so i wanna setup only a comand line ssh to server. Thank everyone!

There are some other topics here with examples of rails commands to select a bunch of posts and do something to those posts. Since you don’t have an answer yet you might look for those.

I’ve been too busy to spend spare time on this one myself. If it’s worth money to you I could do this for you for $200 today or half that on Monday.

EDIT: Here’s a start:

 Topic.where(category_id: CURRENT_ID).update_all(category_id: NEW_ID)

You’ll want to take a backup before doing that!

Thank you! i moved subcategory come back parent category success.
I wanna insert and update all topics have a keyword to a tag, i know a little console but not effect, can you fix console same:

Topic.where(“quận 1 dt”).update_all(tags=“quận-1”)

rake posts:update_tag[“quận 1 dt”,“quận-1”]

I wanna do this action by consale, because my discourse have thousand topic to replace. What console to do this feature? Thank you!

Sorry so much! Im not a developer and don’t follow rails console professional, i will try study more. Thank you so much!

Hello,
I run this comand but note effect, can you help me fix this command?

Topic.where(category_id: CURRENT_ID).update_all(tags: ‘quan-1’)

I run this command but not effect

UPDATE “topics” SET “tag” = ‘quan-1’ WHERE (“topics”.“deleted_at” IS NULL) AND “topics”.“category_id” = 2752

Can we insert or update tag for topic by below console?

UPDATE topics SET tag = ‘tag_content’ WHERE topics.category_id = Category_ID_wanna

Hello Discourse,
can we assign tag for all topic have a string, and what command can do it?
example:

UPDATE topics SET tag = ‘tag_content’ WHERE topics.content= "a string"

Can be? :slight_smile:

Yes, instructions for doing that are here: Administrative Bulk Operations.

C’est super, mais cela ne déplace pas le fil de la catégorie (celui par défaut qui contient les informations à son sujet), ce que j’ai trouvé étrange, sans parler du fait que je ne trouve aucun moyen de déplacer ce sujet.

Lorsque vous créez une catégorie sur Discourse, un sujet « À propos » est automatiquement créé pour cette catégorie. Ce sujet ne peut pas être déplacé. Vous pouvez cependant copier manuellement le contenu du sujet « À propos » de la catégorie vers celui de la nouvelle catégorie.

Je comprends ce que tu dis et j’ai à peu près saisi le principe, mais ce n’est pas évident de voir pourquoi ce serait le cas. C’est un sujet qui contient du contenu qui pourrait être déplacé si je déplace tout vers une nouvelle catégorie. J’avais du contenu utile dans ces sujets et je les condense simplement parce que j’ai découvert plus tard la limitation concernant l’imbrication des catégories.

Je te donne juste ce retour pour que tu sois au courant.

Merci ! Ce sont des commentaires utiles. Aucune information n’est affichée dans l’interface utilisateur de Discourse pour vous indiquer pourquoi les sujets « À propos » ne peuvent pas être déplacés.