From da3ba2df0bf27ef8d6c886610efd499e185c940c Mon Sep 17 00:00:00 2001
From: mrilyew <99399973+mrilyew@users.noreply.github.com>
Date: Sat, 16 Nov 2024 16:39:46 +0300
Subject: [PATCH] fix poll removing

---
 VKAPI/Handlers/Wall.php                 |  2 +-
 Web/Presenters/InternalAPIPresenter.php |  2 +-
 Web/static/css/main.css                 |  1 +
 Web/static/js/al_wall.js                | 10 +++++++++-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/VKAPI/Handlers/Wall.php b/VKAPI/Handlers/Wall.php
index 400e15da..f6271e69 100644
--- a/VKAPI/Handlers/Wall.php
+++ b/VKAPI/Handlers/Wall.php
@@ -953,7 +953,7 @@ final class Wall extends VKAPIRequestHandler
         $this->requireUser();
         $this->willExecuteWriteAction();
 
-        $parsed_attachments  = parseAttachments($attachments, ['photo', 'video', 'note', 'audio']);
+        $parsed_attachments  = parseAttachments($attachments, ['photo', 'video', 'note', 'audio', 'poll']);
         $final_attachments   = [];
         foreach($parsed_attachments as $attachment) {
             if($attachment && !$attachment->isDeleted() && $attachment->canBeViewedBy($this->getUser()) &&
diff --git a/Web/Presenters/InternalAPIPresenter.php b/Web/Presenters/InternalAPIPresenter.php
index e8830497..72546506 100644
--- a/Web/Presenters/InternalAPIPresenter.php
+++ b/Web/Presenters/InternalAPIPresenter.php
@@ -122,7 +122,7 @@ final class InternalAPIPresenter extends OpenVKPresenter
                 if($attachment instanceof \openvk\Web\Models\Entities\Photo)
                 {
                     $response[$attachment->getPrettyId()] = [
-                        "url" => $attachment->getURLBySizeId('large'),
+                        "url" => $attachment->getURLBySizeId('larger'),
                         "id"  => $attachment->getPrettyId(),
                     ];
                 }
diff --git a/Web/static/css/main.css b/Web/static/css/main.css
index 5aca17ac..69147a03 100644
--- a/Web/static/css/main.css
+++ b/Web/static/css/main.css
@@ -2661,6 +2661,7 @@ a.poll-retract-vote {
     overflow-x: hidden;
     min-height: 300px;
     width: 100%;
+    padding: 0px 2px;
 }
 
 .ovk-photo-view .ovk-photo-details {
diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js
index 5504bd3b..0ad15df7 100644
--- a/Web/static/js/al_wall.js
+++ b/Web/static/js/al_wall.js
@@ -722,6 +722,14 @@ u(document).on("click", "#editPost", async (e) => {
                     'preview': preview,
                     'id': aid
                 }, edit_place)
+            } else if(type == 'poll') {
+                __appendToTextarea({
+                    'type': type,
+                    'alignment': 'vertical',
+                    'html': tr('poll'),
+                    'id': att[type].id,
+                    'undeletable': true,
+                }, edit_place) 
             } else {
                 const found_block = post.find(`div[data-att_type='${type}'][data-att_id='${aid}']`)
                 __appendToTextarea({
@@ -866,7 +874,7 @@ async function __appendToTextarea(attachment_obj, textareaNode) {
                 <div class='vertical-attachment-content' draggable="false">
                     ${attachment_obj.html}
                 </div>
-                <div class='vertical-attachment-remove'>
+                <div class='${attachment_obj.undeletable ? 'lagged' : ''} vertical-attachment-remove'>
                     <div id='small_remove_button'></div>
                 </div>
             </div>