philomena/lib/philomena_web/views/profile/user_link_view.ex

21 lines
745 B
Elixir
Raw Permalink Normal View History

2019-12-10 02:21:49 +01:00
defmodule PhilomenaWeb.Profile.UserLinkView do
2019-12-04 15:04:25 +01:00
use PhilomenaWeb, :view
def verified?(%{aasm_state: state}), do: state == "verified"
def contacted?(%{aasm_state: state}), do: state == "contacted"
def link_verified?(%{aasm_state: state}), do: state == "link_verified"
def unverified?(%{aasm_state: state}), do: state == "unverified"
def rejected?(%{aasm_state: state}), do: state == "rejected"
def public?(%{public: public}), do: !!public
def verified_as_string(%{aasm_state: "verified"}), do: "Yes"
def verified_as_string(_user_link), do: "No"
def public_as_string(%{public: true}), do: "Yes"
def public_as_string(_user_link), do: "No"
2019-12-16 21:56:13 +01:00
def tag_name(%{tag: nil}), do: nil
def tag_name(%{tag: tag}), do: tag.name
2019-12-04 15:04:25 +01:00
end