public function testUpdateAndResetNotificationTimestamp() { $user = $this->getUser(); $otherUser = (new TestUser('WatchedItemIntegrationTestUser_otherUser'))->getUser(); $title = Title::newFromText('WatchedItemIntegrationTestPage'); WatchedItem::fromUserTitle($user, $title)->addWatch(); $this->assertNull(WatchedItem::fromUserTitle($user, $title)->getNotificationTimestamp()); EmailNotification::updateWatchlistTimestamp($otherUser, $title, '20150202010101'); $this->assertEquals('20150202010101', WatchedItem::fromUserTitle($user, $title)->getNotificationTimestamp()); WatchedItem::fromUserTitle($user, $title)->resetNotificationTimestamp(); $this->assertNull(WatchedItem::fromUserTitle($user, $title)->getNotificationTimestamp()); }
/** * Abort notifications regarding occupied pages coming from the RecentChange class. * Flow has its own notifications through Echo. * * Also don't notify for actions made by the talk page manager. * * @param User $editor * @param Title $title * @return bool false to abort email notification */ public static function onAbortEmailNotification($editor, $title) { if (self::$occupationController->isTalkpageOccupied($title)) { // Since we are aborting the notification we need to manually update the watchlist EmailNotification::updateWatchlistTimestamp($editor, $title, wfTimestampNow()); return false; } $talkPageManagerUser = self::$occupationController->getTalkpageManager(); if ($editor->equals($talkPageManagerUser)) { return false; } return true; }