Skip to content

Commit cdf57cb

Browse files
committed
Support receiving two albums with the same names
Signed-off-by: Louis Chemineau <[email protected]>
1 parent 90c90cd commit cdf57cb

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

cypress/e2e/shared_albums.cy.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,29 @@ describe('Manage shared albums', () => {
161161
cy.get('ul.collections__list li').should('have.length', 3)
162162
})
163163
})
164+
165+
context('Two shared albums with the same name', () => {
166+
before(() => {
167+
cy.logout()
168+
cy.login(randUser, 'password')
169+
cy.visit(`${Cypress.env('baseUrl')}/index.php/apps/photos/albums`)
170+
cy.createAnAlbumFromAlbums('shared_album_test5')
171+
cy.addCollaborators([randUser2])
172+
cy.logout()
173+
174+
cy.login(randUser3, 'password')
175+
cy.visit(`${Cypress.env('baseUrl')}/index.php/apps/photos/albums`)
176+
cy.createAnAlbumFromAlbums('shared_album_test5')
177+
cy.addCollaborators([randUser2])
178+
cy.logout()
179+
})
180+
181+
182+
it('It should display two shared albums', () => {
183+
cy.get('ul.collections__list li')
184+
.contains(`shared_album_test5 (${randUser})`)
185+
cy.get('ul.collections__list li')
186+
.contains(`shared_album_test5 (${randUser3})`)
187+
})
188+
})
164189
})

lib/Album/AlbumMapper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,11 @@ public function getSharedAlbumsForCollaboratorWithFiles(string $collaboratorId,
364364
if ($row['fileid']) {
365365
$mimeId = $row['mimetype'];
366366
$mimeType = $this->mimeTypeLoader->getMimetypeById($mimeId);
367-
$filesByAlbum[$albumId][] = new AlbumFile((int)$row['fileid'], $row['file_name'], $mimeType, (int)$row['size'], (int)$row['mtime'], $row['etag'], (int)$row['added'], $row['owner']);
367+
$filesByAlbum[$albumId][] = new AlbumFile((int)$row['fileid'], $row['album_name'].' ('.$row['album_user'].')', $mimeType, (int)$row['size'], (int)$row['mtime'], $row['etag'], (int)$row['added'], $row['owner']);
368368
}
369369

370370
if (!isset($albumsById[$albumId])) {
371-
$albumsById[$albumId] = new AlbumInfo($albumId, $row['album_user'], $row['album_name'], $row['location'], (int)$row['created'], (int)$row['last_added_photo']);
371+
$albumsById[$albumId] = new AlbumInfo($albumId, $row['album_user'], $row['album_name'].' ('.$row['album_user'].')', $row['location'], (int)$row['created'], (int)$row['last_added_photo']);
372372
}
373373
}
374374

@@ -419,7 +419,7 @@ public function getAlbumForCollaboratorIdAndFileId(string $collaboratorId, int $
419419
return new AlbumInfo(
420420
(int)$row['album_id'],
421421
$row['user'],
422-
$row['name'],
422+
$row['name'].' ('.$row['user'].')',
423423
$row['location'],
424424
(int)$row['created'],
425425
(int)$row['last_added_photo']

0 commit comments

Comments
 (0)