Add reactions, reliable push & session checks

Implements message reactions and reaction packs (domain models, services, admin HTTP API, media processing via ImageSharp and limits) and adds reliable push delivery (ChatPushNotification, ChatPushDispatcher, ChatPushWorker, improved ChatNotificationService). Enhances message reading (ReadChat API, unread counts, concurrency-safe receipts) and tightens session security (access-token session validation in JWT, hub filter, SessionAuthorization). Improves SignalR behavior (session groups, reaction/channel events, hub/error mappings). Adds EF migrations, many controller fixes (Forbid handling, password API), tests (Govor.Server.Tests), docs, CI and tooling updates (Dockerfile → .NET 10, GH Actions matrix for sqlite/postgres, Govor.Server.slnx, global.json), and small infra changes (AutoMapper bump, NullPushProvider, storage/token handling).
This commit is contained in:
Artemy
2026-10-03 17:42:24 +07:00
parent 4603be9f71
commit 29cc51ee0c
127 changed files with 7290 additions and 2488 deletions
+3 -1
View File
@@ -9,6 +9,8 @@ public class ChatGroup
public string Description { get; set; }
public Guid ImageId { get; set; }
public bool IsChannel { get; set; }
public Govor.Domain.Models.Reactions.ChannelReactionMode ReactionMode { get; set; }
public long ReactionPolicyVersion { get; set; }
public bool IsPrivate { get; set; }
public List<GroupAdmins> Admins { get; set; } = new();
public List<GroupMembership> Members { get; set; } = new();
@@ -26,4 +28,4 @@ public class ChatGroup
IsChannel == chatGroup.IsChannel &&
IsPrivate == chatGroup.IsPrivate;
}
}
}
+3 -2
View File
@@ -20,5 +20,6 @@ public enum MediaOwnerType
Message = 0,
Avatar = 1,
GroupAvatar = 2,
System = 3 // (Emoge, icons � e.t.c)
}
System = 3, // (Emoge, icons and other system assets)
Reaction = 4
}
@@ -0,0 +1,8 @@
namespace Govor.Domain.Models.Messages;
public class ChatPushNotification
{
public Guid MessageId { get; set; }
public DateTime NextAttemptAt { get; set; }
public int Attempts { get; set; }
}
+2 -1
View File
@@ -15,6 +15,7 @@ public class Message
public List<MessageView> MessageViews { get; set; } = new List<MessageView>();
public Guid? ReplyToMessageId { get; set; }
public long ReactionsVersion { get; set; }
public override bool Equals(object? obj)
{
@@ -36,4 +37,4 @@ public enum RecipientType
{
User,
Group
}
}
@@ -13,5 +13,6 @@ public class MessageReaction
public User User { get; set; }
public string ReactionCode { get; set; } // "❤️", "🔥", "👍", ":custom_emoji:"
public Guid? ReactionId { get; set; }
public DateTime ReactedAt { get; set; } = DateTime.UtcNow;
}
}
@@ -0,0 +1,19 @@
namespace Govor.Domain.Models.Reactions;
public static class DefaultReactionPack
{
public static readonly Guid Id = Guid.Parse("b3000000-0000-0000-0000-000000000001");
private static readonly DateTime CreatedAt = new(2026, 10, 3, 0, 0, 0, DateTimeKind.Utc);
public static ReactionPack Create() => new()
{
Id = Id, Name = "Emoji", Description = "Default public emoji reactions",
ShareCode = "default", IsDefault = true, IsEnabled = true, CreatedAt = CreatedAt
};
public static ReactionItem[] Items() => new[] { "👍", "👎", "❤️", "🔥", "🥰", "👏", "😁", "🤔", "😢", "🎉", "🤯", "🙏" }
.Select((emoji, index) => new ReactionItem
{
Id = Guid.Parse($"b3000000-0000-0000-0001-{index + 1:000000000000}"),
PackId = Id, Code = emoji, Name = emoji, Emoji = emoji,
Kind = ReactionKind.Emoji, IsEnabled = true, CreatedAt = CreatedAt
}).ToArray();
}
@@ -0,0 +1,34 @@
namespace Govor.Domain.Models.Reactions;
public enum ReactionKind { Emoji, Image, Gif }
public enum ChannelReactionMode { All, None, Selected }
public class ReactionItem
{
public Guid Id { get; set; }
public Guid PackId { get; set; }
public ReactionPack Pack { get; set; } = null!;
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public ReactionKind Kind { get; set; }
public string? Emoji { get; set; }
public Guid? MediaFileId { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public int SizeBytes { get; set; }
public int DurationMilliseconds { get; set; }
public bool IsEnabled { get; set; } = true;
public DateTime CreatedAt { get; set; }
}
public class UserReactionPack
{
public Guid UserId { get; set; }
public Guid PackId { get; set; }
}
public class ChannelAllowedReaction
{
public Guid GroupId { get; set; }
public Guid ReactionId { get; set; }
}
@@ -0,0 +1,14 @@
namespace Govor.Domain.Models.Reactions;
public class ReactionPack
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string ShareCode { get; set; } = string.Empty;
public bool IsDefault { get; set; }
public bool IsEnabled { get; set; } = true;
public Guid? CreatedByUserId { get; set; }
public DateTime CreatedAt { get; set; }
public List<ReactionItem> Reactions { get; set; } = [];
}