report for approval on edit as well

This commit is contained in:
Luna D 2022-03-24 19:19:50 +01:00
parent dce3ccb430
commit 59498f8d2a
No known key found for this signature in database
GPG key ID: 4B1C63448394F688
2 changed files with 9 additions and 1 deletions

View file

@ -112,6 +112,10 @@ defmodule PhilomenaWeb.Image.CommentController do
def update(conn, %{"comment" => comment_params}) do def update(conn, %{"comment" => comment_params}) do
case Comments.update_comment(conn.assigns.comment, conn.assigns.current_user, comment_params) do case Comments.update_comment(conn.assigns.comment, conn.assigns.current_user, comment_params) do
{:ok, %{comment: comment}} -> {:ok, %{comment: comment}} ->
if not comment.approved do
Comments.report_non_approved(comment)
end
PhilomenaWeb.Endpoint.broadcast!( PhilomenaWeb.Endpoint.broadcast!(
"firehose", "firehose",
"comment:update", "comment:update",

View file

@ -79,7 +79,11 @@ defmodule PhilomenaWeb.Topic.PostController do
user = conn.assigns.current_user user = conn.assigns.current_user
case Posts.update_post(post, user, post_params) do 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 conn
|> put_flash(:info, "Post successfully edited.") |> put_flash(:info, "Post successfully edited.")
|> redirect( |> redirect(