公式警告を取り消す

:bookmark: This guide explains how to remove an official warning in Discourse via the console, particularly aimed at self-hosting users.

:person_raising_hand: Required user level: System Administrator
:desktop_computer: 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:

  1. 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
      
  2. Remove the latest warning:
    If the warning you want to delete is the most recent one, execute:

    UserWarning.last.destroy
    
  3. 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.

Last edited by @SaraDev 2024-11-13T00:51:26Z

Check documentPerform check on document:
「いいね!」 20

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.

Assuming you followed the standard installation guide, you would SSH into the server and run:

cd /var/discourse/
./launcher enter app
rails console
「いいね!」 3

@JammyDodger さん。もしかしたら、「コンソール」や「rails」(あるいは「rails console」)を次のリンクに結びつける魔法のリンクが必要かもしれません。

「いいね!」 2

うーん。それはいい考えですね。:thinking: でも、以前にこれで痛い目にあったことがあります。:slight_smile:

あなたがそう言ったので、今後は注意して、どれくらいの頻度で出てくるか見てみますね。:+1:


ちょうど今、ドキュメントを見直しているので、この場合はガイドに完全な手順を追加するのが良いかもしれません。

「いいね!」 3

あるいは、「Railsでできること」というセクションにして、Aboutやその他のもので十分かもしれません。

管理者がいつでも管理できるように、これらをペナルティとして扱い、すべての公式警告のログを記録する方がはるかに簡単ではありませんか?モデレーターが誤って似た名前のユーザーに警告し、その後、サイトのメンテナーに連絡して問題を解決してもらう必要がある場合、非常に困難になります。

「いいね!」 1

ここに Feature request があると思います。

「いいね!」 2

API経由でも、Railsコンソールだけでなく、これを行う方法はありますか?