Repo.transaction(fn ->
for user <- users do
- new_tags =
- if action == :tag do
- Enum.uniq(user.tags ++ tags)
- else
- user.tags -- tags
- end
+ new_tags = mutate_tags(user, tags, action)
{:ok, updated_user} =
user
end
end)
end
+
+ defp mutate_tags(user, tags, :tag), do: Enum.uniq(user.tags ++ tags)
+
+ defp mutate_tags(user, tags, :untag), do: user.tags -- tags
end
"default_scope" => user.info.default_scope,
"no_rich_text" => user.info.no_rich_text,
"fields" => fields,
- # Note: twitter.com does not return this field:
+ # Pleroma extension
"tags" => user.tags
}