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?
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?
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.
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.
Quelqu’un a-t-il déjà demandé un bouton « Remonter le sujet » ? J’ai un client qui utilise Discourse comme plateforme interne de questions-réponses pour son entreprise et qui souhaite permettre à ses collègues de remonter les sujets qui n’attirent pas assez l’attention, sans ajouter de réponse d’un seul mot « remonter ».
Évidemment, cela pourrait être ennuyeux pour la plupart des communautés, mais peut-être pourrait-il être ajouté en tant que plugin optionnel ou composant de thème ?
Merci ! Comment l’ajout du bouton a-t-il fonctionné pour vous, dans votre communauté ? Je pense que pour la plupart des sites, ce serait ennuyeux, mais je vois l’avantage pour un site de questions-réponses où les gens attendent une réponse mais ne veulent pas encombrer le sujet avec des messages « moi aussi » dénués de sens.
Cela pourrait être implémenté maintenant en tant que composant de thème.
Ceci a en fait été créé pour accompagner mon plugin d’achat/vente/échange… plugin qui ajoutait lesdits boutons aux sujets et afin que les utilisateurs ne “spam” pas la catégorie d’échange avec des posts “up” (qui n’étaient d’ailleurs pas autorisés… nous avions des règles et des modérateurs). Donc, lorsque vous vouliez vendre quelque chose, vous créiez votre sujet, et tous les 3 jours, vous pouviez “up” avec l’aide d’un bouton.