From b198a9850636b1b93aaa5a82184f40af0e6830ca Mon Sep 17 00:00:00 2001 From: lalka2016 <99399973+lalka2016@users.noreply.github.com> Date: Sat, 24 Jun 2023 16:04:09 +0300 Subject: [PATCH] Add check forrwifhjrowhg jrbgerhjgehhge oghjrjkr --- ServiceAPI/Wall.php | 5 +-- VKAPI/Handlers/Wall.php | 3 ++ Web/Presenters/WallPresenter.php | 4 +++ .../templates/components/textArea.xml | 2 +- Web/static/js/al_wall.js | 34 +++++++++++-------- locales/en.strings | 2 ++ locales/ru.strings | 2 ++ 7 files changed, 34 insertions(+), 18 deletions(-) diff --git a/ServiceAPI/Wall.php b/ServiceAPI/Wall.php index b052f687..a3016be7 100644 --- a/ServiceAPI/Wall.php +++ b/ServiceAPI/Wall.php @@ -79,8 +79,9 @@ class Wall implements Handler $myNotes = $this->notes->getUserNotes($this->user, 1, $this->notes->getUserNotesCount($this->user)); $arr = [ - "count" => sizeof($myNotes), - "items" => [] + "count" => sizeof($myNotes), + "closed" => $this->user->getPrivacySetting("notes.read"), + "items" => [] ]; foreach($myNotes as $note) { diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php index fa61b84b..f5944639 100644 --- a/VKAPI/Handlers/Wall.php +++ b/VKAPI/Handlers/Wall.php @@ -480,6 +480,9 @@ final class Wall extends VKAPIRequestHandler $this->fail(100, "Note does not exists"); if($attacc->getOwner()->getId() != $this->getUser()->getId()) $this->fail(43, "You do not have access to this note"); + + if($attacc->getOwner()->getPrivacySetting("notes.read") < 1) + $this->fail(11, "You can't attach note to post, because your notes list is closed. Change it in privacy settings in web-version."); $post->attach($attacc); } diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 7beb5c2a..727101ff 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -287,6 +287,10 @@ final class WallPresenter extends OpenVKPresenter if(!$note || $note->isDeleted() || $note->getOwner()->getId() != $this->user->id) { $this->flashFail("err", tr("error"), tr("error_attaching_note")); } + + if($note->getOwner()->getPrivacySetting("notes.read") < 1) { + $this->flashFail("err", " "); + } } if(empty($this->postParam("text")) && !$photo && !$video && !$poll && !$note) diff --git a/Web/Presenters/templates/components/textArea.xml b/Web/Presenters/templates/components/textArea.xml index 73b78004..f76649d6 100644 --- a/Web/Presenters/templates/components/textArea.xml +++ b/Web/Presenters/templates/components/textArea.xml @@ -80,7 +80,7 @@ {_video} - + {_note} diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js index 79157e40..def8b42a 100644 --- a/Web/static/js/al_wall.js +++ b/Web/static/js/al_wall.js @@ -207,23 +207,27 @@ async function attachNote(id) let notes = await API.Wall.getMyNotes() let body = `` - if(notes.items.length < 1) { - body = `${tr("no_notes")}` + if(notes.closed < 1) { + body = `${tr("notes_closed")}` } else { - body = ` - ${tr("select_or_create_new")} -
- ` - - for(const note of notes.items) { - body += ` -
- ${escapeHtml(note.name)} -
+ if(notes.items.length < 1) { + body = `${tr("no_notes")}` + } else { + body = ` + ${tr("select_or_create_new")} +
` - } - - body += `
` + + for(const note of notes.items) { + body += ` +
+ ${escapeHtml(note.name)} +
+ ` + } + + body += `
` + } } let frame = MessageBox(tr("select_note"), body, [tr("cancel")], [Function.noop]); diff --git a/locales/en.strings b/locales/en.strings index 4cae28b2..90542d92 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -411,6 +411,8 @@ "select_or_create_new" = "Select existing note or
create new one"; +"notes_closed" = "You can't attach note to post, because only you can see them.
You can change it in settings."; + /* Menus */ /* Note that is string need to fit into the "My Page" link */ diff --git a/locales/ru.strings b/locales/ru.strings index 465300e0..51716742 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -396,6 +396,8 @@ "select_or_create_new" = "Выберите существующую заметку или создайте новую"; +"notes_closed" = "Вы не можете прикрепить заметку к записи, так как ваши заметки видны только вам.

Вы можете поменять это в настройках."; + /* Menus */ "edit_button" = "ред.";