Fix empty posts

This commit is contained in:
lalka2016 2023-07-31 10:00:55 +03:00
parent eff2b2bba1
commit 213f1e286c
4 changed files with 16 additions and 8 deletions

View file

@ -110,7 +110,7 @@ class Wall implements Handler
$reject(10, "Post is already declined"); $reject(10, "Post is already declined");
if(!$post->canBePinnedBy($this->user)) if(!$post->canBePinnedBy($this->user))
$reject(22, "Access to post denied :)"); $reject(22, "Access to post denied");
$post->setSuggested(2); $post->setSuggested(2);
$post->save(); $post->save();
@ -131,7 +131,7 @@ class Wall implements Handler
$reject(10, "Post is declined"); $reject(10, "Post is declined");
if(!$post->canBePinnedBy($this->user)) if(!$post->canBePinnedBy($this->user))
$reject(22, "Access to post denied :)"); $reject(22, "Access to post denied");
$author = $post->getOwner(); $author = $post->getOwner();
$flags = 0; $flags = 0;
@ -144,7 +144,10 @@ class Wall implements Handler
$post->setSuggested(0); $post->setSuggested(0);
$post->setCreated(time()); $post->setCreated(time());
$post->setFlags($flags); $post->setFlags($flags);
$post->setContent($content);
if(mb_strlen($content) > 0) {
$post->setContent($content);
}
$post->save(); $post->save();

View file

@ -57,7 +57,8 @@ final class Wall extends VKAPIRequestHandler
case "postponed": case "postponed":
$this->fail(66666, "Otlojka is not implemented :)"); $this->fail(66666, "Otlojka is not implemented :)");
break; break;
# В апи, походу, нету метода, который бы публиковал запись из предложки # В вкапи, походу, нету метода, который бы публиковал запись из предложки.
# Либо он закрыт для неофициальных клиентов, как gifts.send
case "suggests": case "suggests":
if($owner_id < 0) { if($owner_id < 0) {
if($wallOnwer->canBeModifiedBy($this->getUser())) { if($wallOnwer->canBeModifiedBy($this->getUser())) {

View file

@ -200,7 +200,7 @@ final class GroupPresenter extends OpenVKPresenter
$this->willExecuteWriteAction(); $this->willExecuteWriteAction();
$club = $this->clubs->get($id); $club = $this->clubs->get($id);
if(!$club || !$club->canBeModifiedBy($this->user->identity) || $club->isDeleted()) if(!$club || !$club->canBeModifiedBy($this->user->identity))
$this->notFound(); $this->notFound();
else else
$this->template->club = $club; $this->template->club = $club;
@ -211,7 +211,12 @@ final class GroupPresenter extends OpenVKPresenter
$club->setName(empty($this->postParam("name")) ? $club->getName() : $this->postParam("name")); $club->setName(empty($this->postParam("name")) ? $club->getName() : $this->postParam("name"));
$club->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about")); $club->setAbout(empty($this->postParam("about")) ? NULL : $this->postParam("about"));
$club->setWall(empty($this->postParam("wall")) ? 0 : 1); try {
$club->setWall(empty($this->postParam("wall")) ? 0 : (int)$this->postParam("wall"));
} catch(\Exception $e) {
$this->flashFail("err", "Fuck you", "");
}
$club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display")); $club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display"));
$club->setEveryone_Can_Create_Topics(empty($this->postParam("everyone_can_create_topics")) ? 0 : 1); $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->setDisplay_Topics_Above_Wall(empty($this->postParam("display_topics_above_wall")) ? 0 : 1);

View file

@ -340,7 +340,6 @@ $(document).on("click", "#decline_post", async (e) => {
u("#deleteMe").remove() u("#deleteMe").remove()
} }
// а хули
NewNotification(tr("suggestion_succefully_declined"), "", null); NewNotification(tr("suggestion_succefully_declined"), "", null);
e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = "" e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = ""
document.getElementById("cound").innerHTML = tr("x_suggested_posts_in_group", post) document.getElementById("cound").innerHTML = tr("x_suggested_posts_in_group", post)