[MediaWiki-commits] [Gerrit] Show/hide the wikibase watchlist entries server side - change (mediawiki...Wikibase)
Anja Jentzsch has submitted this change and it was merged. Change subject: Show/hide the wikibase watchlist entries server side .. Show/hide the wikibase watchlist entries server side (Requires I79811e9f3e7431e3403cf93674667d624d3d4db2) patchset 8: fixed & improved selenium tests Change-Id: I267a755a70cdc7d4937ab70364b34e73da780ef0 --- M client/WikibaseClient.hooks.php M client/WikibaseClient.php M client/resources/Resources.php D client/resources/wbclient.watchlist.css D client/resources/wbclient.watchlist.js D client/tests/qunit/wbclient.watchlist.tests.js M client/tests/selenium/special/client_rc_and_wl_spec.rb M selenium/lib/pages/watchlist_page.rb 8 files changed, 53 insertions(+), 301 deletions(-) Approvals: Anja Jentzsch: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index 1396a58..21badcf 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -97,32 +97,6 @@ } /** -* Add new javascript testing modules. This is called after the addition of MediaWiki core test suites. -* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules -* -* @since 0.4 -* -* @param array &$testModules -* @param \ResourceLoader &$resourceLoader -* -* @return boolean -*/ -public static function onRegisterQUnitTests( array &$testModules, \ResourceLoader &$resourceLoader ) { - $testModules['qunit']['wikibase.client.watchlist.test'] = array( - 'scripts' => array( - 'tests/qunit/wbclient.watchlist.tests.js' - ), - 'dependencies' => array( - 'wbclient.watchlist', - 'wbclient.watchlist.css' - ), - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'Wikibase/client' - ); - return true; - } - - /** * Deletes all the data stored on the repository. * * @since 0.2 @@ -503,7 +477,12 @@ wfProfileIn( __METHOD__ ); - if ( $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false ) { + if ( + // Don't act on activated enhanced watchlist + $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false && + // Or in case the user disabled it + $wgRequest->getBool( 'hideWikibase', !$wgUser->getOption( 'wlshowwikibase' ) ) === false + ) { $dbr = wfGetDB( DB_SLAVE ); $newConds = array(); @@ -718,29 +697,6 @@ } /** -* Adds a JS stuff that provides a toggle for wikibase edits on the watchlist -* -* @param \SpecialPage $special -* @param string $subpage -* -* @return bool -*/ - public static function onSpecialPageBeforeExecute( \SpecialPage $special, $subpage ) { - if ( $special->getName() === 'Watchlist' ) { - $context = $special->getContext(); - - if ( $context->getRequest()->getBool( 'enhanced', $context->getUser()->getOption( 'usenewrc' ) ) === false ) { - $special->getOutput()->addModules( array( - 'wbclient.watchlist.css', - 'wbclient.watchlist', - ) ); - } - } - - return true; - } - - /** * Register the parser functions. * * @param $parser \Parser @@ -776,4 +732,27 @@ return true; } + /** +* Modifies watchlist options to show a toggle for Wikibase changes +* @see https://www.mediawiki.org/wiki/Manual:Hooks/SpecialWatchlistFilters +* +* @since 0.4 +* +* @param SpecialWatchlist $special +* @param array $filters +* +* @return bool +*/ + public static function onSpecialWatchlistFilters( $special, &$filters ) { + $user = $special->getContext()->getUser(); + + if ( $special->getContext()->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) ) === false ) { + // Allow toggling wikibase changes in case the enhanced watchlist is disabled + $filters['hideWikibase'] = array( + 'msg' => 'wikibase-rc-hide-wikidata', + 'default' => !$user->getBoolOption( 'wlshowwikibase' ) +
[MediaWiki-commits] [Gerrit] Show/hide the wikibase watchlist entries server side - change (mediawiki...Wikibase)
Anja Jentzsch has uploaded a new change for review. https://gerrit.wikimedia.org/r/54836 Change subject: Show/hide the wikibase watchlist entries server side .. Show/hide the wikibase watchlist entries server side (Requires I79811e9f3e7431e3403cf93674667d624d3d4db2) patchset 8: fixed & improved selenium tests Change-Id: I267a755a70cdc7d4937ab70364b34e73da780ef0 --- M client/WikibaseClient.hooks.php M client/WikibaseClient.php M client/resources/Resources.php D client/resources/wbclient.watchlist.css D client/resources/wbclient.watchlist.js D client/tests/qunit/wbclient.watchlist.tests.js M client/tests/selenium/special/client_rc_and_wl_spec.rb M selenium/lib/pages/watchlist_page.rb 8 files changed, 53 insertions(+), 301 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/36/54836/1 diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index 1396a58..21badcf 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -97,32 +97,6 @@ } /** -* Add new javascript testing modules. This is called after the addition of MediaWiki core test suites. -* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules -* -* @since 0.4 -* -* @param array &$testModules -* @param \ResourceLoader &$resourceLoader -* -* @return boolean -*/ -public static function onRegisterQUnitTests( array &$testModules, \ResourceLoader &$resourceLoader ) { - $testModules['qunit']['wikibase.client.watchlist.test'] = array( - 'scripts' => array( - 'tests/qunit/wbclient.watchlist.tests.js' - ), - 'dependencies' => array( - 'wbclient.watchlist', - 'wbclient.watchlist.css' - ), - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'Wikibase/client' - ); - return true; - } - - /** * Deletes all the data stored on the repository. * * @since 0.2 @@ -503,7 +477,12 @@ wfProfileIn( __METHOD__ ); - if ( $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false ) { + if ( + // Don't act on activated enhanced watchlist + $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false && + // Or in case the user disabled it + $wgRequest->getBool( 'hideWikibase', !$wgUser->getOption( 'wlshowwikibase' ) ) === false + ) { $dbr = wfGetDB( DB_SLAVE ); $newConds = array(); @@ -718,29 +697,6 @@ } /** -* Adds a JS stuff that provides a toggle for wikibase edits on the watchlist -* -* @param \SpecialPage $special -* @param string $subpage -* -* @return bool -*/ - public static function onSpecialPageBeforeExecute( \SpecialPage $special, $subpage ) { - if ( $special->getName() === 'Watchlist' ) { - $context = $special->getContext(); - - if ( $context->getRequest()->getBool( 'enhanced', $context->getUser()->getOption( 'usenewrc' ) ) === false ) { - $special->getOutput()->addModules( array( - 'wbclient.watchlist.css', - 'wbclient.watchlist', - ) ); - } - } - - return true; - } - - /** * Register the parser functions. * * @param $parser \Parser @@ -776,4 +732,27 @@ return true; } + /** +* Modifies watchlist options to show a toggle for Wikibase changes +* @see https://www.mediawiki.org/wiki/Manual:Hooks/SpecialWatchlistFilters +* +* @since 0.4 +* +* @param SpecialWatchlist $special +* @param array $filters +* +* @return bool +*/ + public static function onSpecialWatchlistFilters( $special, &$filters ) { + $user = $special->getContext()->getUser(); + + if ( $special->getContext()->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) ) === false ) { + // Allow toggling wikibase changes in case the enhanced watchlist is disabled + $filters['hideWikibase'] = array( + 'msg' => 'wikibase-rc-hide-wikidata', + 'default' => !$user->ge
[MediaWiki-commits] [Gerrit] Show/hide the wikibase watchlist entries server side - change (mediawiki...Wikibase)
Aude has submitted this change and it was merged. Change subject: Show/hide the wikibase watchlist entries server side .. Show/hide the wikibase watchlist entries server side (Requires I79811e9f3e7431e3403cf93674667d624d3d4db2) patchset 8: fixed & improved selenium tests Change-Id: I267a755a70cdc7d4937ab70364b34e73da780ef0 --- M client/WikibaseClient.hooks.php M client/WikibaseClient.php M client/resources/Resources.php D client/resources/wbclient.watchlist.css D client/resources/wbclient.watchlist.js D client/tests/qunit/wbclient.watchlist.tests.js M client/tests/selenium/special/client_rc_and_wl_spec.rb M selenium/lib/pages/watchlist_page.rb 8 files changed, 53 insertions(+), 301 deletions(-) Approvals: Tobias Gritschacher: Verified Aude: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index c466e25..b3081f7 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -97,32 +97,6 @@ } /** -* Add new javascript testing modules. This is called after the addition of MediaWiki core test suites. -* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules -* -* @since 0.4 -* -* @param array &$testModules -* @param \ResourceLoader &$resourceLoader -* -* @return boolean -*/ -public static function onRegisterQUnitTests( array &$testModules, \ResourceLoader &$resourceLoader ) { - $testModules['qunit']['wikibase.client.watchlist.test'] = array( - 'scripts' => array( - 'tests/qunit/wbclient.watchlist.tests.js' - ), - 'dependencies' => array( - 'wbclient.watchlist', - 'wbclient.watchlist.css' - ), - 'localBasePath' => __DIR__, - 'remoteExtPath' => 'Wikibase/client' - ); - return true; - } - - /** * Deletes all the data stored on the repository. * * @since 0.2 @@ -503,7 +477,12 @@ wfProfileIn( __METHOD__ ); - if ( $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false ) { + if ( + // Don't act on activated enhanced watchlist + $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false && + // Or in case the user disabled it + $wgRequest->getBool( 'hideWikibase', !$wgUser->getOption( 'wlshowwikibase' ) ) === false + ) { $dbr = wfGetDB( DB_SLAVE ); $newConds = array(); @@ -716,29 +695,6 @@ } /** -* Adds a JS stuff that provides a toggle for wikibase edits on the watchlist -* -* @param \SpecialPage $special -* @param string $subpage -* -* @return bool -*/ - public static function onSpecialPageBeforeExecute( \SpecialPage $special, $subpage ) { - if ( $special->getName() === 'Watchlist' ) { - $context = $special->getContext(); - - if ( $context->getRequest()->getBool( 'enhanced', $context->getUser()->getOption( 'usenewrc' ) ) === false ) { - $special->getOutput()->addModules( array( - 'wbclient.watchlist.css', - 'wbclient.watchlist', - ) ); - } - } - - return true; - } - - /** * Register the parser functions. * * @param $parser \Parser @@ -774,4 +730,27 @@ return true; } + /** +* Modifies watchlist options to show a toggle for Wikibase changes +* @see https://www.mediawiki.org/wiki/Manual:Hooks/SpecialWatchlistFilters +* +* @since 0.4 +* +* @param SpecialWatchlist $special +* @param array $filters +* +* @return bool +*/ + public static function onSpecialWatchlistFilters( $special, &$filters ) { + $user = $special->getContext()->getUser(); + + if ( $special->getContext()->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) ) === false ) { + // Allow toggling wikibase changes in case the enhanced watchlist is disabled + $filters['hideWikibase'] = array( + 'msg' => 'wikibase-rc-hide-wikidata', + 'default' => !$user->getBoolOption( 'wlshowwikibase
[MediaWiki-commits] [Gerrit] Show/hide the wikibase watchlist entries server side - change (mediawiki...Wikibase)
Hoo man has uploaded a new change for review. https://gerrit.wikimedia.org/r/53414 Change subject: Show/hide the wikibase watchlist entries server side .. Show/hide the wikibase watchlist entries server side (Requires I79811e9f3e7431e3403cf93674667d624d3d4db2) Change-Id: I267a755a70cdc7d4937ab70364b34e73da780ef0 --- M client/WikibaseClient.hooks.php M client/WikibaseClient.php M client/resources/Resources.php D client/resources/wbclient.watchlist.css D client/resources/wbclient.watchlist.js 5 files changed, 29 insertions(+), 150 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/14/53414/1 diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index 60f4945..bc3fec2 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -488,14 +488,19 @@ wfProfileIn( __METHOD__ ); - if ( $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false ) { + if ( + // Don't act on activated enhanced watchlist + $wgRequest->getBool( 'enhanced', $wgUser->getOption( 'usenewrc' ) ) === false && + // Or in case the user disabled it + $wgRequest->getBool( 'hideWikibase', !$wgUser->getOption( 'wlshowwikibase' ) ) === false + ) { $dbr = wfGetDB( DB_SLAVE ); $newConds = array(); foreach( $conds as $k => $v ) { if ( $v === 'rc_this_oldid=page_latest OR rc_type=3' ) { $where = array( - 'rc_this_oldid=page_latest', + 'rc_this_oldid' => 'page_latest', 'rc_type' => array( 3, 5 ) ); $newConds[$k] = $dbr->makeList( $where, LIST_OR ); @@ -701,29 +706,6 @@ } /** -* Adds a JS stuff that provides a toggle for wikibase edits on the watchlist -* -* @param \SpecialPage $special -* @param string $subpage -* -* @return bool -*/ - public static function onSpecialPageBeforeExecute( \SpecialPage $special, $subpage ) { - if ( $special->getName() === 'Watchlist' ) { - $context = $special->getContext(); - - if ( $context->getRequest()->getBool( 'enhanced', $context->getUser()->getOption( 'usenewrc' ) ) === false ) { - $special->getOutput()->addModules( array( - 'wbclient.watchlist.css', - 'wbclient.watchlist', - ) ); - } - } - - return true; - } - - /** * Register the parser function. * @param $parser \Parser * @return bool @@ -752,4 +734,25 @@ return true; } + /** +* Modifies watchlist options to show a toggle for Wikibase changes +* @see https://www.mediawiki.org/wiki/Manual:Hooks/SpecialWatchlistFilters +* +* @since 0.4 +* +* @param SpecialWatchlist $special +* @param array $filters +* +* @return bool +*/ + public static function onSpecialWatchlistFilters( $special, &$filters ) { + $user = $special->getContext()->getUser(); + + $filters['hideWikibase'] = array( + 'msg' => 'wikibase-rc-hide-wikidata', + 'default' => !$user->getBoolOption( 'wlshowwikibase' ) + ); + + return true; + } } diff --git a/client/WikibaseClient.php b/client/WikibaseClient.php index 671d677..b773b02 100644 --- a/client/WikibaseClient.php +++ b/client/WikibaseClient.php @@ -110,7 +110,7 @@ $wgHooks['SpecialRecentChangesFilters'][] = '\Wikibase\ClientHooks::onSpecialRecentChangesFilters'; $wgHooks['GetPreferences'][] = '\Wikibase\ClientHooks::onGetPreferences'; $wgHooks['BeforePageDisplay'][]= '\Wikibase\ClientHooks::onBeforePageDisplay'; -$wgHooks['SpecialPageBeforeExecute'][] = '\Wikibase\ClientHooks::onSpecialPageBeforeExecute'; +$wgHooks['SpecialWatchlistFilters'][] = '\Wikibase\ClientHooks::onSpecialWatchlistFilters'; // extension hooks $wgHooks['WikibasePollHandle'][]= '\Wikibase\ClientHooks::onWikibasePollHandle'; diff --git a/client/resources/Resources.php b/client/resources/Resources.php index a8103c4..d4a652a 100644 --- a/client/resourc