Linked topics (splitting and managing megatopics)

I’ve just merged a feature which creates a new linked topic automatically when a topic is auto-closed based on auto close topics post count site setting.

This feature is especially useful for automatically splitting and managing megatopics.

Here’s how it works

Let’s say auto close topics post count setting is set to 10000 posts and a topic (with title “Introduce yourself!”) just reached that limit.

Now we’ll close that topic and create a new linked topic to continue the discussion. The first post of new topic will link to all prior discussions (topics).

The original topic title will be appended with “Part 1” and the new topic title with be appended with “Part 2”.

The subsequent topics will follow similar title naming convention.

There will also be a moderator post at the bottom of auto-closed topic indicating that there is a new topic available to continue discussion.

This feature is enabled by default. To disable the feature simply disable the site setting auto close topics create linked topic.

Note that this feature will be disabled if auto close topics post count is disabled (set to 0).

33 Likes

That’s awesome!

Is that something that could be used as solution to the “babble 10,000 messages issue”?

4 Likes

I have a small suggestion regarding these lines of code (and whatever else I missed):

previous_topics += "- [#{topic.title}](#{topic.url})\n"
parent_topic.add_moderator_post(system_user, I18n.t('create_linked_topic.moderator_post_raw', new_title: "[#{new_topic_title}](#{new_topic.url})"))

I’d recommend replacing [title](url) with just url, and relying on existing Discourse functionality that displays the title of the topic from the URL. If I’m not mistaken, this would have the bonus of auto-updating the topic title displayed if the topic is renamed, which I think would be a nice touch.

6 Likes

Yes, that’s a good idea @techAPJ we should probably do that.

Also, can we make it so there’s a single message rather than two? Why not have the “continue discussion” part be edited into the close message? Like:

This topic was automatically closed after reaching the maximum limit of 10000 replies. Continue this discussion at {link}

9 Likes

Done via:

Sure, done via:

11 Likes

This won’t work as well when you’re continuing the discussion from an access-restricted topic into another category without the exact same access restrictions.

1 Like

Is that a likely use case? It seems like generally the continuing topic would stay in the same category as the original topic. If this situation does happen, you say it won’t work as well, but what specifically would the behavior be?

4 Likes

Even without the linking issue, I’d expect the continuing topic to have inherited the exact same access restrictions. I’d see it as a bug if it didn’t.

4 Likes

Good point - it’s probably fine, then!

3 Likes

Hi, very nice feature, but two issues:

  1. How do we change the “Part” (1, 2 and so on) text? In English based forums is probably fine, but we would like to be able to change it.
  2. The category of the new topic. We’ve just got our first automatically linked topic and it was “uncategorized”. What we would like is the new topic to assume the category of the previously automatically closed topic.
4 Likes

Yes those are good points but the last time I checked the category was inherited properly, is that so @techAPJ?

3 Likes

You’ll need to update translation for these keys. See: Contribute a translation to Discourse

That is a valid bug. I’ll fix this on priority today.

I believe that might have been a manual update. I don’t see code for assigning category to linked topic.

6 Likes

Fixed via:

9 Likes

I’m also highly interested in this question.

1 Like

@elijah did you wish to continue your conversation here? This is a more correct place to have it, IMO.

3 Likes

@elijah apparently you want the topic notification status (watching, tracking, muted, etc) for every single user in the old topic, to be copied across to the new topic, yes?

I see the rationale, but my worry is that could be a bit invasive for some of the users … long topics can involve hundreds or thousands of people. Anyone else have thoughts about this, pros and cons?

4 Likes

Yeah, let me repeat my suggestions here, for context.

On megatopics I was proposing either of two ways to make splitting more seamless for the less-than-regular user.

Method Watchlist Copy: when splitting a topic, copy over muted / tracking / watching status for the new topic. (And if the last topic only had copied, not set originally there: unset the the tracking status for the now closed one.) Rational: If the user hasn’t been around to read the topic for a while, but is generally interested in it, help them catchup by not highlighting the unread posts in the old topic, only the new.

Method Top Split: when splitting a topic, facilitate having posts 2 to N moved post 1 copied to a new topic (closed on creation), and replace those moved posts with a linked topic message. Rational: mucking with watch settings is messy. This allows archiving old content without breaking external links (bookmark, RSS, baked into an app, etc) or internal watch settings.

I like the top split method better, but either seems a way to help users out who are interested in very long (or long term but split) topics.

3 Likes

I’m using WP and Discourse to do audio education and group reflection, and was thinking how helpful it might be if when the WP plugin creates a new topic on Discourse, an event triggers to create a linked topic as the reflection topic for that main topic. That way, it’d allow me to maintain the original topic as read-only, so people don’t see the reflections before they listen to the audio, and have the linked topic be where they go to reflect.

Similar to this:

Am I correct in assuming it may just take slightly tweaking this code here to make it happen in a new plugin?

      if SiteSetting.auto_close_topics_create_linked_topic?
        # enqueue a job to create a linked topic
        Jobs.enqueue_in(5.seconds, :create_linked_topic, post_id: @post.id)
      end

Also, I’m curious if there are enough applications for automatically creating a linked topic where it’d make sense to have it as part of Discourse Automation?

1 Like