Skip to content

Add ability to show/hide moderator status#1307

Draft
Teifion wants to merge 2 commits into
beyond-all-reason:mainfrom
Teifion:show-hide-moderator-status-command
Draft

Add ability to show/hide moderator status#1307
Teifion wants to merge 2 commits into
beyond-all-reason:mainfrom
Teifion:show-hide-moderator-status-command

Conversation

@Teifion

@Teifion Teifion commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

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 $modme and 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.

@Teifion Teifion marked this pull request as ready for review June 21, 2026 09:44
@Teifion Teifion force-pushed the show-hide-moderator-status-command branch from d66ff4d to 1063ae8 Compare June 21, 2026 14:50
tcp_pid: self(),
rank: user.rank,
moderator: Auth.moderator?(db_user) or Auth.is_event_organizer?(db_user),
show_moderator: false,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to not showing it at login

Comment on lines +26 to +31
moderator =
if true_mod_status do
client.moderator
else
Map.get(client, :show_moderator, client.moderator)
end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Teifion Teifion force-pushed the show-hide-moderator-status-command branch from 1063ae8 to b6102de Compare June 21, 2026 17:56
refute client.show_moderator

_send_raw(socket, "SAYPRIVATE coordinator $modme\n")
:timer.sleep(100)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Teifion

Teifion commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

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.

@Teifion Teifion marked this pull request as draft June 22, 2026 09:56
@steeldesade

Copy link
Copy Markdown

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants