mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Hide Queue staff link if user can't approve images (#200)
This commit is contained in:
parent
cf013cd0c3
commit
217621a9e1
2 changed files with 10 additions and 6 deletions
|
@ -210,11 +210,15 @@ defmodule Philomena.Images do
|
||||||
|
|
||||||
defp maybe_suggest_user_verification(_user), do: false
|
defp maybe_suggest_user_verification(_user), do: false
|
||||||
|
|
||||||
def count_pending_approvals() do
|
def count_pending_approvals(user) do
|
||||||
|
if Canada.Can.can?(user, :approve, %Image{}) do
|
||||||
Image
|
Image
|
||||||
|> where(hidden_from_users: false)
|
|> where(hidden_from_users: false)
|
||||||
|> where(approved: false)
|
|> where(approved: false)
|
||||||
|> Repo.aggregate(:count)
|
|> Repo.aggregate(:count)
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def feature_image(featurer, %Image{} = image) do
|
def feature_image(featurer, %Image{} = image) do
|
||||||
|
|
|
@ -32,7 +32,7 @@ defmodule PhilomenaWeb.AdminCountersPlug do
|
||||||
defp maybe_assign_admin_metrics(conn, _user, false), do: conn
|
defp maybe_assign_admin_metrics(conn, _user, false), do: conn
|
||||||
|
|
||||||
defp maybe_assign_admin_metrics(conn, user, true) do
|
defp maybe_assign_admin_metrics(conn, user, true) do
|
||||||
pending_approvals = Images.count_pending_approvals()
|
pending_approvals = Images.count_pending_approvals(user)
|
||||||
duplicate_reports = DuplicateReports.count_duplicate_reports(user)
|
duplicate_reports = DuplicateReports.count_duplicate_reports(user)
|
||||||
reports = Reports.count_reports(user)
|
reports = Reports.count_reports(user)
|
||||||
artist_links = ArtistLinks.count_artist_links(user)
|
artist_links = ArtistLinks.count_artist_links(user)
|
||||||
|
|
Loading…
Reference in a new issue