Add ability to show/hide moderator status#1307
Conversation
d66ff4d to
1063ae8
Compare
| tcp_pid: self(), | ||
| rank: user.rank, | ||
| moderator: Auth.moderator?(db_user) or Auth.is_event_organizer?(db_user), | ||
| show_moderator: false, |
There was a problem hiding this comment.
Default to not showing it at login
| moderator = | ||
| if true_mod_status do | ||
| client.moderator | ||
| else | ||
| Map.get(client, :show_moderator, client.moderator) | ||
| end |
There was a problem hiding this comment.
This is the part controlling what is shown to other clients., If true_mod_status is true we will always show the moderation status of the client. If not we will get the show_moderator value with a fallback to their true status.
1063ae8 to
b6102de
Compare
| refute client.show_moderator | ||
|
|
||
| _send_raw(socket, "SAYPRIVATE coordinator $modme\n") | ||
| :timer.sleep(100) |
There was a problem hiding this comment.
the sleeps aren't ideal, there are a few helper function under Teiserver.Support.Polling that you should use instead, it'll help reduce the duration of tests.
There was a problem hiding this comment.
Since you are testing at the socket level, shouldn't you check you receive the correct status message through a socket instead of reaching for the internals?
None of these test really make sure other clients will see the correct status for the client you are modifying.
|
Based on the way the tests are going this feature is not working, I'll pause work on it for now and may drop it entirely. If anybody wants to take over the PR (or replace it entirely) I would fully support that. |
|
The more I think about this, the more I like the idea. I would probably play more if it were not so obvious I was a moderator (who is not great at the game). |
With this change, when a user with moderator powers logs in they will by default not show to other users as a moderator. They can enable showing as a moderator with
$modmeand hide it again with$unmodme.This is a visual change only, SPADS and others bots will see the correct moderator status as will all server auth checks.