diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php
index 3e115ec7..9d01d42e 100644
--- a/Web/Presenters/WallPresenter.php
+++ b/Web/Presenters/WallPresenter.php
@@ -17,7 +17,7 @@ final class WallPresenter extends OpenVKPresenter
function __construct(Posts $posts)
{
$this->posts = $posts;
-
+
parent::__construct();
}
@@ -207,7 +207,7 @@ final class WallPresenter extends OpenVKPresenter
];
}
- function renderMakePost(int $wall): void
+ function renderMakePost(int $wall, ?int $editTarget = 0): void
{
$this->assertUserLoggedIn();
$this->willExecuteWriteAction();
@@ -298,17 +298,28 @@ final class WallPresenter extends OpenVKPresenter
if(empty($this->postParam("text")) && !$photo && !$video && !$poll && !$note)
$this->flashFail("err", tr("failed_to_publish_post"), tr("post_is_empty_or_too_big"));
-
+
try {
- $post = new Post;
- $post->setOwner($this->user->id);
- $post->setWall($wall);
- $post->setCreated(time());
- $post->setContent($this->postParam("text"));
- $post->setAnonymous($anon);
- $post->setFlags($flags);
- $post->setNsfw($this->postParam("nsfw") === "on");
- $post->save();
+ if ($editTarget) {
+ $post = $this->posts->getPostById($this->user->id, $editTarget);
+
+ $post->setEdited(time());
+ $post->setContent($this->postParam("text"));
+ $post->setFlags($flags);
+ $post->setNsfw($this->postParam("nsfw") === "on");
+ $post->save();
+ } else {
+ $post = new Post;
+ $post->setOwner($this->user->id);
+ $post->setWall($wall);
+ $post->setCreated(time());
+ $post->setContent($this->postParam("text"));
+ $post->setAnonymous($anon);
+ $post->setFlags($flags);
+ $post->setNsfw($this->postParam("nsfw") === "on");
+ $post->save();
+ }
+
} catch (\LengthException $ex) {
$this->flashFail("err", tr("failed_to_publish_post"), tr("post_is_too_big"));
}
diff --git a/Web/Presenters/templates/Wall/Post.xml b/Web/Presenters/templates/Wall/Post.xml
index 575c7bba..c6566709 100644
--- a/Web/Presenters/templates/Wall/Post.xml
+++ b/Web/Presenters/templates/Wall/Post.xml
@@ -34,6 +34,14 @@
{/if}
{_delete}
+
+ История изменений
+
{_report}