philomena/lib/philomena_web/views/source_change_view.ex

16 lines
384 B
Elixir
Raw Normal View History

2019-12-04 23:56:13 +01:00
defmodule PhilomenaWeb.SourceChangeView do
use PhilomenaWeb, :view
def staff?(source_change),
2020-01-11 05:20:19 +01:00
do:
not is_nil(source_change.user) and not Philomena.Attribution.anonymous?(source_change) and
source_change.user.role != "user"
def user_column_class(source_change) do
case staff?(source_change) do
2020-01-11 05:20:19 +01:00
true -> "success"
false -> nil
end
end
2019-12-04 23:56:13 +01:00
end