Groups: Publish group avatars uploaded by hidden administrator as anonymous

This commit is contained in:
Maxim Leshchenko 2021-12-26 16:16:37 +02:00
parent 08c4d961f1
commit 33836d8a2e
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE

View file

@ -219,10 +219,17 @@ final class GroupPresenter extends OpenVKPresenter
if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) { if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) {
$photo = new Photo; $photo = new Photo;
try { try {
$anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"];
if($anon && $this->user->id === $club->getOwner()->getId())
$anon = $club->isOwnerHidden();
else if($anon)
$anon = $club->getManager($this->user->identity)->isHidden();
$photo->setOwner($this->user->id); $photo->setOwner($this->user->id);
$photo->setDescription("Profile image"); $photo->setDescription("Profile image");
$photo->setFile($_FILES["ava"]); $photo->setFile($_FILES["ava"]);
$photo->setCreated(time()); $photo->setCreated(time());
$photo->setAnonymous($anon);
$photo->save(); $photo->save();
(new Albums)->getClubAvatarAlbum($club)->addPhoto($photo); (new Albums)->getClubAvatarAlbum($club)->addPhoto($photo);