Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/200656
Change subject: Update Wikidata ...................................................................... Update Wikidata * Fix unstyled "edit links" in client on page preview * Fix JS focus issues on Wikidata when adding statements and qualifiers * Fixes for dispatch changes, after investigating and resolving the issues from last week. * Added debugging in WikiPageEntityRevisionLookup Change-Id: I80a5bb32f33b89c51618e29e0c10e60b9746f97f --- M composer.lock M extensions/Wikibase/build/jenkins/mw-apply-wb-settings.sh M extensions/Wikibase/client/includes/Hooks/BeforePageDisplayHandler.php M extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php M extensions/Wikibase/lib/maintenance/dispatchChanges.php M extensions/Wikibase/lib/resources/jquery.wikibase/snakview/snakview.js M extensions/Wikibase/lib/resources/jquery.wikibase/toolbar/controller/definitions/addtoolbar/statementview-snakview.js M vendor/composer/installed.json 8 files changed, 63 insertions(+), 73 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata refs/changes/56/200656/1 diff --git a/composer.lock b/composer.lock index a0e9c21..45219a8 100644 --- a/composer.lock +++ b/composer.lock @@ -1237,7 +1237,7 @@ "source": { "type": "git", "url": "https://git.wikimedia.org/git/mediawiki/extensions/Wikibase.git", - "reference": "c42291f422f391dd14388859caf39857e80a4959" + "reference": "5b20f5bc1749a0e9446783cb87de283638053e98" }, "require": { "data-values/common": "~0.2.0", @@ -1306,7 +1306,7 @@ "issues": "https://bugzilla.wikimedia.org/", "irc": "irc://irc.freenode.net/wikidata" }, - "time": "2015-03-25 14:50:27" + "time": "2015-03-30 18:42:58" }, { "name": "wikibase/wikimedia-badges", diff --git a/extensions/Wikibase/build/jenkins/mw-apply-wb-settings.sh b/extensions/Wikibase/build/jenkins/mw-apply-wb-settings.sh index f840886..89fde06 100755 --- a/extensions/Wikibase/build/jenkins/mw-apply-wb-settings.sh +++ b/extensions/Wikibase/build/jenkins/mw-apply-wb-settings.sh @@ -55,7 +55,7 @@ echo "define( 'WB_EXPERIMENTAL_FEATURES', $EXPERIMENTAL );" >> LocalSettings.php } -cd $WORKSPACE +cd $WORKSPACE/src echo '<?php' >> LocalSettings.php diff --git a/extensions/Wikibase/client/includes/Hooks/BeforePageDisplayHandler.php b/extensions/Wikibase/client/includes/Hooks/BeforePageDisplayHandler.php index 12791dd..b3e0d44 100644 --- a/extensions/Wikibase/client/includes/Hooks/BeforePageDisplayHandler.php +++ b/extensions/Wikibase/client/includes/Hooks/BeforePageDisplayHandler.php @@ -68,7 +68,7 @@ private function hasEditOrAddLinks( OutputPage $out, Title $title, $actionName ) { if ( $out->getProperty( 'noexternallanglinks' ) || - $actionName !== 'view' || + !in_array( $actionName, array( 'view', 'submit' ) ) || !$title->exists() ) { return false; diff --git a/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php b/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php index ffc5d94..26f6316 100644 --- a/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php +++ b/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php @@ -92,11 +92,13 @@ } if ( $entityRevision !== null && !$entityRevision->getEntity()->getId()->equals( $entityId ) ) { - // This can happen when giving a revision ID that doesn't belong to the given entity - wfDebugLog( __CLASS__, __FUNCTION__ . ': Loaded wrong entity: Expected ' . $entityId - . ', got ' . $entityRevision->getEntity()->getId() ); + // This can happen when giving a revision ID that doesn't belong to the given entity, + // or some meta data is incorrect. + $actualEntityId = $entityRevision->getEntity()->getId()->getSerialization(); - throw new BadRevisionException( "Revision $revisionId does not belong to entity $entityId" ); + // Get the revision id we actually loaded, if none was passed explicitly + $revisionId = is_int( $revisionId ) ? $revisionId : $entityRevision->getRevisionId(); + throw new BadRevisionException( "Revision $revisionId belongs to $actualEntityId instead of expected $entityId" ); } if ( is_int( $revisionId ) && $entityRevision === null ) { diff --git a/extensions/Wikibase/lib/maintenance/dispatchChanges.php b/extensions/Wikibase/lib/maintenance/dispatchChanges.php index f2131d8..794e2b2 100644 --- a/extensions/Wikibase/lib/maintenance/dispatchChanges.php +++ b/extensions/Wikibase/lib/maintenance/dispatchChanges.php @@ -98,7 +98,7 @@ * causes a completely random selection of the target, regardless of when it * was last selected for dispatch. */ - protected $randomness = 5; + protected $randomness = 10; /** * @var bool: whether output should be version. @@ -119,7 +119,7 @@ $this->addOption( 'lock-grace-interval', "Seconds after wich to probe for orphaned locks. " . "Default: 60", false, true ); $this->addOption( 'randomness', "Number of least current target wikis to pick from at random. " - . "Default: 5.", false, true ); + . "Default: 10.", false, true ); $this->addOption( 'max-passes', "The number of passes to perform. " . "Default: 1 if --max-time is not set, infinite if it is.", false, true ); $this->addOption( 'max-time', "The number of seconds to run before exiting, " @@ -146,6 +146,7 @@ $this->delay = intval( $this->getOption( 'idle-delay', 10 ) ); $this->dispatchInterval = intval( $this->getOption( 'dispatch-interval', 60 ) ); $this->lockGraceInterval = intval( $this->getOption( 'lock-grace-interval', 60 ) ); + $this->randomness = intval( $this->getOption( 'randomness', $this->randomness ) ); $this->verbose = $this->getOption( 'verbose', false ); @@ -418,9 +419,8 @@ , __METHOD__, array( - 'ORDER BY chd_seen ASC', - 'FOR UPDATE', - 'LIMIT ' . (int)$this->randomness + 'ORDER BY' => 'chd_seen ASC', + 'LIMIT' => (int)$this->randomness ) ); @@ -860,7 +860,7 @@ // The change is relevant if it alters any sitelinks referring to $siteID, // or the item currently links to $siteID. if ( isset( $linkedItems[$itemId] ) - || $this->isRelevantChange( $change, $siteID ) !== null ) { + || $this->isRelevantChange( $change, $siteID ) ) { $filteredChanges[] = $change; $numberOfChangesFound++; diff --git a/extensions/Wikibase/lib/resources/jquery.wikibase/snakview/snakview.js b/extensions/Wikibase/lib/resources/jquery.wikibase/snakview/snakview.js index ca328aa..c870021 100644 --- a/extensions/Wikibase/lib/resources/jquery.wikibase/snakview/snakview.js +++ b/extensions/Wikibase/lib/resources/jquery.wikibase/snakview/snakview.js @@ -121,14 +121,6 @@ _isInEditMode: false, /** - * Caching whether to move the focus from the `Property` input to the value input after pressing - * the TAB key. - * @property {boolean} - * @private - */ - _tabToValueView: false, - - /** * Whether then `snakview`'s value is regarded "valid" at the moment. * @property {boolean} * @private @@ -247,9 +239,6 @@ type: 'property' } ) .prop( 'placeholder', mw.msg( 'wikibase-snakview-property-input-placeholder' ) ) - .on( 'blur', function( event ) { - self._tabToValueView = false; - } ) .on( 'eachchange', function( event, oldValue ) { // remove out-dated variations if( self._variation ) { @@ -259,29 +248,47 @@ self._trigger( 'change' ); } } ) - .on( 'entityselectorselected', function( e, entityId ) { - // Display spinner as long as the ValueView is loading: - self.$snakValue.empty().append( - $( '<div/>' ).append( $( '<span/>' ).addClass( 'mw-small-spinner' ) ) - ); - - self.options.entityStore.get( entityId ).done( function( entity ) { - self.updateVariation(); - self.drawSnakTypeSelector(); - self.drawVariation(); - - self._trigger( 'change' ); - - // Since it takes a while for the value view to gather its data from the API, - // the property might not be valid anymore aborting the rendering of the value - // view. - if( self._tabToValueView && self._variation ) { - $( self._variation ).one( 'afterdraw', function() { - self._variation.focus(); - } ); - } - } ); + .on( 'keydown', function( event ) { + // When pressing TAB, ENTER or clicking in the property input element while the value + // input element does not yet exist, we assume that the user wants to + // auto-complete/select the currently suggested property and tab into the value + // element. Since the API needs to be queried to construct the correct value input, + // the intended action needs to be cached and triggered as soon as the value input + // has been created. + if ( event.keyCode === $.ui.keyCode.TAB || event.keyCode === $.ui.keyCode.ENTER ) { + self._selectProperty(); + } + } ) + .on( 'entityselectorselected', function( event, entityId ) { + self._selectProperty(); } ); + }, + + /** + * @private + */ + _selectProperty: function() { + var self = this; + + // Display spinner as long as the ValueView is loading: + this.$snakValue.empty().append( + $( '<div/>' ).append( $( '<span/>' ).addClass( 'mw-small-spinner' ) ) + ); + + this.updateVariation(); + this.drawSnakTypeSelector(); + this.drawVariation(); + + this._trigger( 'change' ); + + // Since it takes a while for the value view to gather its data from the API, + // the property might not be valid anymore aborting the rendering of the value + // view. + if ( this._variation ) { + $( this._variation ).one( 'afterdraw', function() { + self._variation.focus(); + } ); + } }, /** @@ -307,29 +314,6 @@ var self = this; this._isInEditMode = true; - - this.element.on( 'keydown.' + this.widgetName, function( event ) { - if ( self.options.disabled ) { - return; - } - - var propertySelector = self._getPropertySelector(); - - if ( event.keyCode === $.ui.keyCode.TAB && !self._variation ) { - event.stopPropagation(); - // When pressing TAB in the property input element while the value input element - // does not yet exist, we assume that the user wants to auto-complete/select the - // currently suggested property and tab into the value element. Since the API needs - // to be queried to construct the correct value input, the intended action needs to - // be cached and triggered as soon as the value input has been created. - if ( propertySelector && event.target === propertySelector.element[0] ) { - if( self._getPropertySelector().selectedEntity() ) { - self._tabToValueView = true; - event.preventDefault(); - } - } - } - } ); if( this._variation ) { $( this._variation ).one( 'afterstartediting', function() { diff --git a/extensions/Wikibase/lib/resources/jquery.wikibase/toolbar/controller/definitions/addtoolbar/statementview-snakview.js b/extensions/Wikibase/lib/resources/jquery.wikibase/toolbar/controller/definitions/addtoolbar/statementview-snakview.js index c3936fd..c242e1b 100644 --- a/extensions/Wikibase/lib/resources/jquery.wikibase/toolbar/controller/definitions/addtoolbar/statementview-snakview.js +++ b/extensions/Wikibase/lib/resources/jquery.wikibase/toolbar/controller/definitions/addtoolbar/statementview-snakview.js @@ -29,7 +29,11 @@ .off( '.addtoolbar' ) .on( 'addtoolbaradd.addtoolbar', function( e ) { listview.enterNewItem(); - listview.value()[listview.value().length - 1].enterNewItem(); + + var snaklistview = listview.value()[listview.value().length - 1]; + snaklistview.enterNewItem().done( function() { + snaklistview.focus(); + } ); } ); toolbarController.registerEventHandler( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index ff25f42..eb7bad6 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1329,7 +1329,7 @@ "source": { "type": "git", "url": "https://git.wikimedia.org/git/mediawiki/extensions/Wikibase.git", - "reference": "c42291f422f391dd14388859caf39857e80a4959" + "reference": "5b20f5bc1749a0e9446783cb87de283638053e98" }, "require": { "data-values/common": "~0.2.0", @@ -1356,7 +1356,7 @@ "conflict": { "mediawiki/mediawiki": "<1.23" }, - "time": "2015-03-25 14:50:27", + "time": "2015-03-30 18:04:27", "type": "mediawiki-extension", "installation-source": "source", "autoload": { -- To view, visit https://gerrit.wikimedia.org/r/200656 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I80a5bb32f33b89c51618e29e0c10e60b9746f97f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikidata Gerrit-Branch: wmf/1.25wmf22 Gerrit-Owner: Aude <aude.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits