Automatically bumping old topics on a category

Per:

https://github.com/discourse/discourse/commit/5adf5b527de97a1cc30c5eb699dd45dd6d247595

And:

https://github.com/discourse/discourse-solved/commit/5b81cc92934f6cf4ca4a71fde206bd3e66c39452

This now integrates with Discourse solved and will not bump solved topics.

@eviltrout / @tgxworld not sure if you ever needed to do this before, but this seems like the best pattern for composable filters I can come up with without adding a proper filter interface (or leaning on the only used in one plugin, filter interface I added years back)

  on(:filter_auto_bump_topics) do |_category, filters|
    filters.push(->(r) { r.where(<<~SQL)
        NOT EXISTS(
          SELECT 1 FROM topic_custom_fields
          WHERE topic_id = topics.id
          AND name = 'accepted_answer_post_id'
        )
      SQL
    })
  end
14 Likes