1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-27 22:18:52 +00:00

Avoid a lot of database requests

This commit is contained in:
Pierre HUBERT 2020-04-02 10:59:00 +02:00
parent 25f25815f5
commit 969c644aad

View File

@ -163,7 +163,7 @@ export class CommentsController {
// Check if we have to load like information
if(!assumeNoLike) {
data.likes = await LikesHelper.Count(c.id, LikesType.COMMENT);
data.userlike = h.signedIn ? await LikesHelper.IsLiking(h.getUserId(), c.id, LikesType.COMMENT) : false;
data.userlike = data.likes > 0 && h.signedIn ? await LikesHelper.IsLiking(h.getUserId(), c.id, LikesType.COMMENT) : false;
}
return data;