🐛 Fixes for sticker & sticker packs

This commit is contained in:
2025-05-11 22:13:13 +08:00
parent eab775e224
commit 3d5d4db3e3
8 changed files with 93 additions and 34 deletions

View File

@ -230,6 +230,8 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
.FirstOrDefaultAsync();
if (post is null) return NotFound();
var isSelfReact = post.Publisher.AccountId is not null && post.Publisher.AccountId == currentUser.Id;
var isExistingReaction = await db.PostReactions
.AnyAsync(r => r.PostId == post.Id &&
r.Symbol == request.Symbol &&
@ -241,7 +243,7 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
PostId = post.Id,
AccountId = currentUser.Id
};
var isRemoving = await ps.ModifyPostVotes(post, reaction, isExistingReaction);
var isRemoving = await ps.ModifyPostVotes(post, reaction, isExistingReaction, isSelfReact);
if (isRemoving) return NoContent();
return Ok(reaction);