🐛 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

@ -174,7 +174,7 @@ public class PostService(AppDatabase db, FileService fs, ActivityService act)
/// <param name="post">Post that modifying</param>
/// <param name="reaction">The new / target reaction adding / removing</param>
/// <param name="isRemoving">Indicate this operation is adding / removing</param>
public async Task<bool> ModifyPostVotes(Post post, PostReaction reaction, bool isRemoving)
public async Task<bool> ModifyPostVotes(Post post, PostReaction reaction, bool isRemoving, bool isSelfReact)
{
var isExistingReaction = await db.Set<PostReaction>()
.AnyAsync(r => r.PostId == post.Id && r.AccountId == reaction.AccountId);
@ -193,6 +193,12 @@ public class PostService(AppDatabase db, FileService fs, ActivityService act)
return isRemoving;
}
if (isSelfReact)
{
await db.SaveChangesAsync();
return isRemoving;
}
switch (reaction.Attitude)
{
case PostReactionAttitude.Positive: