Forbid pasting content below a shortcut, to prevent loops on purge and other operations. Fixes bug #11855.
This commit is contained in:
parent
59bd99c243
commit
4f632b27fc
4 changed files with 51 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
- fixed #11746: Thingy import CSV only supports one line ending
|
||||
- fixed #11833: Recheck for losing Product Images
|
||||
- fixed #11788: Calendar - Can't enter Midnight - Broke page layout
|
||||
- fixed #11855: Purging Shortcut from Trash causes loop
|
||||
|
||||
7.10.0
|
||||
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
||||
|
|
|
|||
|
|
@ -786,6 +786,19 @@ sub notLinked {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 paste ( )
|
||||
|
||||
Pasting assets under a Shortcut can cause lots of problems, including infinite loops
|
||||
for operations like paste, and purge.
|
||||
|
||||
=cut
|
||||
|
||||
sub paste {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 prepareView ( )
|
||||
|
||||
See WebGUI::Asset::prepareView() for details. Extends the base class to call prepareView
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ sub paste {
|
|||
return 0 unless ($self->state eq "published");
|
||||
return 0 unless ($pastedAsset->canPaste()); ##Allow pasted assets to have a say about pasting.
|
||||
|
||||
# Don't allow a shortcut to create an endless loop
|
||||
##Do not paste a shortcut immediately below the original asset
|
||||
return 0 if ($pastedAsset->isa("WebGUI::Asset::Shortcut") && $pastedAsset->shortcutToAssetId eq $self->getId);
|
||||
my $i18n=WebGUI::International->new($session, 'Asset');
|
||||
$outputSub->(sprintf $i18n->get('pasting %s'), $pastedAsset->getTitle) if defined $outputSub;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use WebGUI::Asset;
|
|||
use WebGUI::VersionTag;
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
plan tests => 27;
|
||||
plan tests => 29;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user({userId => 3});
|
||||
|
|
@ -155,3 +155,38 @@ for my $i (0..2) {
|
|||
is_tree_of_folders($clip, $i+1, $meth);
|
||||
$clip->purge;
|
||||
}
|
||||
|
||||
####################################################
|
||||
#
|
||||
# paste
|
||||
#
|
||||
####################################################
|
||||
|
||||
my $versionTag2 = WebGUI::VersionTag->getWorking($session);
|
||||
WebGUI::Test->addToCleanup($versionTag2);
|
||||
|
||||
my $page = $tempspace->addChild({
|
||||
className => 'WebGUI::Asset::Wobject::Layout',
|
||||
title => 'Parent asset',
|
||||
});
|
||||
|
||||
my $shortcut = $tempspace->addChild({
|
||||
className => 'WebGUI::Asset::Shortcut',
|
||||
shortcutToAssetId => $page->getId,
|
||||
});
|
||||
|
||||
$versionTag2->commit;
|
||||
|
||||
foreach my $asset ($page, $shortcut, ) {
|
||||
$asset = $asset->cloneFromDb;
|
||||
}
|
||||
|
||||
$shortcut->cut;
|
||||
|
||||
is $page->paste($shortcut->getId), 0, 'cannot paste a shortcut immediately below the asset it shortcuts';
|
||||
|
||||
$shortcut->publish;
|
||||
|
||||
$page->cut;
|
||||
|
||||
is $shortcut->paste($page->getId), 0, 'cannot paste below shortcuts';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue