mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
disallow tag self-aliasing
This commit is contained in:
parent
7f55c63303
commit
485d8be3b3
1 changed files with 45 additions and 41 deletions
|
@ -179,6 +179,9 @@ defmodule Philomena.Tags do
|
|||
def alias_tag(%Tag{} = tag, attrs) do
|
||||
target_tag = Repo.get_by!(Tag, name: attrs["target_tag"])
|
||||
|
||||
if(tag.id == target_tag.id) do
|
||||
tag
|
||||
else
|
||||
filters_hidden =
|
||||
where(Filter, [f], fragment("? @> ARRAY[?]::integer[]", f.hidden_tag_ids, ^tag.id))
|
||||
|
||||
|
@ -230,6 +233,7 @@ defmodule Philomena.Tags do
|
|||
reindex_tag_images(target_tag)
|
||||
reindex_tags([tag, target_tag])
|
||||
end
|
||||
end
|
||||
|
||||
def reindex_tag_images(%Tag{} = tag) do
|
||||
# First recount the tag
|
||||
|
|
Loading…
Reference in a new issue