mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-25 23:09:22 +00:00
Avoid a lot of database requests
This commit is contained in:
parent
25f25815f5
commit
969c644aad
@ -163,7 +163,7 @@ export class CommentsController {
|
|||||||
// Check if we have to load like information
|
// Check if we have to load like information
|
||||||
if(!assumeNoLike) {
|
if(!assumeNoLike) {
|
||||||
data.likes = await LikesHelper.Count(c.id, LikesType.COMMENT);
|
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;
|
return data;
|
||||||
|
Loading…
Reference in New Issue
Block a user