* API Articles v0-v1 restructure * Remove unused helper * Bulk move API controllers into concerns + add V1 controllers * Extract API routes + some fixes * Fix v1 api_controller authenticate! + add more article_controller specs * Completed spec/requests/api/v1/articles_spec.rb * specs up to listings * All v1 specs except for 9 skips * mime_types cleanup + authenticate! relocation Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
21 lines
749 B
Ruby
21 lines
749 B
Ruby
json.array! @articles do |article|
|
|
json.partial! "api/v1/articles/article", article: article
|
|
|
|
# /api/articles and /api/articles/:id have opposite representations
|
|
# of `tag_list` and `tags and we can't align them without breaking the API,
|
|
# this is fully documented in the API docs
|
|
# see <https://github.com/forem/forem/issues/4206> for more details
|
|
json.tag_list article.cached_tag_list_array
|
|
json.tags article.cached_tag_list
|
|
|
|
json.partial! "api/v1/shared/user", user: article.user
|
|
|
|
if article.organization
|
|
json.partial! "api/v1/shared/organization", organization: article.organization
|
|
end
|
|
|
|
flare_tag = FlareTag.new(article).tag
|
|
if flare_tag
|
|
json.partial! "api/v1/articles/flare_tag", flare_tag: flare_tag
|
|
end
|
|
end
|