mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Переключение в настройках профиля/группы
This commit is contained in:
parent
13a3e0f169
commit
9aa7edb12d
12 changed files with 39 additions and 4 deletions
|
@ -389,6 +389,11 @@ class Club extends RowModel
|
|||
return (object) $res;
|
||||
}
|
||||
|
||||
function isAnonCommentsAllowed(): bool
|
||||
{
|
||||
return (bool) $this->getRecord()->allow_anon_comments;
|
||||
}
|
||||
|
||||
use Traits\TBackDrops;
|
||||
use Traits\TSubscribable;
|
||||
}
|
||||
|
|
|
@ -1127,6 +1127,11 @@ class User extends RowModel
|
|||
return $res;
|
||||
}
|
||||
|
||||
function isAnonCommentsAllowed(): bool
|
||||
{
|
||||
return (bool) $this->getRecord()->allow_anon_comments;
|
||||
}
|
||||
|
||||
use Traits\TBackDrops;
|
||||
use Traits\TSubscribable;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ final class CommentPresenter extends OpenVKPresenter
|
|||
if($_FILES["_vid_attachment"] && OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading'])
|
||||
$this->flashFail("err", tr("error"), "Video uploads are disabled by the system administrator.");
|
||||
|
||||
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"] && $this->postParam("anon") === "on";
|
||||
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"] && $this->postParam("anon") === "on" && $entity->getWallOwner()->isAnonCommentsAllowed();
|
||||
|
||||
$flags = 0;
|
||||
if($this->postParam("as_group") === "on" && !is_null($club) && $club->canBeModifiedBy($this->user->identity))
|
||||
|
|
|
@ -208,6 +208,7 @@ final class GroupPresenter extends OpenVKPresenter
|
|||
$club->setEveryone_Can_Create_Topics(empty($this->postParam("everyone_can_create_topics")) ? 0 : 1);
|
||||
$club->setDisplay_Topics_Above_Wall(empty($this->postParam("display_topics_above_wall")) ? 0 : 1);
|
||||
$club->setHide_From_Global_Feed(empty($this->postParam("hide_from_global_feed")) ? 0 : 1);
|
||||
$club->setAllow_Anon_Comments(empty($this->postParam("allow_anon_comments")) ? 0 : 1);
|
||||
|
||||
$website = $this->postParam("website") ?? "";
|
||||
if(empty($website))
|
||||
|
|
|
@ -418,6 +418,8 @@ final class UserPresenter extends OpenVKPresenter
|
|||
|
||||
if(!$user->setShortCode(empty($this->postParam("sc")) ? NULL : $this->postParam("sc")))
|
||||
$this->flashFail("err", tr("error"), tr("error_shorturl_incorrect"));
|
||||
|
||||
$user->setAllow_Anon_Comments(empty($this->postParam("allow_anon_comments")) ? 0 : 1);
|
||||
} else if($_GET['act'] === "privacy") {
|
||||
$settings = [
|
||||
"page.read",
|
||||
|
|
|
@ -101,7 +101,14 @@
|
|||
<input type="radio" name="administrators_list_display" value="2" n:attr="checked => $club->getAdministratorsListDisplay() == 2" /> {_group_dont_display_administrators_list}<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="120" valign="top" align="right">
|
||||
<input n:attr="checked => $club->isAnonCommentsAllowed()" type="checkbox" name="allow_anon_comments">
|
||||
</td>
|
||||
<td>
|
||||
{_allow_anon_comments}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
|
|
|
@ -101,6 +101,15 @@
|
|||
<input type="text" name="sc" value="{$user->getShortCode()}" style="width: 100%;" />
|
||||
</td>
|
||||
</tr>
|
||||
<br/>
|
||||
<tr>
|
||||
<td width="120" valign="top" align="right">
|
||||
<input n:attr="checked => $user->isAnonCommentsAllowed()" type="checkbox" name="allow_anon_comments">
|
||||
</td>
|
||||
<td>
|
||||
{_allow_anon_comments}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
<div n:ifset="$thisUser" id="standaloneCommentBox">
|
||||
{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}
|
||||
{var $oObj = $parent->getWallOwner()}
|
||||
{if !$readOnly}
|
||||
{include "textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), club => $club, isComment => true}
|
||||
{include "textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), club => $club, isComment => true, oObj => $oObj}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="post-has-note">
|
||||
|
||||
</div>
|
||||
{var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable']}
|
||||
{var $anonEnabled = OPENVK_ROOT_CONF['openvk']['preferences']['wall']['anonymousPosting']['enable'] && $oObj->isAnonCommentsAllowed()}
|
||||
<div n:if="$postOpts ?? true" class="post-opts">
|
||||
{if !is_null($thisUser) && !is_null($club ?? NULL) && $owner < 0}
|
||||
{if $club->canBeModifiedBy($thisUser)}
|
||||
|
|
2
install/sqls/00038-anonymous-comments-toggles.sql
Normal file
2
install/sqls/00038-anonymous-comments-toggles.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `profiles` ADD `allow_anon_comments` BOOLEAN NULL DEFAULT NULL AFTER `client_name`;
|
||||
ALTER TABLE `groups` ADD `allow_anon_comments` BOOLEAN NULL DEFAULT NULL AFTER `backdrop_2`;
|
|
@ -214,6 +214,8 @@
|
|||
|
||||
"reply" = "Reply";
|
||||
|
||||
"allow_anon_comments" = "Allow anonymous comments";
|
||||
|
||||
/* Friends */
|
||||
|
||||
"friends" = "Friends";
|
||||
|
|
|
@ -191,6 +191,7 @@
|
|||
"version_incompatibility" = "Не удалось отобразить это вложение. Возможно, база данных несовместима с текущей версией OpenVK.";
|
||||
"graffiti" = "Граффити";
|
||||
"reply" = "Ответить";
|
||||
"allow_anon_comments" = "Разрешить анонимные комментарии";
|
||||
|
||||
/* Friends */
|
||||
|
||||
|
|
Loading…
Reference in a new issue