File tree Expand file tree Collapse file tree
build/integration/features Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,3 +97,21 @@ Feature: avatar
9797 | Content -Type | image /png |
9898 And last avatar is a square of size 512
9999 And last avatar is not a single color
100+
101+ Scenario : Get avatar for users with cloudID formatted user id
102+ Given user "user@example.tld" exists
103+ Given Logging in using web as "user@example.tld"
104+ When logged in user posts avatar from file "data/green-square-256.png"
105+ And user "user@example.tld" gets avatar for user "user@example.tld"
106+ And The following headers should be set
107+ | Content -Type | image /png |
108+ | X -NC -IsCustomAvatar | 1 |
109+ # Last avatar size is 512 by default when getting avatar without size parameter
110+ And last avatar is a square of size 512
111+ And last avatar is a single "#00FF00" color
112+ And user "anonymous" gets avatar for user "user@example.tld"
113+ And The following headers should be set
114+ | Content -Type | image /png |
115+ | X -NC -IsCustomAvatar | 1 |
116+ And last avatar is a square of size 512
117+ And last avatar is a single "#00FF00" color
Original file line number Diff line number Diff line change @@ -49,18 +49,18 @@ public function __construct(
4949 * If the user is disabled a guest avatar will be returned
5050 *
5151 * @see \OCP\IAvatar
52- * @param string $userId the ownCloud user id
52+ * @param string $userId the user id
5353 * @throws \Exception In case the username is potentially dangerous
5454 * @throws NotFoundException In case there is no user folder yet
5555 */
5656 #[\Override]
5757 public function getAvatar (string $ userId ): IAvatar {
58- if ($ this ->cloudIdManager ->isValidCloudId ($ userId )) {
59- return $ this ->getRemoteAvatar ($ userId );
60- }
61-
6258 $ user = $ this ->userManager ->get ($ userId );
6359 if ($ user === null ) {
60+ if ($ this ->cloudIdManager ->isValidCloudId ($ userId )) {
61+ return $ this ->getRemoteAvatar ($ userId );
62+ }
63+
6464 throw new \Exception ('user does not exist ' );
6565 }
6666
Original file line number Diff line number Diff line change @@ -287,8 +287,9 @@ public function testGetAvatarForRemoteUser(): void {
287287 $ cloudId = 'user@https://remote.example.com ' ;
288288
289289 $ this ->userManager
290- ->expects ($ this ->never ())
291- ->method ('get ' );
290+ ->expects ($ this ->once ())
291+ ->method ('get ' )
292+ ->willReturn (null );
292293
293294 $ resolvedCloudId = $ this ->createMock (ICloudId::class);
294295 $ resolvedCloudId ->method ('getUser ' )->willReturn ('user ' );
You can’t perform that action at this time.
0 commit comments