Topic template should update when the post category is changed

Continuing the discussion from Topic Templates:

I have a forum where a single category would benefit from a topic template - the “support” category, as may be typical. This is the most used category, so it’s the default when anyone hits the “new topic” button so they get the topic template in question.

The problem is that if they change their post category, the (now irrelevant) topic template doesn’t go away (i.e. change to the blank template that is the setting for that other category). Likewise if you change to another category that does have a topic template, you are still left with the old topic template.

I get that the current behavior is “only set the template if the post was blank” to avoid stomping on user changes. That makes sense. However, it seems the better behavior may be “set the template if the post is blank or matches the template of the category I’m deselecting”?

Or possibly, have a simple “dirty” flag for the post that is initially false. When the user makes any edit (keypress) in the editor, set it to true. When changing the post category, replace the contents with the topic template if the dirty flag is false.

1 Like

I’ve fixed it so that if you don’t change the template, it will be swapped out when you change the category:

https://github.com/discourse/discourse/commit/ca8046c7c3f3d22124a1bd8d34d81ddc6c32a9e2

5 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.