Skip to content

Commit

Permalink
Merge pull request #13207 from nextcloud/fix/noid/use-ocp-image
Browse files Browse the repository at this point in the history
  • Loading branch information
Antreesy authored Sep 4, 2024
2 parents 52082e0 + d397a93 commit cf99ec2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/TempAvatarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function postAvatar(): DataResponse {
}

try {
$image = new \OC_Image();
$image = new \OCP\Image();
$image->loadFromData($content);
$image->readExif($content);
$image->fixOrientation();
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/AvatarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function setAvatarFromRequest(Room $room, ?array $file): void {

$content = file_get_contents($file['tmp_name']);
unlink($file['tmp_name']);
$image = new \OC_Image();
$image = new \OCP\Image();
$image->loadFromData($content);
$image->readExif($content);
$this->setAvatar($room, $image);
Expand Down Expand Up @@ -98,7 +98,7 @@ public function setAvatarFromEmoji(Room $room, string $emoji, ?string $color): v
$this->roomService->setAvatar($room, $avatarName);
}

public function setAvatar(Room $room, \OC_Image $image): void {
public function setAvatar(Room $room, \OCP\Image $image): void {
if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
throw new InvalidArgumentException($this->l->t('One-to-one rooms always need to show the other users avatar'));
}
Expand Down
4 changes: 3 additions & 1 deletion tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@
</UndefinedClass>
</file>
<file src="lib/Service/AvatarService.php">
<MissingDependency>
<code><![CDATA[\OCP\Image]]></code>
</MissingDependency>
<UndefinedClass>
<code><![CDATA[Filesystem]]></code>
<code><![CDATA[\OC_Image]]></code>
</UndefinedClass>
</file>
<file src="lib/Service/RecordingService.php">
Expand Down

0 comments on commit cf99ec2

Please sign in to comment.