Foxtrott has submitted this change and it was merged.
Change subject: bugfixes (preload not working; normalization of empty form
names)
......................................................................
bugfixes (preload not working; normalization of empty form names)
* followup Ifa72f031b: fix preloading
* followup Iba10dc4bc: do not try normalizing empty page names
Change-Id: I0ecc0f19bbc04771398393ab8edb1c5852d7e15a
---
M includes/SF_AutoeditAPI.php
M specials/SF_FormEdit.php
2 files changed, 23 insertions(+), 8 deletions(-)
Approvals:
Foxtrott: Verified; Looks good to me, approved
jenkins-bot: Checked
diff --git a/includes/SF_AutoeditAPI.php b/includes/SF_AutoeditAPI.php
index 4a600b0..2ab2208 100644
--- a/includes/SF_AutoeditAPI.php
+++ b/includes/SF_AutoeditAPI.php
@@ -205,8 +205,16 @@
}
// Normalize form and target names
- $this->mOptions[ 'form' ] = Title::newFromText(
$this->mOptions[ 'form' ] )->getPrefixedText();
- $this->mOptions[ 'target' ] = Title::newFromText(
$this->mOptions[ 'target' ] )->getPrefixedText();
+
+ $form = Title::newFromText( $this->mOptions[ 'form' ] );
+ if ( $form !== null ) {
+ $this->mOptions[ 'form' ] = $form->getPrefixedText();
+ }
+
+ $target = Title::newFromText( $this->mOptions[ 'target' ] );
+ if ( $target !== null ) {
+ $this->mOptions[ 'target' ] =
$target->getPrefixedText();
+ }
wfRunHooks( 'sfSetTargetName', array( &$this->mOptions[
'target' ], $hookQuery ) );
diff --git a/specials/SF_FormEdit.php b/specials/SF_FormEdit.php
index 2563edc..e0b9dde 100644
--- a/specials/SF_FormEdit.php
+++ b/specials/SF_FormEdit.php
@@ -73,12 +73,19 @@
$module->setOption( 'form', $form_name );
$module->setOption( 'target', $target_name );
- // if the page was submitted, formdata should be complete => do
not preload
- $module->setOption( 'preload',
- !$wgRequest->getCheck( 'wpSave' ) &&
- !$wgRequest->getCheck( 'wpPreview' ) &&
- !$wgRequest->getCheck( 'wpDiff' )
- );
+ if ( $wgRequest->getCheck( 'wpSave' ) || $wgRequest->getCheck(
'wpPreview' ) || $wgRequest->getCheck( 'wpDiff' ) ) {
+ // if the page was submitted, formdata should be
complete => do not preload
+ $module->setOption( 'preload', false );
+ } else if ( !empty($target_name) && Title::newFromText(
$target_name )->exists ( ) ) {
+ // if target page exists do not overwrite it with
preload data, just preload the page's data
+ $module->setOption( 'preload', true );
+ } else if ( $wgRequest->getCheck( 'preload' ) ) {
+ // if page does not exist and preload parameter is set,
pass that on
+ $module->setOption( 'preload', $wgRequest->getText(
'preload' ) );
+ } else {
+ // nothing set, so do not preload
+ $module->setOption( 'preload', false );
+ }
$module->execute();
--
To view, visit https://gerrit.wikimedia.org/r/49858
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0ecc0f19bbc04771398393ab8edb1c5852d7e15a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Foxtrott <[email protected]>
Gerrit-Reviewer: Foxtrott <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits