mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
prevent post deletion from jumping back to the first page
This commit is contained in:
parent
1435149d32
commit
f847c560b1
2 changed files with 6 additions and 6 deletions
|
@ -16,12 +16,12 @@ defmodule PhilomenaWeb.Topic.Post.DeleteController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Post successfully destroyed!")
|
|> 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} ->
|
{:error, _changeset} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, "Unable to destroy post!")
|
|> 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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,12 +19,12 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Post successfully hidden!")
|
|> 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} ->
|
{:error, _changeset} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, "Unable to hide post!")
|
|> 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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,12 +37,12 @@ defmodule PhilomenaWeb.Topic.Post.HideController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_flash(:info, "Post successfully unhidden!")
|
|> 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} ->
|
{:error, _changeset} ->
|
||||||
conn
|
conn
|
||||||
|> put_flash(:error, "Unable to unhide post!")
|
|> 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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue