Prevent dataform from caching when the form contains a captcha. Fixes bug #11049
This commit is contained in:
parent
26f7dd8bca
commit
0e09072bc0
3 changed files with 34 additions and 3 deletions
|
|
@ -37,6 +37,7 @@
|
||||||
- fixed failure in test 250 of t/00_compile.t
|
- fixed failure in test 250 of t/00_compile.t
|
||||||
- fixed #11084: option to view private profiles
|
- fixed #11084: option to view private profiles
|
||||||
- fixed #11082: Admin group in Visitor group?
|
- fixed #11082: Admin group in Visitor group?
|
||||||
|
- fixed #11049: form caching incorrectly
|
||||||
|
|
||||||
7.8.0
|
7.8.0
|
||||||
- upgraded YUI to 2.8.0r4
|
- upgraded YUI to 2.8.0r4
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ use WebGUI::Asset::Wobject;
|
||||||
use WebGUI::Pluggable;
|
use WebGUI::Pluggable;
|
||||||
use WebGUI::DateTime;
|
use WebGUI::DateTime;
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
|
use WebGUI::Utility;
|
||||||
use WebGUI::Group;
|
use WebGUI::Group;
|
||||||
use WebGUI::AssetCollateral::DataForm::Entry;
|
use WebGUI::AssetCollateral::DataForm::Entry;
|
||||||
use WebGUI::Form::SelectRichEditor;
|
use WebGUI::Form::SelectRichEditor;
|
||||||
|
|
@ -225,7 +226,8 @@ an entry is being viewed, bypass caching altogether.
|
||||||
|
|
||||||
sub getContentLastModified {
|
sub getContentLastModified {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
if ($self->currentView eq 'list' || $self->session->form->process('entryId')) {
|
my $hasCaptcha = isIn('Captcha', map { $_->{type} } map { $self->getFieldConfig($_) } @{ $self->getFieldOrder });
|
||||||
|
if ($self->currentView eq 'list' || $self->session->form->process('entryId') || $hasCaptcha) {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
return $self->SUPER::getContentLastModified;
|
return $self->SUPER::getContentLastModified;
|
||||||
|
|
@ -1597,7 +1599,7 @@ sub www_editFieldSave {
|
||||||
$newSelf->createField($newName, \%field);
|
$newSelf->createField($newName, \%field);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
|
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session);
|
||||||
my $freshSelf = $newSelf->cloneFromDb();
|
my $freshSelf = $newSelf->cloneFromDb();
|
||||||
if ($form->process("proceed") eq "editField") {
|
if ($form->process("proceed") eq "editField") {
|
||||||
return $freshSelf->www_editField('new');
|
return $freshSelf->www_editField('new');
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ my $df = WebGUI::Asset->getImportNode( $session )
|
||||||
fieldConfiguration => '[]',
|
fieldConfiguration => '[]',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
my $dform = WebGUI::Asset->getDefault($session)->addChild({
|
||||||
|
className => "WebGUI::Asset::Wobject::DataForm",
|
||||||
|
mailData => 0,
|
||||||
|
});
|
||||||
|
$dform->createField('gotCaptcha', { type => 'Captcha', name => 'humanCheck', });
|
||||||
|
|
||||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||||
WebGUI::Test->tagsToRollback($versionTag);
|
WebGUI::Test->tagsToRollback($versionTag);
|
||||||
$versionTag->commit;
|
$versionTag->commit;
|
||||||
|
|
@ -43,7 +49,7 @@ $versionTag->commit;
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
plan tests => 1; # Increment this number for each test you create
|
plan tests => 4; # Increment this number for each test you create
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# _createForm
|
# _createForm
|
||||||
|
|
@ -60,4 +66,26 @@ $df->_createForm(
|
||||||
|
|
||||||
is($WebGUI::Test::logger_error, "Unable to load form control - MASSIVE FORM FAILURE", '_createForm logs when it cannot load a form type');
|
is($WebGUI::Test::logger_error, "Unable to load form control - MASSIVE FORM FAILURE", '_createForm logs when it cannot load a form type');
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# getContentLastModified
|
||||||
|
|
||||||
|
sleep 3;
|
||||||
|
|
||||||
|
$df->{_mode} = 'form';
|
||||||
|
is($df->getContentLastModified, $df->get('lastModified'), 'getContentLastModified: form normally returns lastModified');
|
||||||
|
$df->{_mode} = 'list';
|
||||||
|
cmp_ok(
|
||||||
|
$df->getContentLastModified,
|
||||||
|
'>',
|
||||||
|
$df->get('lastModified'),
|
||||||
|
'... form in list mode does not return lastModified'
|
||||||
|
);
|
||||||
|
$dform->{_mode} = 'form';
|
||||||
|
cmp_ok(
|
||||||
|
$dform->getContentLastModified,
|
||||||
|
'>',
|
||||||
|
$dform->get('lastModified'),
|
||||||
|
'... form with a captcha does not return lastModified, even in form mode'
|
||||||
|
);
|
||||||
|
|
||||||
#vim:ft=perl
|
#vim:ft=perl
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue