diff --git a/VKAPI/Handlers/Newsfeed.php b/VKAPI/Handlers/Newsfeed.php
index d9992430..3c6d2210 100644
--- a/VKAPI/Handlers/Newsfeed.php
+++ b/VKAPI/Handlers/Newsfeed.php
@@ -1,9 +1,9 @@
getUser()->getNsfwTolerance() === User::NSFW_INTOLERANT)
$queryBase .= " AND `nsfw` = 0";
+
+ if(($ignoredCount = $this->getUser()->getIgnoredSourcesCount()) > 0) {
+ $sources = implode("', '", $this->getUser()->getIgnoredSources(1, $ignoredCount, true));
+
+ $queryBase .= " AND `posts`.`wall` NOT IN ('$sources')";
+ }
$start_from = empty($start_from) ? PHP_INT_MAX : $start_from;
$start_time = empty($start_time) ? 0 : $start_time;
$end_time = empty($end_time) ? PHP_INT_MAX : $end_time;
$posts = DatabaseConnection::i()->getConnection()->query("SELECT `posts`.`id` " . $queryBase . " AND `posts`.`id` <= " . $start_from . " AND " . $start_time . " <= `posts`.`created` AND `posts`.`created` <= " . $end_time . " ORDER BY `created` DESC LIMIT " . $count . " OFFSET " . $offset);
-
+
$rposts = [];
$ids = [];
foreach($posts as $post) {
@@ -73,4 +79,52 @@ final class Newsfeed extends VKAPIRequestHandler
return $response;
}
+
+ function getBanned(int $extended = 0, string $fields = "", string $name_case = "nom")
+ {
+ $this->requireUser();
+
+ $count = 50;
+ $offset = 0;
+
+ $banned = array_slice($this->getUser()->getIgnoredSources(1, $count + $offset, true), $offset);
+
+ if($extended == 0) {
+ $retArr/*d*/ = [
+ "groups" => [],
+ "members" => [] # why
+ ];
+
+ foreach($banned as $ban) {
+ if($ban > 0) {
+ $retArr["members"][] = $ban;
+ } else {
+ $retArr["groups"][] = $ban;
+ }
+ }
+
+ return $retArr;
+ } else {
+ $retArr = [
+ "groups" => [],
+ "profiles" => []
+ ];
+
+ $usIds = "";
+ $clubIds = "";
+
+ foreach($banned as $ban) {
+ if($ban > 0) {
+ $usIds .= $ban . ",";
+ } else {
+ $clubIds .= ($ban * -1) . ",";
+ }
+ }
+
+ $retArr["profiles"][] = (new Users)->get($usIds, $fields);
+ $retArr["groups"][] = (new Groups)->getById($clubIds, $fields);
+
+ return $retArr;
+ }
+ }
}
diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php
index cc6861be..5bbda99e 100644
--- a/Web/Presenters/WallPresenter.php
+++ b/Web/Presenters/WallPresenter.php
@@ -594,21 +594,25 @@ final class WallPresenter extends OpenVKPresenter
$ignoredSource = (int)$this->postParam("source");
if($this->user->identity->getIgnoredSourcesCount() > 50)
- $this->flashFail("err", "Error", "Max ignors count is 50", null, true);
+ $this->flashFail("err", "Error", tr("max_ignores", 50), null, true);
if($ignoredSource > 0) {
$ignoredSourceModel = (new Users)->get($ignoredSource);
if(!$ignoredSourceModel)
- $this->flashFail("err", "Error", "Invalid user", null, true);
+ $this->flashFail("err", "Error", tr("invalid_user"), null, true);
if($ignoredSourceModel->getId() == $this->user->id)
- $this->flashFail("err", "Error", "Can't ignore yourself", null, true);
+ $this->flashFail("err", "Error", tr("cant_ignore_self"), null, true);
} else {
$ignoredSourceModel = (new Clubs)->get(abs($ignoredSource));
if(!$ignoredSourceModel)
- $this->flashFail("err", "Error", "Invalid club", null, true);
+ $this->flashFail("err", "Error", tr("invalid_club"), null, true);
+
+ if($ignoredSourceModel->isHideFromGlobalFeedEnabled()) {
+ $this->flashFail("err", "Error", tr("no_sense"), null, true);
+ }
}
if($ignoredSourceModel->isIgnoredBy($this->user->identity)) {
diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml
index 413019ef..faf5536b 100644
--- a/Web/Presenters/templates/Group/View.xml
+++ b/Web/Presenters/templates/Group/View.xml
@@ -144,7 +144,7 @@
{var $canReport = $thisUser->getId() != $club->getOwner()->getId()}
{if $canReport}
{_report}
-
+
{if !$club->isIgnoredBy($thisUser)}{_ignore_club}{else}{_unignore_club}{/if}
diff --git a/locales/en.strings b/locales/en.strings
index 0c18f079..439cd71c 100644
--- a/locales/en.strings
+++ b/locales/en.strings
@@ -1285,6 +1285,11 @@
"group_is_banned" = "Group was successfully banned";
"description_too_long" = "Description is too long.";
+"invalid_club" = "This group does not exists.";
+"invalid_user" = "This user does not exists.";
+"no_sense" = "No sense.";
+"cant_ignore_self" = "Can't ignore urself.";
+"max_ignores" = "Max ignores — $1";
/* Admin actions */
diff --git a/locales/ru.strings b/locales/ru.strings
index 3162988e..d98e9a68 100644
--- a/locales/ru.strings
+++ b/locales/ru.strings
@@ -1179,6 +1179,11 @@
"group_owner_is_banned" = "Создатель сообщества успешно забанен.";
"group_is_banned" = "Сообщество успешно забанено";
"description_too_long" = "Описание слишком длинное.";
+"invalid_club" = "Такой группы не существует.";
+"invalid_user" = "Такого пользователя не существует.";
+"no_sense" = "Нет смысла.";
+"cant_ignore_self" = "Нельзя игнорировать себя.";
+"max_ignores" = "Максимальное число игноров — $1";
/* Admin actions */