diff --git a/Web/Presenters/CommentPresenter.php b/Web/Presenters/CommentPresenter.php index 0429b32e..0a89225f 100644 --- a/Web/Presenters/CommentPresenter.php +++ b/Web/Presenters/CommentPresenter.php @@ -48,6 +48,8 @@ final class CommentPresenter extends OpenVKPresenter else if($entity instanceof Topic) $club = $entity->getClub(); + $anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"] && $this->postParam("anon") === "on"; + $flags = 0; if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity)) $flags |= 0b10000000; @@ -89,9 +91,10 @@ final class CommentPresenter extends OpenVKPresenter $comment->setModel(get_class($entity)); $comment->setTarget($entity->getId()); $comment->setContent($this->postParam("text")); + $comment->setAnonymous($anon); $comment->setCreated(time()); $comment->setFlags($flags); - $comment->save(); + $comment->save(); } catch (\LengthException $ex) { $this->flashFail("err", "Не удалось опубликовать комментарий", "Комментарий слишком большой."); } diff --git a/Web/Presenters/templates/components/comments.xml b/Web/Presenters/templates/components/comments.xml index d84a0732..6a7f19b9 100644 --- a/Web/Presenters/templates/components/comments.xml +++ b/Web/Presenters/templates/components/comments.xml @@ -4,7 +4,7 @@ {var $commentsURL = "/al_comments/create/$model/" . $parent->getId()} {var $club = $parent instanceof \openvk\Web\Models\Entities\Post && $parent->getTargetWall() < 0 ? (new openvk\Web\Models\Repositories\Clubs)->get(abs($parent->getTargetWall())) : $club} {if !$readOnly} - {include "textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), club => $club} + {include "textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), club => $club, isComment => true} {/if} diff --git a/Web/Presenters/templates/components/textArea.xml b/Web/Presenters/templates/components/textArea.xml index daa25f4c..9160ecdf 100644 --- a/Web/Presenters/templates/components/textArea.xml +++ b/Web/Presenters/templates/components/textArea.xml @@ -14,8 +14,8 @@
{_poll}
+ {var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
- {var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']} {if !is_null($thisUser) && !is_null($club ?? NULL) && $owner < 0} {if $club->canBeModifiedBy($thisUser)}