mirror of
https://github.com/openvk/openvk
synced 2025-06-07 22:59:58 +03:00
feat(wall.delete): explain condition
This commit is contained in:
parent
686ce928dd
commit
6e87ac3e38
1 changed files with 7 additions and 2 deletions
|
@ -1104,13 +1104,18 @@ final class Wall extends VKAPIRequestHandler
|
||||||
|
|
||||||
$post = (new PostsRepo())->getPostById($owner_id, $post_id, true);
|
$post = (new PostsRepo())->getPostById($owner_id, $post_id, true);
|
||||||
if (!$post || $post->isDeleted()) {
|
if (!$post || $post->isDeleted()) {
|
||||||
$this->fail(583, "Invalid post");
|
$this->fail(15, "Not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
$wallOwner = $post->getWallOwner();
|
$wallOwner = $post->getWallOwner();
|
||||||
|
|
||||||
|
# trying to solve the condition below.
|
||||||
|
# $post->getTargetWall() < 0 - if post on wall of club
|
||||||
|
# !$post->getWallOwner()->canBeModifiedBy($this->getUser()) - group is cannot be modifiet by %user%
|
||||||
|
# $post->getWallOwner()->getWallType() != 1 - wall is not open
|
||||||
|
# $post->getSuggestionType() == 0 - post is not suggested
|
||||||
if ($post->getTargetWall() < 0 && !$post->getWallOwner()->canBeModifiedBy($this->getUser()) && $post->getWallOwner()->getWallType() != 1 && $post->getSuggestionType() == 0) {
|
if ($post->getTargetWall() < 0 && !$post->getWallOwner()->canBeModifiedBy($this->getUser()) && $post->getWallOwner()->getWallType() != 1 && $post->getSuggestionType() == 0) {
|
||||||
$this->fail(12, "Access denied: you can't delete your accepted post.");
|
$this->fail(15, "Access denied");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($post->getOwnerPost() == $this->getUser()->getId() || $post->getTargetWall() == $this->getUser()->getId() || $owner_id < 0 && $wallOwner->canBeModifiedBy($this->getUser())) {
|
if ($post->getOwnerPost() == $this->getUser()->getId() || $post->getTargetWall() == $this->getUser()->getId() || $owner_id < 0 && $wallOwner->canBeModifiedBy($this->getUser())) {
|
||||||
|
|
Loading…
Reference in a new issue