* Revert "(Temporarily) Remove multiple reactions from #index (#19142)" This reverts commita45d300639. * Clean up reaction category count mechanism for #index * Remove, unnecessary * Expose reaction categories in JSON response * Update test with new categories * Fix flaky sample / minimum floor * buildArticle (infinite scroll) with multiple reactions * If we're doing #index front-end, we aren't feature-flag'd * nbsp * react (home feed) has multiple_reactions * Update app/assets/javascripts/utilities/buildArticleHTML.js Co-authored-by: Rajat Talesra <rajat@forem.com> * Clean up Reactable#reaction_categories * Use 'multiple_reactions_icons_container' * Try adding a ReactionCount test * Adapt memory fix from76dd53d* Try adding categories to fixture * Attempt to eager-load distinct public categories * Setting dependent to the default for rubocop * Try making image assets more public? * Revert "Fix flaky sample / minimum floor" --------- Co-authored-by: Rajat Talesra <rajat@forem.com> Co-authored-by: Mac Siri <mac@forem.com>
38 lines
1.2 KiB
Ruby
38 lines
1.2 KiB
Ruby
article_attributes_to_include = %i[
|
|
title path id user_id comments_count public_reactions_count organization_id
|
|
reading_time video_thumbnail_url video video_duration_in_minutes
|
|
experience_level_rating experience_level_rating_distribution
|
|
]
|
|
article_methods_to_include = %i[
|
|
readable_publish_date flare_tag class_name
|
|
cloudinary_video_url video_duration_in_minutes published_at_int
|
|
published_timestamp main_image_background_hex_color
|
|
public_reaction_categories
|
|
]
|
|
|
|
json.array!(@stories) do |article|
|
|
json.extract! article, *article_attributes_to_include
|
|
json.user article.cached_user.as_json
|
|
|
|
if article.cached_organization?
|
|
json.organization article.cached_organization.as_json
|
|
end
|
|
|
|
json.pinned article.pinned?
|
|
|
|
if article.main_image?
|
|
json.main_image cloud_cover_url(article.main_image)
|
|
else
|
|
json.main_image nil
|
|
end
|
|
|
|
json.tag_list article.cached_tag_list_array
|
|
json.extract! article, *article_methods_to_include
|
|
|
|
json.top_comments article.top_comments do |comment|
|
|
comment = comment.decorate
|
|
json.comment_id comment.id
|
|
json.extract! comment, :user_id, :published_timestamp, :published_at_int, :safe_processed_html, :path
|
|
json.extract! comment.user, :username, :name, :profile_image_90
|
|
end
|
|
end
|