Skip to content

Commit

Permalink
Fix a call on potentially undefined parent in Gallery Album. Fixes bu…
Browse files Browse the repository at this point in the history
…g #11289.
  • Loading branch information
perlDreamer committed Dec 4, 2009
1 parent 43f295d commit cb68965
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/changelog/7.x.x.txt
Expand Up @@ -3,6 +3,7 @@
- fixed #11282: USPS Shipping Driver does not accept ZIP+4
- fixed #11284: Collaboration System Cron jobs for email
- fixed #11287: api pod WebGUI::Shop::Vendor
- fixed #11289: Gallery with pending version tag causes search engine indexer to puke.

7.7.27
- fixed #11134: Tree Navigation menu colapses sub items of current page, missing JS files added
Expand Down
3 changes: 1 addition & 2 deletions lib/WebGUI/Asset/Wobject/GalleryAlbum.pm
Expand Up @@ -311,8 +311,7 @@ sub canEdit {
}
else {
return 1 if $userId eq $self->get("ownerUserId");

return $gallery->canEdit($userId);
return $gallery && $gallery->canEdit($userId);
}
}

Expand Down
20 changes: 15 additions & 5 deletions t/Asset/File/GalleryFile/Photo/permissions.t
Expand Up @@ -27,10 +27,9 @@ my $node = WebGUI::Asset->getImportNode($session);
my $maker = WebGUI::Test::Maker::Permission->new;

$session->user({ userId => 3 });
my @versionTags = ();
push @versionTags, WebGUI::VersionTag->getWorking($session);
$versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"});
WebGUI::Test->tagsToRollback(@versionTags);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Photo Test, add Gallery, Album and 1 Photo"});
WebGUI::Test->tagsToRollback($versionTag);

# Add a new user to the test user's friends list
my $friend = WebGUI::User->new($session, "new");
Expand Down Expand Up @@ -73,7 +72,18 @@ my $photo
{
skipAutoCommitWorkflows => 1,
});
$versionTags[-1]->commit;

my $photo2 = $photo->cloneFromDb;
my $album2 = $album->cloneFromDb;

$session->stow->delete('assetRevision');
$versionTag->leaveTag;

$session->user({userId => $notFriend->userId});
diag $album2->canEdit;
$session->user({userId => 1});

$versionTag->commit;

#----------------------------------------------------------------------------
# Tests
Expand Down

0 comments on commit cb68965

Please sign in to comment.