diff --git a/Web/Presenters/InternalAPIPresenter.php b/Web/Presenters/InternalAPIPresenter.php index aa5a7ab5..464059cb 100644 --- a/Web/Presenters/InternalAPIPresenter.php +++ b/Web/Presenters/InternalAPIPresenter.php @@ -149,7 +149,7 @@ final class InternalAPIPresenter extends OpenVKPresenter { if ($_SERVER["REQUEST_METHOD"] !== "POST") { header("HTTP/1.1 405 Method Not Allowed"); - exit("ты‍ не по адресу"); + $this->redirect("/"); } $type = $this->queryParam("type", false); @@ -168,7 +168,7 @@ final class InternalAPIPresenter extends OpenVKPresenter if ($type == 'post') { $this->template->_template = 'components/post.xml'; $this->template->post = $post; - $this->template->commentSection = true; + $this->template->commentSection = $this->queryParam("from_page") == "another"; } elseif ($type == 'comment') { $this->template->_template = 'components/comment.xml'; $this->template->comment = $post; diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js index 841e5ac4..cb529d55 100644 --- a/Web/static/js/al_wall.js +++ b/Web/static/js/al_wall.js @@ -1125,7 +1125,14 @@ u(document).on("click", "#editPost", async (e) => { return } - const new_post_html = await (await fetch(`/iapi/getPostTemplate/${id[0]}_${id[1]}?type=${type}`, { + let is_at_post_page = false + try { + if(location.pathname.indexOf("wall") != -1 && location.pathname.split("_").length == 2) { + is_at_post_page = true + } + } catch(e) {} + + const new_post_html = await (await fetch(`/iapi/getPostTemplate/${id[0]}_${id[1]}?type=${type}&from_page=${is_at_post_page ? "post" : "another"}`, { 'method': 'POST' })).text() u(ev.target).removeClass('lagged')