diff --git a/Web/Models/Entities/Comment.php b/Web/Models/Entities/Comment.php index 884fdf47..9115ad3e 100644 --- a/Web/Models/Entities/Comment.php +++ b/Web/Models/Entities/Comment.php @@ -49,6 +49,7 @@ class Comment extends Post { return $this->getOwner()->getId() == $user->getId() || $this->getTarget()->getOwner()->getId() == $user->getId() || - $this->getTarget() instanceof Post && $this->getTarget()->getTargetWall() < 0 && (new Clubs)->get(abs($this->getTarget()->getTargetWall()))->canBeModifiedBy($user); + $this->getTarget() instanceof Post && $this->getTarget()->getTargetWall() < 0 && (new Clubs)->get(abs($this->getTarget()->getTargetWall()))->canBeModifiedBy($user) || + $this->getTarget() instanceof Topic && $this->getTarget()->canBeModifiedBy($user); } } diff --git a/Web/Presenters/TopicsPresenter.php b/Web/Presenters/TopicsPresenter.php index de27fd38..5fb8eaff 100644 --- a/Web/Presenters/TopicsPresenter.php +++ b/Web/Presenters/TopicsPresenter.php @@ -160,7 +160,10 @@ final class TopicsPresenter extends OpenVKPresenter $topic->setTitle(ovk_proc_strtr($title, 127)); $topic->setClosed(empty($this->postParam("close")) ? 0 : 1); - $topic->setPinned(empty($this->postParam("pin")) ? 0 : 1); + + if($topic->getClub()->canBeModifiedBy($this->user->identity)) + $topic->setPinned(empty($this->postParam("pin")) ? 0 : 1); + $topic->save(); $this->flash("succ", tr("changes_saved"), tr("topic_changes_saved_comment")); diff --git a/Web/Presenters/templates/Topics/Edit.xml b/Web/Presenters/templates/Topics/Edit.xml index c40f28b2..0f3a7a5d 100644 --- a/Web/Presenters/templates/Topics/Edit.xml +++ b/Web/Presenters/templates/Topics/Edit.xml @@ -32,7 +32,9 @@ {_topic_settings} - {_pin_topic}
+ {if $topic->getClub()->canBeModifiedBy($thisUser)} + {_pin_topic}
+ {/if} {_close_topic} diff --git a/Web/Presenters/templates/components/comments.xml b/Web/Presenters/templates/components/comments.xml index 7cfc1be6..d0d0e84f 100644 --- a/Web/Presenters/templates/components/comments.xml +++ b/Web/Presenters/templates/components/comments.xml @@ -3,7 +3,9 @@
{var commentsURL = "/al_comments.pl/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} - {include "textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), club => $club} + {if !$readOnly} + {include "textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), club => $club} + {/if}
{if sizeof($comments) > 0}