mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
import helper instead of calling plug directly
This commit is contained in:
parent
c776a29094
commit
9f4b8c3556
32 changed files with 54 additions and 63 deletions
|
@ -24,6 +24,7 @@ defmodule PhilomenaWeb do
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import PhilomenaWeb.Gettext
|
import PhilomenaWeb.Gettext
|
||||||
import Canary.Plugs
|
import Canary.Plugs
|
||||||
|
import PhilomenaWeb.ModerationLogPlug, only: [moderation_log: 2]
|
||||||
alias PhilomenaWeb.Router.Helpers, as: Routes
|
alias PhilomenaWeb.Router.Helpers, as: Routes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ defmodule PhilomenaWeb.Admin.ArtistLink.ContactController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Artist successfully marked as contacted.")
|
|> put_flash(:info, "Artist successfully marked as contacted.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: artist_link)
|
|> moderation_log(details: &log_details/3, data: artist_link)
|
||||||
|> redirect(to: Routes.admin_artist_link_path(conn, :index))
|
|> redirect(to: Routes.admin_artist_link_path(conn, :index))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ defmodule PhilomenaWeb.Admin.ArtistLink.RejectController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Artist link successfully marked as rejected.")
|
|> put_flash(:info, "Artist link successfully marked as rejected.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: artist_link)
|
|> moderation_log(details: &log_details/3, data: artist_link)
|
||||||
|> redirect(to: Routes.admin_artist_link_path(conn, :index))
|
|> redirect(to: Routes.admin_artist_link_path(conn, :index))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ defmodule PhilomenaWeb.Admin.ArtistLink.VerificationController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Artist link successfully verified.")
|
|> put_flash(:info, "Artist link successfully verified.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: result.artist_link)
|
|> moderation_log(details: &log_details/3, data: result.artist_link)
|
||||||
|> redirect(to: Routes.admin_artist_link_path(conn, :index))
|
|> redirect(to: Routes.admin_artist_link_path(conn, :index))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ defmodule PhilomenaWeb.Admin.Batch.TagController do
|
||||||
case Images.batch_update(image_ids, added_tags, removed_tags, attributes) do
|
case Images.batch_update(image_ids, added_tags, removed_tags, attributes) do
|
||||||
{:ok, _} ->
|
{:ok, _} ->
|
||||||
conn
|
conn
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(
|
|> moderation_log(
|
||||||
details: &log_details/3,
|
details: &log_details/3,
|
||||||
data: %{
|
data: %{
|
||||||
tag_list: tag_list,
|
tag_list: tag_list,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Admin.FingerprintBanController do
|
defmodule PhilomenaWeb.Admin.FingerprintBanController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Bans.Fingerprint, as: FingerprintBan
|
alias Philomena.Bans.Fingerprint, as: FingerprintBan
|
||||||
alias Philomena.Bans
|
alias Philomena.Bans
|
||||||
alias Philomena.Repo
|
alias Philomena.Repo
|
||||||
|
@ -48,7 +47,7 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do
|
||||||
{:ok, fingerprint_ban} ->
|
{:ok, fingerprint_ban} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Fingerprint was successfully banned.")
|
|> put_flash(:info, "Fingerprint was successfully banned.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: fingerprint_ban)
|
|> moderation_log(details: &log_details/3, data: fingerprint_ban)
|
||||||
|> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
|
||||||
|
|
||||||
{:error, changeset} ->
|
{:error, changeset} ->
|
||||||
|
@ -66,7 +65,7 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do
|
||||||
{:ok, fingerprint_ban} ->
|
{:ok, fingerprint_ban} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Fingerprint ban successfully updated.")
|
|> put_flash(:info, "Fingerprint ban successfully updated.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: fingerprint_ban)
|
|> moderation_log(details: &log_details/3, data: fingerprint_ban)
|
||||||
|> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
|
||||||
|
|
||||||
{:error, changeset} ->
|
{:error, changeset} ->
|
||||||
|
@ -79,7 +78,7 @@ defmodule PhilomenaWeb.Admin.FingerprintBanController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Fingerprint ban successfully deleted.")
|
|> put_flash(:info, "Fingerprint ban successfully deleted.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: fingerprint_ban)
|
|> moderation_log(details: &log_details/3, data: fingerprint_ban)
|
||||||
|> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_fingerprint_ban_path(conn, :index))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Admin.SubnetBanController do
|
defmodule PhilomenaWeb.Admin.SubnetBanController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Bans.Subnet, as: SubnetBan
|
alias Philomena.Bans.Subnet, as: SubnetBan
|
||||||
alias Philomena.Bans
|
alias Philomena.Bans
|
||||||
alias Philomena.Repo
|
alias Philomena.Repo
|
||||||
|
@ -50,7 +49,7 @@ defmodule PhilomenaWeb.Admin.SubnetBanController do
|
||||||
{:ok, subnet_ban} ->
|
{:ok, subnet_ban} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Subnet was successfully banned.")
|
|> put_flash(:info, "Subnet was successfully banned.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: subnet_ban)
|
|> moderation_log(details: &log_details/3, data: subnet_ban)
|
||||||
|> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
|
||||||
|
|
||||||
{:error, changeset} ->
|
{:error, changeset} ->
|
||||||
|
@ -68,7 +67,7 @@ defmodule PhilomenaWeb.Admin.SubnetBanController do
|
||||||
{:ok, subnet_ban} ->
|
{:ok, subnet_ban} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Subnet ban successfully updated.")
|
|> put_flash(:info, "Subnet ban successfully updated.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: subnet_ban)
|
|> moderation_log(details: &log_details/3, data: subnet_ban)
|
||||||
|> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
|
||||||
|
|
||||||
{:error, changeset} ->
|
{:error, changeset} ->
|
||||||
|
@ -81,7 +80,7 @@ defmodule PhilomenaWeb.Admin.SubnetBanController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Subnet ban successfully deleted.")
|
|> put_flash(:info, "Subnet ban successfully deleted.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: subnet_ban)
|
|> moderation_log(details: &log_details/3, data: subnet_ban)
|
||||||
|> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_subnet_ban_path(conn, :index))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Admin.UserBanController do
|
defmodule PhilomenaWeb.Admin.UserBanController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Bans.User, as: UserBan
|
alias Philomena.Bans.User, as: UserBan
|
||||||
alias Philomena.Bans
|
alias Philomena.Bans
|
||||||
alias Philomena.Repo
|
alias Philomena.Repo
|
||||||
|
@ -51,7 +50,7 @@ defmodule PhilomenaWeb.Admin.UserBanController do
|
||||||
{:ok, user_ban} ->
|
{:ok, user_ban} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "User was successfully banned.")
|
|> put_flash(:info, "User was successfully banned.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: user_ban)
|
|> moderation_log(details: &log_details/3, data: user_ban)
|
||||||
|> redirect(to: Routes.admin_user_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_user_ban_path(conn, :index))
|
||||||
|
|
||||||
{:error, :user_ban, changeset, _changes} ->
|
{:error, :user_ban, changeset, _changes} ->
|
||||||
|
@ -72,7 +71,7 @@ defmodule PhilomenaWeb.Admin.UserBanController do
|
||||||
{:ok, user_ban} ->
|
{:ok, user_ban} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "User ban successfully updated.")
|
|> put_flash(:info, "User ban successfully updated.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: user_ban)
|
|> moderation_log(details: &log_details/3, data: user_ban)
|
||||||
|> redirect(to: Routes.admin_user_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_user_ban_path(conn, :index))
|
||||||
|
|
||||||
{:error, changeset} ->
|
{:error, changeset} ->
|
||||||
|
@ -85,7 +84,7 @@ defmodule PhilomenaWeb.Admin.UserBanController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "User ban successfully deleted.")
|
|> put_flash(:info, "User ban successfully deleted.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: user_ban)
|
|> moderation_log(details: &log_details/3, data: user_ban)
|
||||||
|> redirect(to: Routes.admin_user_ban_path(conn, :index))
|
|> redirect(to: Routes.admin_user_ban_path(conn, :index))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ defmodule PhilomenaWeb.Admin.UserController do
|
||||||
{:ok, user} ->
|
{:ok, user} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "User successfully updated.")
|
|> put_flash(:info, "User successfully updated.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: user)
|
|> moderation_log(details: &log_details/3, data: user)
|
||||||
|> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
|
|> redirect(to: Routes.profile_path(conn, :show, conn.assigns.user))
|
||||||
|
|
||||||
{:error, %{user: changeset}} ->
|
{:error, %{user: changeset}} ->
|
||||||
|
|
|
@ -22,7 +22,7 @@ defmodule PhilomenaWeb.Image.AnonymousController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully updated anonymity.")
|
|> put_flash(:info, "Successfully updated anonymity.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ defmodule PhilomenaWeb.Image.Comment.DeleteController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Comment successfully destroyed!")
|
|> put_flash(:info, "Comment successfully destroyed!")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: comment)
|
|> moderation_log(details: &log_details/3, data: comment)
|
||||||
|> redirect(
|
|> redirect(
|
||||||
to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
|
to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Image.Comment.HideController do
|
defmodule PhilomenaWeb.Image.Comment.HideController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Comments.Comment
|
alias Philomena.Comments.Comment
|
||||||
alias Philomena.Comments
|
alias Philomena.Comments
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ defmodule PhilomenaWeb.Image.Comment.HideController do
|
||||||
{:ok, comment} ->
|
{:ok, comment} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Comment successfully hidden!")
|
|> put_flash(:info, "Comment successfully hidden!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: comment)
|
|> moderation_log(details: &log_details/3, data: comment)
|
||||||
|> redirect(
|
|> redirect(
|
||||||
to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
|
to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
|
||||||
)
|
)
|
||||||
|
@ -37,7 +36,7 @@ defmodule PhilomenaWeb.Image.Comment.HideController do
|
||||||
{:ok, comment} ->
|
{:ok, comment} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Comment successfully unhidden!")
|
|> put_flash(:info, "Comment successfully unhidden!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: comment)
|
|> moderation_log(details: &log_details/3, data: comment)
|
||||||
|> redirect(
|
|> redirect(
|
||||||
to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
|
to: Routes.image_path(conn, :show, comment.image_id) <> "#comment_#{comment.id}"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Image.CommentLockController do
|
defmodule PhilomenaWeb.Image.CommentLockController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Images.Image
|
alias Philomena.Images.Image
|
||||||
alias Philomena.Images
|
alias Philomena.Images
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ defmodule PhilomenaWeb.Image.CommentLockController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully locked comments.")
|
|> put_flash(:info, "Successfully locked comments.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,7 +21,7 @@ defmodule PhilomenaWeb.Image.CommentLockController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully unlocked comments.")
|
|> put_flash(:info, "Successfully unlocked comments.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ defmodule PhilomenaWeb.Image.DeleteController do
|
||||||
# N.B.: this would be Image.Hide, because it hides the image, but that is
|
# N.B.: this would be Image.Hide, because it hides the image, but that is
|
||||||
# taken by the user action
|
# taken by the user action
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Images.Image
|
alias Philomena.Images.Image
|
||||||
alias Philomena.Images
|
alias Philomena.Images
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
|
||||||
{:ok, result} ->
|
{:ok, result} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Image successfully hidden.")
|
|> put_flash(:info, "Image successfully hidden.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: result.image)
|
|> moderation_log(details: &log_details/3, data: result.image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
|
|
||||||
_error ->
|
_error ->
|
||||||
|
@ -37,7 +36,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
|
||||||
{:ok, image} ->
|
{:ok, image} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Hide reason updated.")
|
|> put_flash(:info, "Hide reason updated.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
@ -67,7 +66,7 @@ defmodule PhilomenaWeb.Image.DeleteController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Image successfully unhidden.")
|
|> put_flash(:info, "Image successfully unhidden.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Image.DescriptionLockController do
|
defmodule PhilomenaWeb.Image.DescriptionLockController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Images.Image
|
alias Philomena.Images.Image
|
||||||
alias Philomena.Images
|
alias Philomena.Images
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ defmodule PhilomenaWeb.Image.DescriptionLockController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully locked description.")
|
|> put_flash(:info, "Successfully locked description.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,7 +21,7 @@ defmodule PhilomenaWeb.Image.DescriptionLockController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully unlocked description.")
|
|> put_flash(:info, "Successfully unlocked description.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ defmodule PhilomenaWeb.Image.DestroyController do
|
||||||
{:ok, image} ->
|
{:ok, image} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Image contents destroyed.")
|
|> put_flash(:info, "Image contents destroyed.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
|
|
||||||
_error ->
|
_error ->
|
||||||
|
|
|
@ -16,7 +16,7 @@ defmodule PhilomenaWeb.Image.FeatureController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Image marked as featured image.")
|
|> put_flash(:info, "Image marked as featured image.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ defmodule PhilomenaWeb.Image.HashController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully cleared hash.")
|
|> put_flash(:info, "Successfully cleared hash.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ defmodule PhilomenaWeb.Image.RepairController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Repair job enqueued.")
|
|> put_flash(:info, "Repair job enqueued.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: conn.assigns.image)
|
|> moderation_log(details: &log_details/3, data: conn.assigns.image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
|
|> redirect(to: Routes.image_path(conn, :show, conn.assigns.image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ defmodule PhilomenaWeb.Image.ScratchpadController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully updated moderation notes.")
|
|> put_flash(:info, "Successfully updated moderation notes.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ defmodule PhilomenaWeb.Image.SourceHistoryController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully deleted source history.")
|
|> put_flash(:info, "Successfully deleted source history.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Image.TagLockController do
|
defmodule PhilomenaWeb.Image.TagLockController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Images.Image
|
alias Philomena.Images.Image
|
||||||
alias Philomena.Images
|
alias Philomena.Images
|
||||||
|
|
||||||
|
@ -24,7 +23,7 @@ defmodule PhilomenaWeb.Image.TagLockController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully updated list of locked tags.")
|
|> put_flash(:info, "Successfully updated list of locked tags.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,7 +32,7 @@ defmodule PhilomenaWeb.Image.TagLockController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully locked tags.")
|
|> put_flash(:info, "Successfully locked tags.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ defmodule PhilomenaWeb.Image.TagLockController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Successfully unlocked tags.")
|
|> put_flash(:info, "Successfully unlocked tags.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: image)
|
|> moderation_log(details: &log_details/3, data: image)
|
||||||
|> redirect(to: Routes.image_path(conn, :show, image))
|
|> redirect(to: Routes.image_path(conn, :show, image))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ defmodule PhilomenaWeb.Image.TamperController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Vote removed.")
|
|> put_flash(:info, "Vote removed.")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(
|
|> moderation_log(
|
||||||
details: &log_details/3,
|
details: &log_details/3,
|
||||||
data: %{vote: result, image: image}
|
data: %{vote: result, image: image}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Tag.ImageController do
|
defmodule PhilomenaWeb.Tag.ImageController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Tags.Tag
|
alias Philomena.Tags.Tag
|
||||||
alias Philomena.Tags
|
alias Philomena.Tags
|
||||||
|
|
||||||
|
@ -24,7 +23,7 @@ defmodule PhilomenaWeb.Tag.ImageController do
|
||||||
{:ok, tag} ->
|
{:ok, tag} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Tag image successfully updated.")
|
|> put_flash(:info, "Tag image successfully updated.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: tag)
|
|> moderation_log(details: &log_details/3, data: tag)
|
||||||
|> redirect(to: Routes.tag_path(conn, :show, tag))
|
|> redirect(to: Routes.tag_path(conn, :show, tag))
|
||||||
|
|
||||||
{:error, :tag, changeset, _changes} ->
|
{:error, :tag, changeset, _changes} ->
|
||||||
|
@ -37,7 +36,7 @@ defmodule PhilomenaWeb.Tag.ImageController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Tag image successfully removed.")
|
|> put_flash(:info, "Tag image successfully removed.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: tag)
|
|> moderation_log(details: &log_details/3, data: tag)
|
||||||
|> redirect(to: Routes.tag_path(conn, :show, conn.assigns.tag))
|
|> redirect(to: Routes.tag_path(conn, :show, conn.assigns.tag))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.TagController do
|
defmodule PhilomenaWeb.TagController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias PhilomenaWeb.ImageLoader
|
alias PhilomenaWeb.ImageLoader
|
||||||
alias Philomena.Elasticsearch
|
alias Philomena.Elasticsearch
|
||||||
alias Philomena.{Tags, Tags.Tag}
|
alias Philomena.{Tags, Tags.Tag}
|
||||||
|
@ -98,7 +97,7 @@ defmodule PhilomenaWeb.TagController do
|
||||||
{:ok, tag} ->
|
{:ok, tag} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Tag successfully updated.")
|
|> put_flash(:info, "Tag successfully updated.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: tag)
|
|> moderation_log(details: &log_details/3, data: tag)
|
||||||
|> redirect(to: Routes.tag_path(conn, :show, tag))
|
|> redirect(to: Routes.tag_path(conn, :show, tag))
|
||||||
|
|
||||||
{:error, changeset} ->
|
{:error, changeset} ->
|
||||||
|
@ -111,7 +110,7 @@ defmodule PhilomenaWeb.TagController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Tag queued for deletion.")
|
|> put_flash(:info, "Tag queued for deletion.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: tag)
|
|> moderation_log(details: &log_details/3, data: tag)
|
||||||
|> redirect(to: "/")
|
|> redirect(to: "/")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ defmodule PhilomenaWeb.Topic.HideController do
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Forums.Forum
|
alias Philomena.Forums.Forum
|
||||||
alias Philomena.Topics.Topic
|
alias Philomena.Topics.Topic
|
||||||
alias Philomena.Topics
|
alias Philomena.Topics
|
||||||
|
@ -28,7 +27,7 @@ defmodule PhilomenaWeb.Topic.HideController do
|
||||||
{:ok, topic} ->
|
{:ok, topic} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Topic successfully hidden!")
|
|> put_flash(:info, "Topic successfully hidden!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: topic)
|
|> moderation_log(details: &log_details/3, data: topic)
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
@ -45,7 +44,7 @@ defmodule PhilomenaWeb.Topic.HideController do
|
||||||
{:ok, topic} ->
|
{:ok, topic} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Topic successfully restored!")
|
|> put_flash(:info, "Topic successfully restored!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: topic)
|
|> moderation_log(details: &log_details/3, data: topic)
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
|
|
@ -2,7 +2,6 @@ defmodule PhilomenaWeb.Topic.LockController do
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Forums.Forum
|
alias Philomena.Forums.Forum
|
||||||
alias Philomena.Topics.Topic
|
alias Philomena.Topics.Topic
|
||||||
alias Philomena.Topics
|
alias Philomena.Topics
|
||||||
|
@ -27,7 +26,7 @@ defmodule PhilomenaWeb.Topic.LockController do
|
||||||
{:ok, topic} ->
|
{:ok, topic} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Topic successfully locked!")
|
|> put_flash(:info, "Topic successfully locked!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: topic)
|
|> moderation_log(details: &log_details/3, data: topic)
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
@ -44,7 +43,7 @@ defmodule PhilomenaWeb.Topic.LockController do
|
||||||
{:ok, topic} ->
|
{:ok, topic} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Topic successfully unlocked!")
|
|> put_flash(:info, "Topic successfully unlocked!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: topic)
|
|> moderation_log(details: &log_details/3, data: topic)
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
|
|
@ -29,7 +29,7 @@ defmodule PhilomenaWeb.Topic.MoveController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Topic successfully moved!")
|
|> put_flash(:info, "Topic successfully moved!")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: topic)
|
|> moderation_log(details: &log_details/3, data: topic)
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
|
|
@ -19,7 +19,7 @@ defmodule PhilomenaWeb.Topic.Post.DeleteController do
|
||||||
{:ok, post} ->
|
{:ok, post} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Post successfully destroyed!")
|
|> put_flash(:info, "Post successfully destroyed!")
|
||||||
|> PhilomenaWeb.ModerationLogPlug.call(details: &log_details/3, data: post)
|
|> moderation_log(details: &log_details/3, data: post)
|
||||||
|> redirect(
|
|> redirect(
|
||||||
to:
|
to:
|
||||||
Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
|
Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
defmodule PhilomenaWeb.Topic.Post.HideController do
|
defmodule PhilomenaWeb.Topic.Post.HideController do
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Posts.Post
|
alias Philomena.Posts.Post
|
||||||
alias Philomena.Posts
|
alias Philomena.Posts
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|
||||||
{:ok, post} ->
|
{:ok, post} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Post successfully hidden.")
|
|> put_flash(:info, "Post successfully hidden.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: post)
|
|> moderation_log(details: &log_details/3, data: post)
|
||||||
|> redirect(
|
|> redirect(
|
||||||
to:
|
to:
|
||||||
Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
|
Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
|
||||||
|
@ -46,7 +45,7 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|
||||||
{:ok, post} ->
|
{:ok, post} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Post successfully unhidden.")
|
|> put_flash(:info, "Post successfully unhidden.")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: post)
|
|> moderation_log(details: &log_details/3, data: post)
|
||||||
|> redirect(
|
|> redirect(
|
||||||
to:
|
to:
|
||||||
Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
|
Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <>
|
||||||
|
|
|
@ -2,7 +2,6 @@ defmodule PhilomenaWeb.Topic.StickController do
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
use PhilomenaWeb, :controller
|
use PhilomenaWeb, :controller
|
||||||
|
|
||||||
alias PhilomenaWeb.ModerationLogPlug
|
|
||||||
alias Philomena.Forums.Forum
|
alias Philomena.Forums.Forum
|
||||||
alias Philomena.Topics.Topic
|
alias Philomena.Topics.Topic
|
||||||
alias Philomena.Topics
|
alias Philomena.Topics
|
||||||
|
@ -26,7 +25,7 @@ defmodule PhilomenaWeb.Topic.StickController do
|
||||||
{:ok, topic} ->
|
{:ok, topic} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Topic successfully stickied!")
|
|> put_flash(:info, "Topic successfully stickied!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: topic)
|
|> moderation_log(details: &log_details/3, data: topic)
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
@ -43,7 +42,7 @@ defmodule PhilomenaWeb.Topic.StickController do
|
||||||
{:ok, topic} ->
|
{:ok, topic} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Topic successfully unstickied!")
|
|> put_flash(:info, "Topic successfully unstickied!")
|
||||||
|> ModerationLogPlug.call(details: &log_details/3, data: topic)
|
|> moderation_log(details: &log_details/3, data: topic)
|
||||||
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
|> redirect(to: Routes.forum_topic_path(conn, :show, topic.forum, topic))
|
||||||
|
|
||||||
{:error, _changeset} ->
|
{:error, _changeset} ->
|
||||||
|
|
|
@ -39,4 +39,8 @@ defmodule PhilomenaWeb.ModerationLogPlug do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc false
|
||||||
|
@spec moderation_log(Conn.t(), call_opts()) :: Conn.t()
|
||||||
|
def moderation_log(conn, opts), do: call(conn, opts)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue