Merge "Replaces $user->isWatching call with WatchedItemStore isWatching service call"
This commit is contained in:
commit
f1aaa1ec91
|
@ -22,6 +22,8 @@
|
||||||
* @ingroup Skins
|
* @ingroup Skins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use MediaWiki\MediaWikiServices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* QuickTemplate subclass for Vector
|
* QuickTemplate subclass for Vector
|
||||||
* @ingroup Skins
|
* @ingroup Skins
|
||||||
|
@ -50,9 +52,16 @@ class VectorTemplate extends BaseTemplate {
|
||||||
|
|
||||||
// Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu
|
// Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu
|
||||||
if ( $this->config->get( 'VectorUseIconWatch' ) ) {
|
if ( $this->config->get( 'VectorUseIconWatch' ) ) {
|
||||||
$mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() )
|
$mode = ( $this->getSkin()->getRelevantTitle()->isWatchable() &&
|
||||||
? 'unwatch'
|
MediaWikiServices::getInstance()->getPermissionManager()->userHasRight(
|
||||||
: 'watch';
|
$this->getSkin()->getUser(),
|
||||||
|
'viewmywatchlist'
|
||||||
|
) &&
|
||||||
|
MediaWikiServices::getInstance()->getWatchedItemStore()->isWatched(
|
||||||
|
$this->getSkin()->getUser(),
|
||||||
|
$this->getSkin()->getRelevantTitle()
|
||||||
|
)
|
||||||
|
) ? 'unwatch' : 'watch';
|
||||||
|
|
||||||
if ( isset( $this->data['action_urls'][$mode] ) ) {
|
if ( isset( $this->data['action_urls'][$mode] ) ) {
|
||||||
$this->data['view_urls'][$mode] = $this->data['action_urls'][$mode];
|
$this->data['view_urls'][$mode] = $this->data['action_urls'][$mode];
|
||||||
|
|
Loading…
Reference in New Issue