Compare commits

...

4 commits

Author SHA1 Message Date
koke228666
396780f602
Merge 60ed57a7f6 into b90a0fa013 2025-06-02 14:53:22 +03:00
mr❤️🤢
b90a0fa013
fix(photo upload): fix own page upload error (#1336) 2025-06-01 15:02:00 +00:00
koke228666
60ed57a7f6 поправил табы 2025-05-22 12:47:40 +03:00
koke228666
cafd8d2718 make creating avatar better 2025-05-22 12:47:40 +03:00
5 changed files with 32 additions and 18 deletions

View file

@ -60,6 +60,11 @@ abstract class MediaCollection extends RowModel
}
}
public function getOwnerId(): int
{
return (int) $this->getRecord()->owner;
}
public function getPrettyId(): string
{
return $this->getRecord()->owner . "_" . $this->getRecord()->id;

View file

@ -284,13 +284,15 @@ final class PhotosPresenter extends OpenVKPresenter
}
if ($_SERVER["REQUEST_METHOD"] == "GET" || $this->queryParam("act") == "finish") {
if (!$album) {
if (!$album || $album->isCreatedBySystem()) {
$this->flashFail("err", tr("error"), tr("error_adding_to_deleted"));
}
}
if ($album && !$album->canBeModifiedBy($this->user->identity)) {
$this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
if ($album->getOwnerId() != $this->user->id) {
$this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
}
}
if ($_SERVER["REQUEST_METHOD"] === "POST") {

View file

@ -129,13 +129,15 @@
{var $avatarLink = ((is_null($avatarPhoto) ? FALSE : $avatarPhoto->isAnonymous()) ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())}
<div class="avatar_block" style="position:relative;" data-club="{$club->getId()}">
{if $thisUser && $club->canBeModifiedBy($thisUser)}
<a {if $avatarPhoto}style="display:none"{/if} class="add_image_text" id="add_image">{_add_image}</a>
<div {if !$avatarPhoto}style="display:none"{/if} class="avatar_controls">
<div class="avatarDelete hoverable"></div>
<div class="avatar_variants">
<a class="_add_image hoverable" id="add_image"><span>{_upload_new_picture}</span></a>
</div>
<div class="avatar_controls">
<div {if !$hasAvatar}style="display:none"{/if} class="avatarDelete hoverable"></div>
<div class="avatar_variants">
<a {if $hasAvatar}style="display:none"{/if} class="_add_image hoverable upload_image" id="add_image">
<span>{_add_image}</span></a>
<a {if !$hasAvatar}style="display:none"{/if} class="_add_image hoverable set_image" id="add_image">
<span>{_upload_new_picture}</span></a>
</div>
</div>
{/if}
<a href="{$avatarLink|nocheck}">

View file

@ -73,11 +73,13 @@
{var $hasAvatar = !str_contains($user->getAvatarUrl('miniscule'), "/assets/packages/static/openvk/img/camera_200.png")}
{if $thisUser && $user->getId() == $thisUser->getId()}
<a {if $hasAvatar}style="display:none"{/if} class="add_image_text" id="add_image">{_add_image}</a>
<div {if !$hasAvatar}style="display:none"{/if} class="avatar_controls">
<div class="avatarDelete hoverable"></div>
<div class="avatar_controls">
<div {if !$hasAvatar}style="display:none"{/if} class="avatarDelete hoverable"></div>
<div class="avatar_variants">
<a class="_add_image hoverable" id="add_image"><span>{_upload_new_picture}</span></a>
<a {if $hasAvatar}style="display:none"{/if} class="_add_image hoverable upload_image" id="add_image">
<span>{_add_image}</span></a>
<a {if !$hasAvatar}style="display:none"{/if} class="_add_image hoverable set_image" id="add_image">
<span>{_upload_new_picture}</span></a>
</div>
</div>
{/if}

View file

@ -2206,9 +2206,11 @@ $(document).on("click", "#add_image", (e) => {
document.querySelector("#bigAvatar").src = response.url
document.querySelector("#bigAvatar").parentNode.href = "/photo" + response.new_photo
document.querySelector(".add_image_text").style.display = "none"
document.querySelector(".avatar_controls").style.display = "block"
document.querySelector(".avatar_controls .set_image").style.display = "block"
document.querySelector(".avatar_controls .avatarDelete").style.display = "block"
document.querySelector(".avatar_controls .upload_image").style.display = "none"
}
})
})
@ -2332,17 +2334,18 @@ $(document).on("click", ".avatarDelete", (e) => {
}
document.querySelector(".avatarDelete").classList.remove("lagged")
u("body").removeClass("dimmed");
document.querySelector("html").style.overflowY = "scroll"
u(".ovk-diag-cont").remove()
document.querySelector("#bigAvatar").src = response.url
document.querySelector("#bigAvatar").parentNode.href = response.new_photo ? ("/photo" + response.new_photo) : "javascript:void(0)"
if(!response.has_new_photo) {
document.querySelector(".avatar_controls").style.display = "none"
document.querySelector(".add_image_text").style.display = "block"
document.querySelector(".avatar_controls .set_image").style.display = "none"
document.querySelector(".avatar_controls .avatarDelete").style.display = "none"
document.querySelector(".avatar_controls .upload_image").style.display = "block"
}
}
})