prevent post deletion from jumping back to the first page

This commit is contained in:
byte[] 2019-12-23 09:25:11 -05:00
parent 1435149d32
commit f847c560b1
2 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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