From b320ef89099ace8e13c8894de915f4e90da9e8f7 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 28 Jul 2024 02:53:00 -0400 Subject: [PATCH] Show restriction reason and days remaining on announce screen --- .../Endpoints/Game/AnnouncementEndpoints.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Refresh.GameServer/Endpoints/Game/AnnouncementEndpoints.cs b/Refresh.GameServer/Endpoints/Game/AnnouncementEndpoints.cs index 338565cf..95fc163b 100644 --- a/Refresh.GameServer/Endpoints/Game/AnnouncementEndpoints.cs +++ b/Refresh.GameServer/Endpoints/Game/AnnouncementEndpoints.cs @@ -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; @@ -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. """;