aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pleroma/tag.ex8
-rw-r--r--test/pleroma/tag_test.exs24
2 files changed, 0 insertions, 32 deletions
diff --git a/lib/pleroma/tag.ex b/lib/pleroma/tag.ex
index 40a41e519..f8cd88653 100644
--- a/lib/pleroma/tag.ex
+++ b/lib/pleroma/tag.ex
@@ -27,14 +27,6 @@ defmodule Pleroma.Tag do
timestamps()
end
- @spec upsert(String.t()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
- def upsert(name) do
- %__MODULE__{}
- |> Ecto.Changeset.change(name: normalize_tag(name))
- |> Ecto.Changeset.unique_constraint(:name)
- |> Repo.insert(on_conflict: :nothing, conflict_target: :name)
- end
-
@spec upsert_tags(list(String.t())) :: {integer(), nil | [term()]}
def upsert_tags(names) do
date = NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
diff --git a/test/pleroma/tag_test.exs b/test/pleroma/tag_test.exs
index 97b64db86..1b21cba72 100644
--- a/test/pleroma/tag_test.exs
+++ b/test/pleroma/tag_test.exs
@@ -9,30 +9,6 @@ defmodule Pleroma.TagTest do
alias Pleroma.Tag
- describe "upsert/1" do
- test "create new normalize tag" do
- Tag.upsert(" verify \n")
-
- assert [tag] = Pleroma.Repo.all(Tag)
- assert tag.name == "verify"
- end
-
- test "create new tag" do
- Tag.upsert("verify")
-
- assert [tag] = Pleroma.Repo.all(Tag)
- assert tag.name == "verify"
- end
-
- test "do nothing when tag exists" do
- insert(:tag, name: "verify")
- Tag.upsert("verify")
-
- assert [tag] = Pleroma.Repo.all(Tag)
- assert tag.name == "verify"
- end
- end
-
describe "upsert_tags/1" do
test "create new normalize tags" do
Tag.upsert_tags([" verify \n", "bot", "unconfirmed "])