Fix problems with the Story Archive leaking version tags when it is not committed. Fixes bug #11678
This commit is contained in:
parent
321f165147
commit
b7ba9f2118
5 changed files with 31 additions and 6 deletions
|
|
@ -8,6 +8,8 @@
|
|||
- fixed #11626: Duplicate messages from Collab Systems
|
||||
- fixed #11667: Shop: unable to remove item from Cart
|
||||
- fixed #11550: Pending assets in the clipboard or trash are not visible from the approval screen
|
||||
- fixed #11678: Story Archive leaks version tags
|
||||
|
||||
|
||||
7.9.7
|
||||
- added #11571: Allow return from photo edit view to gallery edit view
|
||||
|
|
|
|||
|
|
@ -319,9 +319,14 @@ sub getFolder {
|
|||
##For a fully automatic commit, save the current tag, create a new one
|
||||
##with the commit without approval workflow, commit it, then restore
|
||||
##the original if it exists
|
||||
my $oldVersionTag = WebGUI::VersionTag->getWorking($session, 'noCreate');
|
||||
my $newVersionTag = WebGUI::VersionTag->create($session, { workflowId => 'pbworkflow00000000003', });
|
||||
$newVersionTag->setWorking;
|
||||
my ($oldVersionTag, $newVersionTag);
|
||||
$oldVersionTag = WebGUI::VersionTag->getWorking($session, 'noCreate');
|
||||
|
||||
if ($self->hasBeenCommitted) {
|
||||
$newVersionTag = WebGUI::VersionTag->create($session, { workflowId => 'pbworkflow00000000003', });
|
||||
$newVersionTag->setWorking;
|
||||
$newVersionTag->set({ name => 'Adding folder '. $folderName. ' to archive '. $self->getUrl});
|
||||
}
|
||||
|
||||
##Call SUPER because my addChild calls getFolder
|
||||
$folder = $self->SUPER::addChild({
|
||||
|
|
@ -332,7 +337,7 @@ sub getFolder {
|
|||
isHidden => 1,
|
||||
styleTemplateId => $self->get('styleTemplateId'),
|
||||
});
|
||||
$newVersionTag->commit();
|
||||
$newVersionTag->commit() if $newVersionTag;
|
||||
##Restore the old one, if it exists
|
||||
$oldVersionTag->setWorking() if $oldVersionTag;
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ my $topic = $defaultNode->addChild({
|
|||
my $archiveTag = WebGUI::VersionTag->getWorking($session);
|
||||
$archiveTag->commit;
|
||||
WebGUI::Test->addToCleanup($archiveTag);
|
||||
foreach my $asset ($archive, $topic) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
|
||||
my $storage1 = WebGUI::Storage->create($session);
|
||||
my $storage2 = WebGUI::Storage->create($session);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ $canPostMaker->prepare({
|
|||
fail => [1, $reader ],
|
||||
});
|
||||
|
||||
my $tests = 50
|
||||
my $tests = 51
|
||||
+ $canPostMaker->plan
|
||||
;
|
||||
plan tests => 1
|
||||
|
|
@ -95,6 +95,7 @@ $archive = $home->addChild({
|
|||
$versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
$archive = $archive->cloneFromDb;
|
||||
|
||||
isa_ok($archive, 'WebGUI::Asset::Wobject::StoryArchive', 'created StoryArchive');
|
||||
|
||||
|
|
@ -152,6 +153,17 @@ undef $sameFolder;
|
|||
$todayFolder->purge;
|
||||
is($archive->getChildCount, 0, 'leaving with an empty archive');
|
||||
|
||||
{
|
||||
my $archive2 = $home->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::StoryArchive',
|
||||
title => 'Uncommitted',
|
||||
url => 'uncommitted_archive',
|
||||
});
|
||||
my $guard = WebGUI::Test->cleanupGuard($archive2);
|
||||
my $new_folder = $archive2->getFolder;
|
||||
is $archive2->get('tagId'), $new_folder->get('tagId'), 'folder added to uncommitted archive uses the same version tag';
|
||||
}
|
||||
|
||||
################################################################
|
||||
#
|
||||
# addChild
|
||||
|
|
|
|||
|
|
@ -62,7 +62,10 @@ $creationDateSth->execute([$weekAgo, $weekStory->getId]);
|
|||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
addToCleanup($versionTag);
|
||||
WebGUI::Test->addToCleanup($versionTag);
|
||||
foreach my $asset ($archive1, $archive2) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
|
||||
my $workflow = WebGUI::Workflow->create($session,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue