mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 09:30:17 +00:00
Replaces $user->isWatching call with WatchedItemStore isWatching service call
Bug: T208766 Change-Id: I178b1a1aa0106d82f1b336f2bda5c6371468d741
This commit is contained in:
parent
05aab42559
commit
2fce68778c
|
@ -22,6 +22,8 @@
|
|||
* @ingroup Skins
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* QuickTemplate subclass for Vector
|
||||
* @ingroup Skins
|
||||
|
@ -41,9 +43,16 @@ class VectorTemplate extends BaseTemplate {
|
|||
|
||||
// Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu
|
||||
if ( $this->config->get( 'VectorUseIconWatch' ) ) {
|
||||
$mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() )
|
||||
? 'unwatch'
|
||||
: 'watch';
|
||||
$mode = ( $this->getSkin()->getRelevantTitle()->isWatchable() &&
|
||||
MediaWikiServices::getInstance()->getPermissionManager()->userHasRight(
|
||||
$this->getSkin()->getUser(),
|
||||
'viewmywatchlist'
|
||||
) &&
|
||||
MediaWikiServices::getInstance()->getWatchedItemStore()->isWatched(
|
||||
$this->getSkin()->getUser(),
|
||||
$this->getSkin()->getRelevantTitle()
|
||||
)
|
||||
) ? 'unwatch' : 'watch';
|
||||
|
||||
if ( isset( $this->data['action_urls'][$mode] ) ) {
|
||||
$this->data['view_urls'][$mode] = $this->data['action_urls'][$mode];
|
||||
|
|
Loading…
Reference in a new issue