Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Support receiving two albums with the same names
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Sep 20, 2022
commit cdf57cbf608e6155b2e7e19edd98133b7602044c
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