Merge pull request 'Reduced content length of message, commented out the pending report.' (#37) from chat-changes into master

Reviewed-on: #37
Reviewed-by: defnotken <defnotken@noreply.git.lightless-sync.org>
This commit was merged in pull request #37.
This commit is contained in:
2025-12-16 12:00:08 +00:00
2 changed files with 5 additions and 9 deletions

View File

@@ -1,13 +1,9 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using LightlessSync.API.Data.Enum;
using LightlessSync.API.Dto.Chat;
using LightlessSync.API.Dto.User;
using LightlessSyncServer.Models;
using LightlessSyncServer.Services;
using LightlessSyncServer.Utils;
using LightlessSyncShared.Models;
using Microsoft.AspNetCore.Authorization;
@@ -18,7 +14,7 @@ namespace LightlessSyncServer.Hubs;
public partial class LightlessHub
{
private const int MaxChatMessageLength = 400;
private const int MaxChatMessageLength = 200;
private const int ChatRateLimitMessages = 7;
private static readonly TimeSpan ChatRateLimitWindow = TimeSpan.FromMinutes(1);
private static readonly ConcurrentDictionary<string, ChatRateLimitState> ChatRateLimiters = new(StringComparer.Ordinal);
@@ -67,7 +63,7 @@ public partial class LightlessHub
descriptor,
displayName,
g.GID,
g.OwnerUID == userUid);
string.Equals(g.OwnerUID, userUid, StringComparison.Ordinal));
})
.OrderBy(info => info.DisplayName, StringComparer.OrdinalIgnoreCase)
.ToList();
@@ -406,7 +402,7 @@ public partial class LightlessHub
return;
}
if (!string.IsNullOrEmpty(messageEntry.SenderUserUid))
/* if (!string.IsNullOrEmpty(messageEntry.SenderUserUid))
{
var targetAlreadyPending = await DbContext.ReportedChatMessages
.AsNoTracking()
@@ -418,7 +414,7 @@ public partial class LightlessHub
await Clients.Caller.Client_ReceiveServerMessage(MessageSeverity.Information, "This user already has a report pending review.").ConfigureAwait(false);
return;
}
}
} */
var snapshotEntries = _chatChannelService.GetRecentMessages(messageEntry.Channel, 25);
var snapshotItems = snapshotEntries

View File

@@ -162,7 +162,7 @@ internal class DiscordBot : IHostedService
try
{
await Task.Delay(TimeSpan.FromMinutes(10), token).ConfigureAwait(false);
await Task.Delay(TimeSpan.FromMinutes(1), token).ConfigureAwait(false);
}
catch (OperationCanceledException)
{