Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

DefaultLikeManager getLikes vs countLikes

Thomas Hondema
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 22, 2016

Whats the difference between the DefaultLikeManagers getLikes and the countLikes?

To my understanding the countLikes function should return the size of the list returned by the getLikes function but the following code produces different results.

int likeListCount = likeManager.getLikes(contentItem).size(); // 0
int likeCount = likeManager.countLikes(contentItem); // 2

The documentation is not really clear about this but it suggests it should be the same.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 22, 2016

My expectation is that they should return the same. Only guess (although it's not stated in the docs) is that the countLikes iterates through child objects. Also to bu sure try to re-index the content.

Thomas Hondema
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 22, 2016

Thank you for the tip about reindexing, sadly this does not fix the issue.

The object I'm testing on is a page with 2 likes and no comments so it should not matter if it is iterative.

TAGS
AUG Leaders

Atlassian Community Events