mirror of https://github.com/nextcloud/photos
Fix Fatal Error in Album setCollaborator function - redefining computeKey
When calling setCollaborator function two times after another, computeKey is redefined and leads to a fatal error. Fixed by defining it as an anonymous function instead :) Signed-off-by: Frederik Berg <83548283+frederikb96@users.noreply.github.com>
This commit is contained in:
parent
bac24f84d5
commit
c77b9046a1
|
@ -440,12 +440,12 @@ class AlbumMapper {
|
|||
$existingCollaborators = $this->getCollaborators($albumId);
|
||||
|
||||
// Different behavior if type is link to prevent creating multiple link.
|
||||
function computeKey($c) {
|
||||
return ($c['type'] === AlbumMapper::TYPE_LINK ? '' : $c['id']).$c['type'];
|
||||
}
|
||||
$computeKey = function ($c) {
|
||||
return ($c['type'] === AlbumMapper::TYPE_LINK ? '' : $c['id']) . $c['type'];
|
||||
};
|
||||
|
||||
$collaboratorsToAdd = array_udiff($collaborators, $existingCollaborators, fn ($a, $b) => strcmp(computeKey($a), computeKey($b)));
|
||||
$collaboratorsToRemove = array_udiff($existingCollaborators, $collaborators, fn ($a, $b) => strcmp(computeKey($a), computeKey($b)));
|
||||
$collaboratorsToAdd = array_udiff($collaborators, $existingCollaborators, fn ($a, $b) => strcmp($computeKey($a), $computeKey($b)));
|
||||
$collaboratorsToRemove = array_udiff($existingCollaborators, $collaborators, fn ($a, $b) => strcmp($computeKey($a), $computeKey($b)));
|
||||
|
||||
$this->connection->beginTransaction();
|
||||
|
||||
|
|
Loading…
Reference in New Issue