In API dont fetch liked from all comments

This commit is contained in:
Thorsten Claus 2022-08-30 21:35:13 +02:00 committed by Benjamin Neff
parent 67f8ba5d57
commit c2a2fb63b0
No known key found for this signature in database
GPG key ID: 971464C3F1A90194

View file

@ -21,7 +21,14 @@ class CommentPresenter < BasePresenter
created_at: created_at,
mentioned_people: build_mentioned_people_json,
reported: current_user.present? && reports.exists?(user: current_user),
interactions: build_interactions_json
interactions: build_interaction_state
}
end
def build_interaction_state
{
liked: current_user.present? && likes.where(author: current_user.person).exists?,
likes_count: likes_count
}
end