user: add moderator_user_query()

This commit is contained in:
William Pitcock 2018-09-03 12:03:23 +00:00
parent cf5d1302aa
commit b61430163b

View file

@ -609,6 +609,14 @@ def local_user_query() do
)
end
def moderator_user_query() do
from(
u in User,
where: u.local == true,
where: fragment("?->'is_moderator' @> 'true'", u.info)
)
end
def deactivate(%User{} = user) do
new_info = Map.put(user.info, "deactivated", true)
cs = User.info_changeset(user, %{info: new_info})