use the alias cache

This commit is contained in:
byte[] 2019-11-16 00:09:02 -05:00
parent dcc3b418c8
commit 3b18428215
2 changed files with 4 additions and 3 deletions

View file

@ -63,9 +63,9 @@ defmodule Philomena.Images.Image do
field :hides_count, :integer, default: 0
# todo: can probably remove these now
# field :tag_list_cache, :string
# field :tag_list_plus_alias_cache, :string
# field :file_name_cache, :string
field :tag_list_cache, :string
field :tag_list_plus_alias_cache, :string
field :file_name_cache, :string
timestamps(inserted_at: :created_at)
end

View file

@ -48,6 +48,7 @@ defmodule PhilomenaWeb.ImageView do
[
image_id: image.id,
image_tags: Jason.encode!(Enum.map(image.tags, & &1.id)),
image_tag_aliases: image.tag_list_plus_alias_cache,
score: image.score,
faves: image.faves_count,
upvotes: image.upvotes_count,