Update topic after editing time limit has passed

AI-generated summary

The discussion revolves around creating a “Bump topic” button in Discourse. Janno_Liivak wants to allow users to bump topics after the editing time limit has passed, specifically in a category for buying and selling used items. The goal is to enable users to bump their topics every 72 hours without editing the original post.

Janno_Liivak explains that the button would help users keep their topics visible without having to post unnecessary updates. sam clarifies the requirements, and Janno_Liivak confirms that the button should bump topics without forcing users to post on them.

sam suggests creating a plugin with a custom controller to update the bumped_at timestamp and handle permissions. tobiaseigen mentions that a “Bump topic” button could be useful in certain contexts, such as internal Q&A platforms.

Janno_Liivak reveals that he already created a plugin for this purpose, which can be found on GitHub. tobiaseigen asks about the plugin’s effectiveness in Janno_Liivak’s community, and Janno_Liivak explains that it was created to accompany his buy/sell/exchange plugin and helped reduce spam in the trading category.

I would like to let users bump topic with a help of a button “Bump topic” as long as topic is not closed or archived.

I’m almost there but stumbeled upon TopicController’s update method … more specifically upon guardian.ensure_can_edit!(topic) inside the update method. It prevents user from changing their older posts.

Is my only option to go with direct SQL update of a topic or is there “standard” way to achieve this?

Wait, I am unclear, can you explain exactly what you are trying to achieve here?

Because in general I would like indeed topic to be closed for editing… in this case it’s a category where people sell their old/used stuff. In the beginning people should be able to edit their posts as we have certain rules they should follow (photos, necessary information etc). After some time it’s safe to say the post is “finished” apart the price which can go down. People are allowed to “bump” their topic with the help of a button which appears 72 hours after last “bump” (whether bu button or some other person’s post in the topic).

So there it is … what I want to achieve. I have a button. I can bump editable posts but what if something is “in the market” for 2 years? 4 years? :slight_smile:

Still not following,

  • Do you want to give end users the ability to “bump” topics and have them show up first in latest, but only once in 48 hours, without forcing them to post on the topic?

  • Are you trying to lift editing limit temporarily from a topic?

Keep in mind once there is more than one post in a topic, editing OP does not bump topic.

Yes, this is exactly what I’m trying to do.

Then I would recommend you would make a plugin with a special controller that simply updates bumped_at on the topic to Time.zone.now and handles all permissions etc in said controller.

他に「トピックを上げる」ボタンを要求した人はいますか? 私は、同僚が十分な注目を集めていないトピックを、一言の「bump」返信を追加せずに、トピックを上げることを許可したいと考えている、同社の内部Q&AプラットフォームとしてDiscourseを使用している顧客がいます。

明らかに、これはほとんどのコミュニティにとって迷惑になる可能性がありますが、オプションのプラグインまたはテーマコンポーネントとして追加できるかもしれませんか? :thinking:

私はずっと前にこのプラグインを作成しました :slight_smile:

まだ動作するかどうかはわかりませんが、試すことができます

(もう使用していない…だからわからない)

ありがとうございます。コミュニティでは、ボタンの追加はうまくいきましたか?ほとんどのサイトでは迷惑になると思いますが、回答を待っている人がトピックを意味のない「自分も」投稿で散らかしたくないQ&Aサイトでは、その利点が見えます。

これは、テーマコンポーネントとして実装できます。

これは、私の売買/交換プラグイン…トピックに上記のボタンを追加したプラグイン…と連携して作成されたもので、ユーザーが「アップ」投稿で取引カテゴリを「スパム」しないようにするためでした(ちなみに許可されていませんでした…ルールとモデレーターがありました)。したがって、何かを販売したい場合は、トピックを作成し、3日ごとにボタンの助けを借りて「アップ」することができました。