mirror of
https://github.com/openvk/openvk
synced 2025-06-06 14:37:00 +03:00
feat(admin): ability to hide user's posts from global feed (#1291)
This commit is contained in:
parent
246dd4ab91
commit
14a07450d3
7 changed files with 14 additions and 1 deletions
|
@ -1487,6 +1487,11 @@ class User extends RowModel
|
|||
return $this->isClosed();
|
||||
}
|
||||
|
||||
public function HideGlobalFeed(): bool
|
||||
{
|
||||
return (bool) $this->getRecord()->hide_global_feed;
|
||||
}
|
||||
|
||||
public function getRealId()
|
||||
{
|
||||
return $this->getId();
|
||||
|
|
|
@ -119,6 +119,7 @@ final class AdminPresenter extends OpenVKPresenter
|
|||
$user->setLast_Name($this->postParam("last_name"));
|
||||
$user->setPseudo($this->postParam("nickname"));
|
||||
$user->setStatus($this->postParam("status"));
|
||||
$user->setHide_Global_Feed(empty($this->postParam("hide_global_feed") ? 0 : 1));
|
||||
if (!$user->setShortCode(empty($this->postParam("shortcode")) ? null : $this->postParam("shortcode"))) {
|
||||
$this->flash("err", tr("error"), tr("error_shorturl_incorrect"));
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ final class WallPresenter extends OpenVKPresenter
|
|||
$pPage = min((int) ($_GET["posts"] ?? OPENVK_DEFAULT_PER_PAGE), 50);
|
||||
|
||||
$queryBase = "FROM `posts` LEFT JOIN `groups` ON GREATEST(`posts`.`wall`, 0) = 0 AND `groups`.`id` = ABS(`posts`.`wall`) LEFT JOIN `profiles` ON LEAST(`posts`.`wall`, 0) = 0 AND `profiles`.`id` = ABS(`posts`.`wall`)";
|
||||
$queryBase .= "WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND (`profiles`.`profile_type` = 0 OR `profiles`.`first_name` IS NULL) AND `posts`.`deleted` = 0 AND `posts`.`suggested` = 0";
|
||||
$queryBase .= "WHERE (`groups`.`hide_from_global_feed` = 0 OR `groups`.`name` IS NULL) AND ((`profiles`.`profile_type` = 0 AND `profiles`.`hide_global_feed` = 0) OR `profiles`.`first_name` IS NULL) AND `posts`.`deleted` = 0 AND `posts`.`suggested` = 0";
|
||||
|
||||
if ($this->user->identity->getNsfwTolerance() === User::NSFW_INTOLERANT) {
|
||||
$queryBase .= " AND `nsfw` = 0";
|
||||
|
|
|
@ -60,6 +60,10 @@
|
|||
<label for="city">{_admin_verification}</label>
|
||||
<input class="toggle-large" type="checkbox" id="verify" name="verify" value="1" {if $user->isVerified()} checked {/if} />
|
||||
</div>
|
||||
<div class="field-group">
|
||||
<label for="city">{_admin_hide_global_feed}</label>
|
||||
<input class="toggle-large" type="checkbox" id="hide_global_feed" name="hide_global_feed" value="1" n:attr="checked => $user->HideGlobalFeed()" />
|
||||
</div>
|
||||
<div class="field-group">
|
||||
<label for="city">{_admin_user_online}</label>
|
||||
<select name="online" class="select">
|
||||
|
|
1
install/sqls/00056-hide-from-global-feed-user.sql
Normal file
1
install/sqls/00056-hide-from-global-feed-user.sql
Normal file
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `profiles` ADD COLUMN `hide_global_feed` boolean DEFAULT 0 NOT NULL AFTER `deleted`;
|
|
@ -1679,6 +1679,7 @@
|
|||
"admin_first_known_ip" = "First known IP";
|
||||
"admin_shortcode" = "Short code";
|
||||
"admin_verification" = "Verification";
|
||||
"admin_hide_global_feed" = "Hide global feed";
|
||||
"admin_banreason" = "Ban reason";
|
||||
"admin_banned" = "banned";
|
||||
"admin_gender" = "Sex";
|
||||
|
|
|
@ -1582,6 +1582,7 @@
|
|||
"admin_first_known_ip" = "Первый IP";
|
||||
"admin_shortcode" = "Короткий адрес";
|
||||
"admin_verification" = "Верификация";
|
||||
"admin_hide_global_feed" = "Не отображать в глобальной ленте";
|
||||
"admin_banreason" = "Причина блокировки";
|
||||
"admin_banned" = "заблокирован";
|
||||
"admin_actions" = "Действия";
|
||||
|
|
Loading…
Reference in a new issue