Skip to content

Commit

Permalink
Support receiving two albums with the same names
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Sep 20, 2022
1 parent 90c90cd commit cdf57cb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
25 changes: 25 additions & 0 deletions cypress/e2e/shared_albums.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,29 @@ describe('Manage shared albums', () => {
cy.get('ul.collections__list li').should('have.length', 3)
})
})

context('Two shared albums with the same name', () => {
before(() => {
cy.logout()
cy.login(randUser, 'password')
cy.visit(`${Cypress.env('baseUrl')}/index.php/apps/photos/albums`)
cy.createAnAlbumFromAlbums('shared_album_test5')
cy.addCollaborators([randUser2])
cy.logout()

cy.login(randUser3, 'password')
cy.visit(`${Cypress.env('baseUrl')}/index.php/apps/photos/albums`)
cy.createAnAlbumFromAlbums('shared_album_test5')
cy.addCollaborators([randUser2])
cy.logout()
})


it('It should display two shared albums', () => {
cy.get('ul.collections__list li')
.contains(`shared_album_test5 (${randUser})`)
cy.get('ul.collections__list li')
.contains(`shared_album_test5 (${randUser3})`)
})
})
})
6 changes: 3 additions & 3 deletions lib/Album/AlbumMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,11 @@ public function getSharedAlbumsForCollaboratorWithFiles(string $collaboratorId,
if ($row['fileid']) {
$mimeId = $row['mimetype'];
$mimeType = $this->mimeTypeLoader->getMimetypeById($mimeId);
$filesByAlbum[$albumId][] = new AlbumFile((int)$row['fileid'], $row['file_name'], $mimeType, (int)$row['size'], (int)$row['mtime'], $row['etag'], (int)$row['added'], $row['owner']);
$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']);
}

if (!isset($albumsById[$albumId])) {
$albumsById[$albumId] = new AlbumInfo($albumId, $row['album_user'], $row['album_name'], $row['location'], (int)$row['created'], (int)$row['last_added_photo']);
$albumsById[$albumId] = new AlbumInfo($albumId, $row['album_user'], $row['album_name'].' ('.$row['album_user'].')', $row['location'], (int)$row['created'], (int)$row['last_added_photo']);
}
}

Expand Down Expand Up @@ -419,7 +419,7 @@ public function getAlbumForCollaboratorIdAndFileId(string $collaboratorId, int $
return new AlbumInfo(
(int)$row['album_id'],
$row['user'],
$row['name'],
$row['name'].' ('.$row['user'].')',
$row['location'],
(int)$row['created'],
(int)$row['last_added_photo']
Expand Down

0 comments on commit cdf57cb

Please sign in to comment.