correctly count user links

This commit is contained in:
byte[] 2019-12-09 20:29:44 -05:00
parent 0d1ae1e436
commit 2c1725f20a

View file

@ -149,7 +149,7 @@ defmodule Philomena.UserLinks do
def count_user_links(user) do
if Canada.Can.can?(user, :index, UserLink) do
UserLink
|> where(aasm_state: "unverified")
|> where([ul], ul.aasm_state in ^["unverified", "link_verified", "contacted"])
|> Repo.aggregate(:count, :id)
else
nil