Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set user avatar as base64 #973

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions controller/editorapicontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,6 @@ class EditorApiController extends OCSController {
*/
private $lockManager;

/**
* Avatar manager
*
* @var IAvatarManager
*/
private $avatarManager;

/**
* Mobile regex from https://github.com/ONLYOFFICE/CommunityServer/blob/v9.1.1/web/studio/ASC.Web.Studio/web.appsettings.config#L35
*/
Expand Down Expand Up @@ -201,7 +194,6 @@ public function __construct(
}

$this->fileUtility = new FileUtility($AppName, $trans, $logger, $config, $shareManager, $session);
$this->avatarManager = \OC::$server->getAvatarManager();
}

/**
Expand Down Expand Up @@ -439,16 +431,6 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok
"id" => $this->buildUserId($userId),
"name" => $user->getDisplayName()
];
$avatar = $this->avatarManager->getAvatar($userId);
if ($avatar->exists() && $avatar->isCustomAvatar()) {
$userAvatarUrl = $this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkToRoute("core.avatar.getAvatar", [
"userId" => $userId,
"size" => 64,
])
);
$params["editorConfig"]["user"]["image"] = $userAvatarUrl;
}
} elseif (!empty($guestName)) {
$params["editorConfig"]["user"] = [
"name" => $guestName
Expand Down
8 changes: 1 addition & 7 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,7 @@ public function userInfo($userIds) {
];
$avatar = $this->avatarManager->getAvatar($user->getUID());
if ($avatar->exists() && $avatar->isCustomAvatar()) {
$userAvatarUrl = $this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkToRoute("core.avatar.getAvatar", [
"userId" => $user->getUID(),
"size" => 64,
])
);
$userData["image"] = $userAvatarUrl;
$userData["image"] = "data:image/png;base64," . $avatar->get()->__toString();
}
array_push($result, $userData);
}
Expand Down
Loading