Update topic after editing time limit has passed

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.

Кто-нибудь ещё просил кнопку Поднять тему? У меня есть клиент, использующий Discourse как внутреннюю платформу для вопросов и ответов в своей компании, и он хочет разрешить коллегам поднимать темы, которые не получают достаточного внимания, без добавления односложного ответа «поднять».

Очевидно, что для большинства сообществ это может быть раздражающим, но, возможно, это можно добавить в качестве опционального плагина или компонента темы? :thinking:

Я уже создал этот плагин очень давно :slight_smile:

Не знаю, работает ли он до сих пор, но вы можете попробовать его.

(Я больше его не использую… поэтому и не знаю)

Спасибо! Как в целом сработало добавление кнопки в вашем сообществе? Думаю, для большинства сайтов это было бы раздражающим, но я вижу пользу для сайта вопросов и ответов, где люди ждут ответа, но не хотят захламлять тему бессмысленными сообщениями «я тоже».

Это можно реализовать прямо сейчас как компонент темы.

Это было создано специально для моего плагина покупки/продажи/обмена… Плагин добавлял соответствующие кнопки к темам, чтобы пользователи не «спамили» категорию торговли сообщениями «вверх» (что, кстати, не разрешалось… у нас были правила и модераторы). Так что, когда вы хотели что-то продать, вы создавали свою тему, и каждые 3 дня могли сделать «ап» с помощью кнопки.