def get_tags(entry) do
:xmerl_xpath.string('//category', entry)
- |> Enum.map(fn (category) -> string_from_xpath("/category/@term", category) |> String.downcase end)
+ |> Enum.map(fn (category) -> string_from_xpath("/category/@term", category) end)
+ |> Enum.filter(&(&1))
+ |> Enum.map(&String.downcase/1)
end
def maybe_update(doc, user) do
Repo.insert(cs, on_conflict: :replace_all, conflict_target: :nickname)
end
- def make_user(uri) do
+ def make_user(uri, update \\ false) do
with {:ok, info} <- gather_user_info(uri) do
data = %{
name: info["name"],
avatar: info["avatar"],
bio: info["bio"]
}
- with %User{} = user <- User.get_by_ap_id(data.ap_id) do
+ with false <- update,
+ %User{} = user <- User.get_by_ap_id(data.ap_id) do
{:ok, user}
else _e -> insert_or_update_user(data)
end