From 59498f8d2aeba3c1011610f3c904671deedee7e4 Mon Sep 17 00:00:00 2001 From: Luna D Date: Thu, 24 Mar 2022 19:19:50 +0100 Subject: [PATCH] report for approval on edit as well --- lib/philomena_web/controllers/image/comment_controller.ex | 4 ++++ lib/philomena_web/controllers/topic/post_controller.ex | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/philomena_web/controllers/image/comment_controller.ex b/lib/philomena_web/controllers/image/comment_controller.ex index 485a94fa..1c97ad1f 100644 --- a/lib/philomena_web/controllers/image/comment_controller.ex +++ b/lib/philomena_web/controllers/image/comment_controller.ex @@ -112,6 +112,10 @@ defmodule PhilomenaWeb.Image.CommentController do def update(conn, %{"comment" => comment_params}) do case Comments.update_comment(conn.assigns.comment, conn.assigns.current_user, comment_params) do {:ok, %{comment: comment}} -> + if not comment.approved do + Comments.report_non_approved(comment) + end + PhilomenaWeb.Endpoint.broadcast!( "firehose", "comment:update", diff --git a/lib/philomena_web/controllers/topic/post_controller.ex b/lib/philomena_web/controllers/topic/post_controller.ex index 98d62698..342ceddd 100644 --- a/lib/philomena_web/controllers/topic/post_controller.ex +++ b/lib/philomena_web/controllers/topic/post_controller.ex @@ -79,7 +79,11 @@ defmodule PhilomenaWeb.Topic.PostController do user = conn.assigns.current_user case Posts.update_post(post, user, post_params) do - {:ok, _post} -> + {:ok, post} -> + if not post.approved do + Posts.report_non_approved(post) + end + conn |> put_flash(:info, "Post successfully edited.") |> redirect(