From 6a8a0ed49133ffe5d14b9e1e540392221650921c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 8 Oct 2025 02:46:56 +0800 Subject: [PATCH] :necktie: Limit custom reactions --- DysonNetwork.Sphere/Post/PostController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DysonNetwork.Sphere/Post/PostController.cs b/DysonNetwork.Sphere/Post/PostController.cs index 2d9ce23..60a851a 100644 --- a/DysonNetwork.Sphere/Post/PostController.cs +++ b/DysonNetwork.Sphere/Post/PostController.cs @@ -522,6 +522,9 @@ public class PostController( public PostReactionAttitude Attitude { get; set; } } + public static readonly List ReactionsAllowedDefault = + ["thumb_up", "thumb_down", "just_okay", "cry", "confuse", "clap", "laugh", "angry", "party", "pray", "heart"]; + [HttpPost("{id:guid}/reactions")] [Authorize] [RequiredPermission("global", "posts.react")] @@ -535,6 +538,10 @@ public class PostController( var userFriends = friendsResponse.AccountsId.Select(Guid.Parse).ToList(); var userPublishers = await pub.GetUserPublishers(Guid.Parse(currentUser.Id)); + if (!ReactionsAllowedDefault.Contains(request.Symbol)) + if (currentUser.PerkSubscription is null) + return BadRequest("You need subscription to send custom reactions"); + var post = await db.Posts .Where(e => e.Id == id) .Include(e => e.Publisher)