From f847c560b1f39238421df284a91cf28aa55df59d Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 23 Dec 2019 09:25:11 -0500 Subject: [PATCH] prevent post deletion from jumping back to the first page --- .../controllers/topic/post/delete_controller.ex | 4 ++-- .../controllers/topic/post/hide_controller.ex | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/philomena_web/controllers/topic/post/delete_controller.ex b/lib/philomena_web/controllers/topic/post/delete_controller.ex index a59d726b..e28fa63c 100644 --- a/lib/philomena_web/controllers/topic/post/delete_controller.ex +++ b/lib/philomena_web/controllers/topic/post/delete_controller.ex @@ -16,12 +16,12 @@ defmodule PhilomenaWeb.Topic.Post.DeleteController do conn |> put_flash(:info, "Post successfully destroyed!") - |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic) <> "#post_#{post.id}") + |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <> "#post_#{post.id}") {:error, _changeset} -> conn |> put_flash(:error, "Unable to destroy post!") - |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic) <> "#post_#{post.id}") + |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <> "#post_#{post.id}") end end end diff --git a/lib/philomena_web/controllers/topic/post/hide_controller.ex b/lib/philomena_web/controllers/topic/post/hide_controller.ex index 3dc2c844..d2fafe54 100644 --- a/lib/philomena_web/controllers/topic/post/hide_controller.ex +++ b/lib/philomena_web/controllers/topic/post/hide_controller.ex @@ -19,12 +19,12 @@ defmodule PhilomenaWeb.Topic.Post.HideController do conn |> put_flash(:info, "Post successfully hidden!") - |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic) <> "#post_#{post.id}") + |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <> "#post_#{post.id}") {:error, _changeset} -> conn |> put_flash(:error, "Unable to hide post!") - |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic) <> "#post_#{post.id}") + |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <> "#post_#{post.id}") end end @@ -37,12 +37,12 @@ defmodule PhilomenaWeb.Topic.Post.HideController do conn |> put_flash(:info, "Post successfully unhidden!") - |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic) <> "#post_#{post.id}") + |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <> "#post_#{post.id}") {:error, _changeset} -> conn |> put_flash(:error, "Unable to unhide post!") - |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic) <> "#post_#{post.id}") + |> redirect(to: Routes.forum_topic_path(conn, :show, post.topic.forum, post.topic, post_id: post.id) <> "#post_#{post.id}") end end end