require tampering permission to see votes

This commit is contained in:
byte[] 2020-09-08 19:03:18 -04:00
parent 4e227f1252
commit 389100dae2
2 changed files with 2 additions and 2 deletions

View file

@ -17,7 +17,7 @@ defmodule PhilomenaWeb.Image.FavoriteController do
end
defp load_votes_if_authorized(conn, _opts) do
case Canada.Can.can?(conn.assigns.current_user, :hide, conn.assigns.image) do
case Canada.Can.can?(conn.assigns.current_user, :tamper, conn.assigns.image) do
true ->
image = Repo.preload(conn.assigns.image, upvotes: :user, downvotes: :user, hides: :user)

View file

@ -8,7 +8,7 @@ defmodule PhilomenaWeb.Image.TamperController do
alias Philomena.ImageVotes
alias Philomena.Repo
plug PhilomenaWeb.CanaryMapPlug, create: :hide
plug PhilomenaWeb.CanaryMapPlug, create: :tamper
plug :load_and_authorize_resource, model: Image, id_name: "image_id", persisted: true
plug :load_resource, model: User, id_name: "user_id", persisted: true