Skip to content

Commit

Permalink
Show restriction reason and days remaining on announce screen
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Jul 28, 2024
1 parent a2d8ff1 commit b320ef8
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit b320ef8

Please sign in to comment.