Коммит целесторы

This commit is contained in:
lalka2016 2023-05-19 14:53:23 +03:00
parent 704a162345
commit 07a3f92308
3 changed files with 10 additions and 9 deletions

View file

@ -21,7 +21,7 @@ class Groups implements Handler
$count = $this->groups->getWriteableClubsCount($this->user->getId()); $count = $this->groups->getWriteableClubsCount($this->user->getId());
if(!$count) { if(!$count) {
$reject(122, "You don't have any groups with write access"); $reject("You don't have any groups with write access");
return; return;
} }

View file

@ -75,21 +75,22 @@ class Clubs
function getWriteableClubs(int $id): \Traversable function getWriteableClubs(int $id): \Traversable
{ {
$result = $this->clubs->where(["owner" => $id]); $result = $this->clubs->where("owner", $id);
$coadmins = $this->coadmins->where(["user" => $id]); $coadmins = $this->coadmins->where("user", $id);
foreach($result as $entry) foreach($result as $entry) {
yield new Club($entry); yield new Club($entry);
}
foreach($coadmins as $coadmin)
foreach($coadmins as $coadmin) {
$cl = new Manager($coadmin); $cl = new Manager($coadmin);
yield $cl->getClub(); yield $cl->getClub();
}
} }
function getWriteableClubsCount(int $id): int function getWriteableClubsCount(int $id): int
{ {
return sizeof($this->clubs->where(["owner" => $id])) + sizeof($this->coadmins->where(["user" => $id])); return sizeof($this->clubs->where("owner", $id)) + sizeof($this->coadmins->where("user", $id));
} }
use \Nette\SmartObject; use \Nette\SmartObject;

View file

@ -217,7 +217,7 @@ async function repostPost(id, hash) {
document.getElementById("reposts"+id).insertAdjacentHTML("beforeend", "(<b id='repostsCount"+id+"'>1</b>)") //для старого вида постов document.getElementById("reposts"+id).insertAdjacentHTML("beforeend", "(<b id='repostsCount"+id+"'>1</b>)") //для старого вида постов
} }
}); });
xhr.send('text=' + encodeURI(text) + '&type=' + encodeURI(type) + '&groupId=' + encodeURI(groupId) + "&asGroup="+encodeURI(asGroup) + "&signed="+encodeURI(signed)); xhr.send('text='+encodeURI(text) + '&type='+type + '&groupId='+groupId + "&asGroup="+asGroup + "&signed="+signed);
}), }),
Function.noop Function.noop
]); ]);