From baccbed5d631c214f5aa9f6bef6f769286d2783c Mon Sep 17 00:00:00 2001 From: lalka2016 <99399973+lalka2016@users.noreply.github.com> Date: Sat, 13 May 2023 12:35:11 +0300 Subject: [PATCH] Fixed changing avatar from settings --- Web/Presenters/UserPresenter.php | 13 ++++++++----- Web/Presenters/templates/Group/View.xml | 10 +++++----- Web/Presenters/templates/User/View.xml | 17 +++++------------ Web/Presenters/templates/_includeCSS.xml | 3 +++ Web/static/js/openvk.cls.js | 11 ++++++----- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 42bb4f1d..9cfa3654 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -334,11 +334,14 @@ final class UserPresenter extends OpenVKPresenter $post->setFlags($flags); $post->save(); $post->attach($photo); - - $this->returnJson([ - "url" => $photo->getURL(), - "id" => $photo->getPrettyId() - ]); + if($this->postParam("ava", true) == (int)1) { + $this->returnJson([ + "url" => $photo->getURL(), + "id" => $photo->getPrettyId() + ]); + } else { + $this->flashFail("succ", tr("photo_saved"), tr("photo_saved_comment")); + } } function renderSettings(): void diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index 15c03145..6cfca77b 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -98,17 +98,17 @@ {var $avatarLink = ((is_null($avatarPhoto) ? FALSE : $avatarPhoto->isAnonymous()) ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())}
${tr('troubles_avatar')}
-${tr("deleting_avatar_sure")}
@@ -516,7 +517,7 @@ function deleteAvatar(avatar, hash) location.reload() } xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhr.send("hash="+hash) + xhr.send("hash="+u("meta[name=csrf]").attr("value")) }), (function() { u("#tmpPhDelF").remove();