Discussions: Some fixes

This commit is contained in:
Maxim Leshchenko 2021-12-15 19:00:26 +02:00
parent 3ed37e34a4
commit cd91d4e310
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
4 changed files with 12 additions and 4 deletions

View file

@ -49,6 +49,7 @@ class Comment extends Post
{ {
return $this->getOwner()->getId() == $user->getId() || return $this->getOwner()->getId() == $user->getId() ||
$this->getTarget()->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);
} }
} }

View file

@ -160,7 +160,10 @@ final class TopicsPresenter extends OpenVKPresenter
$topic->setTitle(ovk_proc_strtr($title, 127)); $topic->setTitle(ovk_proc_strtr($title, 127));
$topic->setClosed(empty($this->postParam("close")) ? 0 : 1); $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(); $topic->save();
$this->flash("succ", tr("changes_saved"), tr("topic_changes_saved_comment")); $this->flash("succ", tr("changes_saved"), tr("topic_changes_saved_comment"));

View file

@ -32,7 +32,9 @@
<span class="nobold">{_topic_settings}</span> <span class="nobold">{_topic_settings}</span>
</td> </td>
<td> <td>
<input type="checkbox" name="pin" n:attr="checked => $topic->isPinned()" /> {_pin_topic}<br /> {if $topic->getClub()->canBeModifiedBy($thisUser)}
<input type="checkbox" name="pin" n:attr="checked => $topic->isPinned()" /> {_pin_topic}<br />
{/if}
<input type="checkbox" name="close" n:attr="checked => $topic->isClosed()" /> {_close_topic} <input type="checkbox" name="close" n:attr="checked => $topic->isClosed()" /> {_close_topic}
</td> </td>
</tr> </tr>

View file

@ -3,7 +3,9 @@
<div n:ifset="$thisUser"> <div n:ifset="$thisUser">
{var commentsURL = "/al_comments.pl/create/$model/" . $parent->getId()} {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} {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}
</div> </div>
{if sizeof($comments) > 0} {if sizeof($comments) > 0}