This commit is contained in:
lalka2016 2023-08-17 21:19:35 +03:00
parent c8ef5ccd64
commit 5f51881a5d
9 changed files with 45 additions and 22 deletions

View file

@ -92,10 +92,7 @@ final class Groups extends VKAPIRequestHandler
break;
}
if($usr->canBeModifiedBy($this->getUser()))
$rClubs[$i]->suggested_count = $usr->getSuggestedPostsCount();
else
$rClubs[$i]->suggested_count = (new PostsRepo)->getSuggestedPostsCountByUser($usr->getId(), $this->getUser()->getId());
$rClubs[$i]->suggested_count = $usr->getSuggestedPostsCount($this->getUser());
break;
}
@ -215,11 +212,7 @@ final class Groups extends VKAPIRequestHandler
break;
}
if($clb->canBeModifiedBy($this->getUser()))
$response[$i]->suggested_count = $clb->getSuggestedPostsCount();
else
$response[$i]->suggested_count = (new PostsRepo)->getSuggestedPostsCountByUser($clb->getId(), $this->getUser()->getId());
$response[$i]->suggested_count = $clb->getSuggestedPostsCount($this->getUser());
break;
case "contacts":
$contacts;

View file

@ -49,13 +49,13 @@ final class Wall extends VKAPIRequestHandler
$cnt = $posts->getPostCountOnUserWall($owner_id);
break;
case "owner":
$this->fail(66666, "Not implemented");
$this->fail(42, "Not implemented");
break;
case "others":
$this->fail(66666, "Not implemented");
$this->fail(42, "Not implemented");
break;
case "postponed":
$this->fail(66666, "Postponed posts are not implemented.");
$this->fail(42, "Postponed posts are not implemented.");
break;
case "suggests":
if($owner_id < 0) {

View file

@ -194,7 +194,7 @@ class Club extends RowModel
function setWall(int $type)
{
if($type > 3 || $type < 0)
if($type > 2 || $type < 0)
throw new \LogicException("Invalid wall");
$this->stateChanges("wall", $type);
@ -309,9 +309,19 @@ class Club extends RowModel
}
}
function getSuggestedPostsCount()
function getSuggestedPostsCount(User $user = NULL)
{
$count = (new Posts)->getSuggestedPostsCount($this->getId());
$count = 0;
if(is_null($user)) {
return NULL;
}
if($this->canBeModifiedBy($user)) {
$count = (new Posts)->getSuggestedPostsCount($this->getId());
} else {
$count = (new Posts)->getSuggestedPostsCountByUser($this->getId(), $user->getId());
}
return $count;
}

View file

@ -225,7 +225,7 @@ final class GroupPresenter extends OpenVKPresenter
try {
$club->setWall(empty($this->postParam("wall")) ? 0 : (int)$this->postParam("wall"));
} catch(\Exception $e) {
$this->flashFail("err", "Fuck you", "");
$this->flashFail("err", tr("error"), tr("error_invalid_wall_value"));
}
$club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display"));

View file

@ -233,9 +233,9 @@
<a n:foreach="$thisUser->getPinnedClubs() as $club" href="{$club->getURL()}" class="link group_link">
{$club->getName()}
<object type="internal/link" style="white-space: normal;" id="sug{$club->getId()}" n:if="$club->getSuggestedPostsCount() > 0 && $club->getWallType() == 2">
<object type="internal/link" style="white-space: normal;" id="sug{$club->getId()}" n:if="$club->getSuggestedPostsCount($thisUser) > 0 && $club->getWallType() == 2">
<a href="/club{$club->getId()}/suggested" class="linkunderline">
(<b>{$club->getSuggestedPostsCount()}</b>)
(<b>{$club->getSuggestedPostsCount($thisUser)}</b>)
</a>
</object>
</a>

View file

@ -1181,6 +1181,7 @@
"post_is_empty_or_too_big" = "The post is empty or too big.";
"post_is_too_big" = "The post is too big.";
"error_deleting_suggested" = "You can't delete your accepted post";
"error_invalid_wall_value" = "Invalid wall value";
/* Admin actions */

View file

@ -1081,6 +1081,7 @@
"post_is_empty_or_too_big" = "Пост пустой или слишком большой.";
"post_is_too_big" = "Пост слишком большой.";
"error_deleting_suggested" = "Вы не можете удалить ваш принятый пост";
"error_invalid_wall_value" = "Некорректное значение стены";
/* Admin actions */

View file

@ -242,3 +242,16 @@ input[type="radio"] {
background-image: url("/themepack/midnight/0.0.2.8/resource/backdrop-editor.gif") !important;
border-color: #473e66 !important;
}
.sugglist {
background-color: #231e33;
border-color: #2c2640 !important;
}
.sugglist a {
color: #7c94c5;
}
.button.loaded {
background: #383052 url("/assets/packages/static/openvk/img/loading_mini.gif") no-repeat 50% 50% !important;
}

View file

@ -47,13 +47,13 @@ body {
.content_title_expanded {
cursor: pointer;
background-image: unset;
background-image: unset !important;
padding: 3px 10px;
border-top: #e6e6e6 solid 1px;
}
.content_title_unexpanded {
background-image: unset;
background-image: unset !important;
padding: 3px 10px;
border-top: #eee solid 1px;
}
@ -337,3 +337,8 @@ input[type=checkbox] {
{
border-top: 1px solid #2f2f2f;
}
.sugglist {
border-top: unset;
border-bottom: 1px solid gray;
}