diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index b10a7a1ea..828b64790 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -2559,7 +2559,7 @@ sub www_editSave { override => scalar $self->session->form->process('saveAndCommit'), allowComments => 1, returnUrl => $self->getUrl, - })) { + }) eq 'redirect') { return undef; } diff --git a/lib/WebGUI/Asset/FilePile.pm b/lib/WebGUI/Asset/FilePile.pm index d3e836cc7..f7220d9a9 100644 --- a/lib/WebGUI/Asset/FilePile.pm +++ b/lib/WebGUI/Asset/FilePile.pm @@ -199,7 +199,7 @@ sub editSave { override => scalar $self->session->form->process("saveAndCommit"), allowComments => 1, returnUrl => $self->getUrl, - })) { + }) eq 'redirect') { return undef; }; diff --git a/lib/WebGUI/Asset/Wobject/Shelf.pm b/lib/WebGUI/Asset/Wobject/Shelf.pm index 26f05a7a4..b6ba7afeb 100644 --- a/lib/WebGUI/Asset/Wobject/Shelf.pm +++ b/lib/WebGUI/Asset/Wobject/Shelf.pm @@ -388,7 +388,7 @@ sub www_importProducts { if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, { allowComments => 1, returnUrl => $self->getUrl, - })) { + }) eq 'redirect') { return undef; }; } diff --git a/lib/WebGUI/AssetBranch.pm b/lib/WebGUI/AssetBranch.pm index f20cb8c94..5ca75cb77 100644 --- a/lib/WebGUI/AssetBranch.pm +++ b/lib/WebGUI/AssetBranch.pm @@ -307,7 +307,7 @@ sub www_editBranchSave { if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, { allowComments => 1, returnUrl => $self->getUrl, - })) { + }) eq 'redirect') { return undef; }; delete $self->{_parent}; diff --git a/lib/WebGUI/AssetClipboard.pm b/lib/WebGUI/AssetClipboard.pm index fb90faf6c..c20298d91 100644 --- a/lib/WebGUI/AssetClipboard.pm +++ b/lib/WebGUI/AssetClipboard.pm @@ -222,7 +222,7 @@ sub www_copy { if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, { allowComments => 1, returnUrl => $self->getUrl, - })) { + }) eq 'redirect') { return undef; }; return $self->session->asset($self->getContainer)->www_view; diff --git a/lib/WebGUI/AssetPackage.pm b/lib/WebGUI/AssetPackage.pm index 2d10d1b41..f69dc1eac 100644 --- a/lib/WebGUI/AssetPackage.pm +++ b/lib/WebGUI/AssetPackage.pm @@ -339,7 +339,7 @@ sub www_importPackage { if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, { allowComments => 1, returnUrl => $self->getUrl, - })) { + }) eq 'redirect') { return undef; }; diff --git a/lib/WebGUI/Content/AssetManager.pm b/lib/WebGUI/Content/AssetManager.pm index 41b0102ae..c4214d25d 100644 --- a/lib/WebGUI/Content/AssetManager.pm +++ b/lib/WebGUI/Content/AssetManager.pm @@ -375,7 +375,7 @@ sub www_manage { if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 1, returnUrl => $currentAsset->getUrl, - })) { + }) eq 'redirect' ) { return undef; }; diff --git a/lib/WebGUI/VersionTag.pm b/lib/WebGUI/VersionTag.pm index 74f006007..c9e5b1be9 100644 --- a/lib/WebGUI/VersionTag.pm +++ b/lib/WebGUI/VersionTag.pm @@ -42,7 +42,8 @@ These methods are available from this class: =head2 autoCommitWorkingIfEnabled ( $session, $options ) A class method that automatically commits the working version tag if auto commit is -enabled. Returns true if the version tag was committed. +enabled. Returns 'commit' if the tag was committed, 'redirect' if a redirect for +comments was set (only possible with allowComments), or false if no action was taken. =head3 $options @@ -70,7 +71,7 @@ sub autoCommitWorkingIfEnabled { my $options = shift || {}; # need a version tag to do any auto commit my $versionTag = $class->getWorking($session, "nocreate"); - return + return undef unless $versionTag; # auto commit assets # save and commit button and site wide auto commit work the same @@ -80,13 +81,13 @@ sub autoCommitWorkingIfEnabled { ) { if ($session->setting->get("skipCommitComments") || !$options->{allowComments}) { $versionTag->requestCommit; - return 1; + return 'commit'; } else { my $url = $options->{returnUrl} || $session->url->page; $url = $session->url->append($url, "op=commitVersionTag;tagId=" . $versionTag->getId); $session->http->setRedirect($url); - return 1; + return 'redirect'; } } }