mirror of
https://github.com/openvk/openvk
synced 2025-01-09 17:29:42 +03:00
Anonymous comments
This commit is contained in:
parent
c77f8fdb49
commit
340920cfd3
3 changed files with 10 additions and 3 deletions
|
@ -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", "Не удалось опубликовать комментарий", "Комментарий слишком большой.");
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<div class="post-has-poll">
|
||||
{_poll}
|
||||
</div>
|
||||
{var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
|
||||
<div n:if="$postOpts ?? true" class="post-opts">
|
||||
{var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
|
||||
{if !is_null($thisUser) && !is_null($club ?? NULL) && $owner < 0}
|
||||
{if $club->canBeModifiedBy($thisUser)}
|
||||
<script>
|
||||
|
@ -46,6 +46,10 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<label n:if="$isComment && $anonEnabled" id="octoberAnonOpt">
|
||||
<input type="checkbox" name="anon" /> {_as_anonymous}
|
||||
</label>
|
||||
|
||||
<div n:if="!($postOpts ?? true) && !is_null($thisUser) && !is_null($club ?? NULL) && $club->canBeModifiedBy($thisUser)" class="post-opts">
|
||||
<label>
|
||||
<input type="checkbox" name="as_group" /> {_comment_as_group}
|
||||
|
|
Loading…
Reference in a new issue