🐛 Fixes bugs
This commit is contained in:
parent
7e7c8fe556
commit
2206676214
@ -97,7 +97,7 @@ public class AccountController(
|
|||||||
},
|
},
|
||||||
expiredAt: SystemClock.Instance.GetCurrentInstant().Plus(Duration.FromDays(7))
|
expiredAt: SystemClock.Instance.GetCurrentInstant().Plus(Duration.FromDays(7))
|
||||||
);
|
);
|
||||||
spells.NotifyMagicSpell(spell);
|
await spells.NotifyMagicSpell(spell, true);
|
||||||
|
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
@ -37,11 +37,12 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
|
|||||||
.Take(take)
|
.Take(take)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
posts = PostService.TruncatePostContent(posts);
|
posts = PostService.TruncatePostContent(posts);
|
||||||
|
|
||||||
var postsId = posts.Select(e => e.Id).ToList();
|
var postsId = posts.Select(e => e.Id).ToList();
|
||||||
var reactionMaps = await ps.GetPostReactionMapBatch(postsId);
|
var reactionMaps = await ps.GetPostReactionMapBatch(postsId);
|
||||||
foreach (var post in posts)
|
foreach (var post in posts)
|
||||||
post.ReactionsCount = reactionMaps[post.Id];
|
post.ReactionsCount =
|
||||||
|
reactionMaps.TryGetValue(post.Id, out var count) ? count : new Dictionary<string, int>();
|
||||||
|
|
||||||
Response.Headers["X-Total"] = totalCount.ToString();
|
Response.Headers["X-Total"] = totalCount.ToString();
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
|
|||||||
.Take(take)
|
.Take(take)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
posts = PostService.TruncatePostContent(posts);
|
posts = PostService.TruncatePostContent(posts);
|
||||||
|
|
||||||
var postsId = posts.Select(e => e.Id).ToList();
|
var postsId = posts.Select(e => e.Id).ToList();
|
||||||
var reactionMaps = await ps.GetPostReactionMapBatch(postsId);
|
var reactionMaps = await ps.GetPostReactionMapBatch(postsId);
|
||||||
foreach (var post in posts)
|
foreach (var post in posts)
|
||||||
@ -241,7 +242,7 @@ public class PostController(AppDatabase db, PostService ps, RelationshipService
|
|||||||
AccountId = currentUser.Id
|
AccountId = currentUser.Id
|
||||||
};
|
};
|
||||||
await ps.ModifyPostVotes(post, reaction, isExistingReaction);
|
await ps.ModifyPostVotes(post, reaction, isExistingReaction);
|
||||||
|
|
||||||
if (isExistingReaction) return NoContent();
|
if (isExistingReaction) return NoContent();
|
||||||
return Ok(reaction);
|
return Ok(reaction);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user