mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
propagate aliases to non-image tag list entries
This commit is contained in:
parent
76a1cf8b3a
commit
c7cd7f3af3
1 changed files with 2 additions and 1 deletions
|
@ -32,12 +32,13 @@ defmodule Philomena.Schema.TagList do
|
||||||
Tag
|
Tag
|
||||||
|> where([t], t.name in ^tag_list)
|
|> where([t], t.name in ^tag_list)
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
|> Map.new(fn t -> {t.name, t.id} end)
|
|> Map.new(fn t -> {t.name, t.aliased_tag_id || t.id} end)
|
||||||
|
|
||||||
tag_ids =
|
tag_ids =
|
||||||
tag_list
|
tag_list
|
||||||
|> Enum.map(&lookup[&1])
|
|> Enum.map(&lookup[&1])
|
||||||
|> Enum.reject(&is_nil/1)
|
|> Enum.reject(&is_nil/1)
|
||||||
|
|> Enum.uniq()
|
||||||
|
|
||||||
changeset
|
changeset
|
||||||
|> put_change(target_field, tag_ids)
|
|> put_change(target_field, tag_ids)
|
||||||
|
|
Loading…
Reference in a new issue