mirror of
https://github.com/openvk/openvk
synced 2025-04-23 16:43:02 +03:00
Remove ability to delete your accepted psto
This commit is contained in:
parent
793a87cc2a
commit
adef21d3a9
6 changed files with 13 additions and 2 deletions
|
@ -887,6 +887,9 @@ final class Wall extends VKAPIRequestHandler
|
|||
|
||||
$wallOwner = $post->getWallOwner();
|
||||
|
||||
if($post->getTargetWall() < 0 && !$post->getWallOwner()->canBeModifiedBy($this->getUser()) && $post->getWallOwner()->getWallType() != 1)
|
||||
$this->fail(12, "Access denied: you can't delete your accepted post.");
|
||||
|
||||
if($post->getOwnerPost() == $this->getUser()->getId() || $post->getTargetWall() == $this->getUser()->getId() || $owner_id < 0 && $wallOwner->canBeModifiedBy($this->getUser())) {
|
||||
$post->unwire();
|
||||
$post->delete();
|
||||
|
|
|
@ -207,6 +207,9 @@ class Post extends Postable
|
|||
|
||||
function canBeDeletedBy(User $user): bool
|
||||
{
|
||||
if($this->getTargetWall() < 0 && !$this->getWallOwner()->canBeModifiedBy($user) && $this->getWallOwner()->getWallType() != 1)
|
||||
return false;
|
||||
|
||||
return $this->getOwnerPost() === $user->getId() || $this->canBePinnedBy($user);
|
||||
}
|
||||
|
||||
|
|
|
@ -492,6 +492,9 @@ final class WallPresenter extends OpenVKPresenter
|
|||
else $canBeDeletedByOtherUser = false;
|
||||
|
||||
if(!is_null($user)) {
|
||||
if($post->getTargetWall() < 0 && !$post->getWallOwner()->canBeModifiedBy($this->user->identity) && $post->getWallOwner()->getWallType() != 1)
|
||||
$this->flashFail("err", tr("failed_to_delete_post"), tr("error_deleting_suggested"));
|
||||
|
||||
if($post->getOwnerPost() == $user || $post->getTargetWall() == $user || $canBeDeletedByOtherUser) {
|
||||
$post->unwire();
|
||||
$post->delete();
|
||||
|
|
|
@ -323,7 +323,7 @@ $(document).on("click", "#publish_post", async (e) => {
|
|||
e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = ""
|
||||
}
|
||||
|
||||
if(document.querySelectorAll(".post").length < 1 && post.new_count > 0) {
|
||||
if(document.querySelectorAll(".post").length < 1 && post.new_count > 0 && document.querySelector(".paginator") != null) {
|
||||
loadMoreSuggestedPosts()
|
||||
}
|
||||
}), Function.noop]);
|
||||
|
@ -384,7 +384,7 @@ $(document).on("click", "#decline_post", async (e) => {
|
|||
}
|
||||
}
|
||||
|
||||
if(document.querySelectorAll(".post").length < 1 && post > 0) {
|
||||
if(document.querySelectorAll(".post").length < 1 && post > 0 && document.querySelector(".paginator") != null) {
|
||||
loadMoreSuggestedPosts()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1180,6 +1180,7 @@
|
|||
"media_file_corrupted_or_too_large" = "The media content file is corrupted or too large.";
|
||||
"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";
|
||||
|
||||
/* Admin actions */
|
||||
|
||||
|
|
|
@ -1080,6 +1080,7 @@
|
|||
"media_file_corrupted_or_too_large" = "Файл медиаконтента повреждён или слишком велик.";
|
||||
"post_is_empty_or_too_big" = "Пост пустой или слишком большой.";
|
||||
"post_is_too_big" = "Пост слишком большой.";
|
||||
"error_deleting_suggested" = "Вы не можете удалить ваш принятый пост";
|
||||
|
||||
/* Admin actions */
|
||||
|
||||
|
|
Loading…
Reference in a new issue