When addin a child under a parent that is not committed, adopt the parent's version tag. Fixes bug #11295
This commit is contained in:
parent
f582bfd99e
commit
310c0add71
3 changed files with 26 additions and 2 deletions
|
|
@ -11,6 +11,7 @@
|
|||
- fixed #11297: YUI Rich Editor fails to load when editing Survey in 7.7.27
|
||||
- fixed #11306: Survey i18n: Loading....
|
||||
- fixed #11307: Survey i18n #2
|
||||
- fixed #11295: asset addChild failure when parent is not committed
|
||||
|
||||
7.8.7
|
||||
- fixed #11278: Wrong test for Template::Toolkit in testEnvironment.pl
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ sub addRevision {
|
|||
|
||||
my $autoCommitId = $self->getAutoCommitWorkflowId() unless ($options->{skipAutoCommitWorkflows});
|
||||
|
||||
my $workingTag;
|
||||
my ($workingTag, $oldWorking);
|
||||
if ( $autoCommitId ) {
|
||||
$workingTag
|
||||
= WebGUI::VersionTag->create( $self->session, {
|
||||
|
|
@ -109,7 +109,9 @@ sub addRevision {
|
|||
$workingTag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
}
|
||||
else {
|
||||
my $oldWorking = WebGUI::VersionTag->getWorking($self->session, 'noCreate');
|
||||
$workingTag = WebGUI::VersionTag->new( $self->session, $parentAsset->get('tagId') );
|
||||
$workingTag->setWorking();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -163,6 +165,7 @@ sub addRevision {
|
|||
$newVersion->setVersionLock;
|
||||
$newVersion->update(\%mergedProperties);
|
||||
$newVersion->setAutoCommitTag($workingTag) if (defined $autoCommitId);
|
||||
$oldWorking->setWorking if $oldWorking;
|
||||
|
||||
return $newVersion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
|||
use WebGUI::User;
|
||||
|
||||
use WebGUI::Asset;
|
||||
use Test::More tests => 92; # increment this value for each test you create
|
||||
use Test::More tests => 93; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
# Test the methods in WebGUI::AssetLineage
|
||||
|
|
@ -526,6 +526,26 @@ $vTag2->commit;
|
|||
is($deepAsset[41]->getParent->getId, $deepAsset[40]->getId, 'addChild will not create an asset with a lineage deeper than 42 levels');
|
||||
like($WebGUI::Test::logger_warns, qr/Adding it as a sibling instead/, 'addChild logged a warning about deep assets');
|
||||
|
||||
{
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
addToCleanup($tag);
|
||||
my $uncommittedParent = $root->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Layout",
|
||||
groupIdView => 7,
|
||||
ownerUserId => 3,
|
||||
title => "Uncommitted Parent",
|
||||
});
|
||||
$tag->leaveTag;
|
||||
my $parent = WebGUI::Asset->newPending($session, $uncommittedParent->getId);
|
||||
my $floater = $parent->addChild({
|
||||
className => "WebGUI::Asset::Snippet",
|
||||
groupIdView => 7,
|
||||
ownerUserId => 3, #For coverage on addChild properties
|
||||
title => "Child of uncommitted parent",
|
||||
});
|
||||
is $parent->get('tagId'), $floater->get('tagId'), 'addChild: with uncommitted parent, adds child and puts it into the same tag as the parent';
|
||||
}
|
||||
|
||||
TODO: {
|
||||
local $TODO = "Tests to make later";
|
||||
ok(0, 'addChild');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue