mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-17 11:04:22 +01:00
add tag_count to supported clientside fields (fixes philomena-dev/philomena#78)
This commit is contained in:
parent
d8f04fe922
commit
aaf04544b6
2 changed files with 4 additions and 1 deletions
|
@ -20,7 +20,7 @@ const tokenList = [
|
||||||
],
|
],
|
||||||
numberFields = ['id', 'width', 'height', 'aspect_ratio',
|
numberFields = ['id', 'width', 'height', 'aspect_ratio',
|
||||||
'comment_count', 'score', 'upvotes', 'downvotes',
|
'comment_count', 'score', 'upvotes', 'downvotes',
|
||||||
'faves'],
|
'faves', 'tag_count'],
|
||||||
dateFields = ['created_at'],
|
dateFields = ['created_at'],
|
||||||
literalFields = ['tags', 'orig_sha512_hash', 'sha512_hash',
|
literalFields = ['tags', 'orig_sha512_hash', 'sha512_hash',
|
||||||
'score', 'uploader', 'source_url', 'description'],
|
'score', 'uploader', 'source_url', 'description'],
|
||||||
|
@ -37,6 +37,7 @@ const tokenList = [
|
||||||
height: 'data-height',
|
height: 'data-height',
|
||||||
aspect_ratio: 'data-aspect-ratio',
|
aspect_ratio: 'data-aspect-ratio',
|
||||||
comment_count: 'data-comment-count',
|
comment_count: 'data-comment-count',
|
||||||
|
tag_count: 'data-tag-count',
|
||||||
source_url: 'data-source-url',
|
source_url: 'data-source-url',
|
||||||
faves: 'data-faves',
|
faves: 'data-faves',
|
||||||
sha512_hash: 'data-sha512',
|
sha512_hash: 'data-sha512',
|
||||||
|
|
|
@ -128,6 +128,7 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
image_id: image.id,
|
image_id: image.id,
|
||||||
image_tags: Jason.encode!(Enum.map(image.tags, & &1.id)),
|
image_tags: Jason.encode!(Enum.map(image.tags, & &1.id)),
|
||||||
image_tag_aliases: image.tag_list_plus_alias_cache,
|
image_tag_aliases: image.tag_list_plus_alias_cache,
|
||||||
|
tag_count: length(image.tags),
|
||||||
score: image.score,
|
score: image.score,
|
||||||
faves: image.faves_count,
|
faves: image.faves_count,
|
||||||
upvotes: image.upvotes_count,
|
upvotes: image.upvotes_count,
|
||||||
|
@ -220,6 +221,7 @@ defmodule PhilomenaWeb.ImageView do
|
||||||
%{
|
%{
|
||||||
id: image.id,
|
id: image.id,
|
||||||
"namespaced_tags.name": String.split(image.tag_list_plus_alias_cache || "", ", "),
|
"namespaced_tags.name": String.split(image.tag_list_plus_alias_cache || "", ", "),
|
||||||
|
tag_count: length(image.tags),
|
||||||
score: image.score,
|
score: image.score,
|
||||||
faves: image.faves_count,
|
faves: image.faves_count,
|
||||||
upvotes: image.upvotes_count,
|
upvotes: image.upvotes_count,
|
||||||
|
|
Loading…
Reference in a new issue