jenkins-bot has submitted this change and it was merged.

Change subject: Stop using deprecated WatchedItem methods
......................................................................


Stop using deprecated WatchedItem methods

Change-Id: Ib9502202be3c73f9d3f253b310f35901e1c88cd4
---
M includes/Data/Listener/WatchTopicListener.php
M tests/phpunit/Notifications/NotifiedUsersTest.php
M tests/phpunit/api/ApiWatchTopicTest.php
3 files changed, 13 insertions(+), 8 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Data/Listener/WatchTopicListener.php 
b/includes/Data/Listener/WatchTopicListener.php
index db8833b..f6cc27a 100644
--- a/includes/Data/Listener/WatchTopicListener.php
+++ b/includes/Data/Listener/WatchTopicListener.php
@@ -116,7 +116,7 @@
                        }
                        $title = $workflow->getArticleTitle();
 
-                       WatchedItem::fromUserTitle( $user, $title )->addWatch();
+                       $user->addWatch( $title );
                        $this->watchedTopicItems->addOverrideWatched( $title );
                }
        }
diff --git a/tests/phpunit/Notifications/NotifiedUsersTest.php 
b/tests/phpunit/Notifications/NotifiedUsersTest.php
index 84a6c52..0b3b95c 100644
--- a/tests/phpunit/Notifications/NotifiedUsersTest.php
+++ b/tests/phpunit/Notifications/NotifiedUsersTest.php
@@ -45,7 +45,9 @@
                        return;
                }
 
-               WatchedItem::fromUserTitle( $data['user'], 
$data['topicWorkflow']->getArticleTitle() )->addWatch();
+               /** @var User $user */
+               $user = $data['user'];
+               $user->addWatch( $data['topicWorkflow']->getArticleTitle() );
 
                $events = $data['notificationController']->notifyPostChange( 
'flow-post-reply',
                        array(
@@ -57,7 +59,7 @@
                                'revision' => $data['post-2'],
                        ) );
 
-               $this->assertNotifiedUser( $events, $data['user'], 
$data['agent'] );
+               $this->assertNotifiedUser( $events, $user, $data['agent'] );
        }
 
        public function testWatchingBoard() {
@@ -67,7 +69,9 @@
                        return;
                }
 
-               WatchedItem::fromUserTitle( $data['user'], 
$data['boardWorkflow']->getArticleTitle() )->addWatch();
+               /** @var User $user */
+               $user = $data['user'];
+               $user->addWatch( $data['boardWorkflow']->getArticleTitle() );
 
                $events = $data['notificationController']->notifyNewTopic( 
array(
                        'board-workflow' => $data['boardWorkflow'],
@@ -77,7 +81,7 @@
                        'user' => $data['agent'],
                ) );
 
-               $this->assertNotifiedUser( $events, $data['user'], 
$data['agent'] );
+               $this->assertNotifiedUser( $events, $user, $data['agent'] );
        }
 
        protected function assertNotifiedUser( array $events, User 
$notifiedUser, User $notNotifiedUser ) {
diff --git a/tests/phpunit/api/ApiWatchTopicTest.php 
b/tests/phpunit/api/ApiWatchTopicTest.php
index b18e4d3..cb1da6c 100644
--- a/tests/phpunit/api/ApiWatchTopicTest.php
+++ b/tests/phpunit/api/ApiWatchTopicTest.php
@@ -3,6 +3,7 @@
 namespace Flow\Tests\Api;
 
 use Title;
+use User;
 use WatchedItem;
 
 /**
@@ -18,7 +19,7 @@
                                // expected key in api result
                                'watched',
                                // initialization
-                               function( WatchedItem $item ) { 
$item->removeWatch(); },
+                               function( User $user, Title $title ) { 
$user->removeWatch( $title, false ); },
                                // extra request parameters
                                array(),
                        ),
@@ -27,7 +28,7 @@
                                // expected key in api result
                                'unwatched',
                                // initialization
-                               function( WatchedItem $item ) { 
$item->addWatch(); },
+                               function( User $user, Title $title ) { 
$user->addWatch( $title, false ); },
                                // extra request parameters
                                array( 'unwatch' => 1 ),
                        ),
@@ -41,7 +42,7 @@
                $topic = $this->createTopic();
 
                $title = Title::newFromText( $topic['topic-page'] );
-               $init( WatchedItem::fromUserTitle( 
self::$users['sysop']->getUser(), $title, false ) );
+               $init( self::$users['sysop']->getUser(), $title );
 
                // issue a watch api request
                $data = $this->doApiRequest( $request + array(

-- 
To view, visit https://gerrit.wikimedia.org/r/286921
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9502202be3c73f9d3f253b310f35901e1c88cd4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to