Reduced amount of chats, commented out the pending report.

This commit is contained in:
cake
2025-12-16 07:06:17 +01:00
parent c731b265ff
commit 143037165a

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