This guide explains how to remove an official warning in Discourse via the console, particularly aimed at self-hosting users.
Required user level: System Administrator Console access required
In certain situations, a warning issued to a user may need to be retracted. This action involves removing the warning through the console, which is accessible for those with server access. If you are a hosted customer, please contact the Discourse team (team@discourse.org) for assistance with this process.
Understanding user warnings
Official warnings are stored in the user_warnings table within the Discourse database. If you need to undo a warning, it means deleting the corresponding entry from this table.
Removing an official warning
To remove a warning, follow these steps:
Access the server console:
Use SSH to connect to your Discourse server.
Enter the console with the following commands:
cd /var/discourse/
./launcher enter app
rails console
Remove the latest warning:
If the warning you want to delete is the most recent one, execute:
UserWarning.last.destroy
Find and remove a specific warning:
If the warning wasn’t the last one, search for the specific warning using the user_id:
UserWarning.where(user_id: the_user_id)
This will return an array of warnings related to the user. Once you find the correct id, remove it using:
UserWarning.find(3).destroy
Destroying the warning will not remove the private message (PM) sent; the PM will merely cease being marked as a warning.
Is there any chance you could share the steps that I’d need to take to log in to the Console? I’ve tried Googling this but every guide seems to assume that the user will know how to do that.
Hmm. C’est une idée. J’ai déjà eu de mauvaises expériences avec ça.
Je vais garder un œil dessus maintenant que vous l’avez dit et voir à quelle fréquence cela se présente.
Nous sommes en train de parcourir la documentation en ce moment, donc peut-être que dans ce cas, il serait bon d’ajouter les instructions complètes dans le guide.
Ne serait-il pas beaucoup plus simple de les gérer comme des pénalités et d’avoir un journal de tous les avertissements officiels envoyés pour que les administrateurs et les modérateurs puissent les gérer à tout moment ? Il est très difficile pour un modérateur d’avertir accidentellement un utilisateur portant un nom similaire, puis de devoir contacter le mainteneur du site pour qu’il résolve le problème.