Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show restriction reason and days remaining on announce screen #593

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Refresh.GameServer/Endpoints/Game/AnnouncementEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Refresh.GameServer.Configuration;
using Refresh.GameServer.Database;
using Refresh.GameServer.Services;
using Refresh.GameServer.Time;
using Refresh.GameServer.Types.Contests;
using Refresh.GameServer.Types.Matching;
using Refresh.GameServer.Types.Notifications;
Expand Down Expand Up @@ -75,13 +76,16 @@ private static bool AnnounceGetContest(StringBuilder output, Token token, GameDa
[GameEndpoint("announce")]
[MinimumRole(GameUserRole.Restricted)]
[SuppressMessage("ReSharper", "RedundantAssignment")]
public string Announce(RequestContext context, GameServerConfig config, GameUser user, GameDatabaseContext database, Token token)
public string Announce(RequestContext context, GameServerConfig config, GameUser user, GameDatabaseContext database, Token token, IDateTimeProvider timeProvider)
{
if (user.Role == GameUserRole.Restricted)
{
return """
return $"""
Your account is currently in restricted mode.

Reason: {user.BanReason ?? "No reason given."}
Remaining: ~{(user.BanExpiryDate! - timeProvider.Now).Value.Days} days

You can still play, but you won't be able to publish levels, post comments, or otherwise interact with the community.
For more information, please contact an administrator.
""";
Expand Down
Loading