public function thread()
 {
     wfProfileIn(__METHOD__);
     $this->addAsset();
     $title = $this->request->getVal('title', $this->app->wg->Title);
     $id = $this->request->getVal('id', null);
     $this->getThread($id);
     $this->response->setVal('showNewMessage', false);
     $this->response->setVal('type', 'Thread');
     $this->response->setVal('condenseMessage', false);
     if (count($this->threads) > 0) {
         $wn = new WallNotifications();
         foreach ($this->threads as $key => $val) {
             $all = $wn->markRead($this->wg->User->getId(), $this->wg->CityId, $key);
             break;
         }
     }
     $this->response->setVal('renderUserTalkArchiveAnchor', false);
     $this->response->setVal('greeting', '');
     $title = Title::newFromId($id);
     if (!empty($title) && $title->exists() && in_array(MWNamespace::getSubject($title->getNamespace()), $this->app->wg->WallNS)) {
         $wallMessage = WallMessage::newFromTitle($title);
         $wallMessage->load();
         $this->app->wg->Out->setPageTitle($wallMessage->getMetaTitle());
     }
     // TODO: keep the varnish cache and do purging on post
     $this->response->setCacheValidity(WikiaResponse::CACHE_DISABLED);
     wfProfileOut(__METHOD__);
 }
 public function processEntities($userId, $entityKey)
 {
     if (!$this->getEntityProcessed($userId, $entityKey)) {
         $notification = WallNotificationEntity::createFromId($entityKey);
         if (!empty($notification)) {
             $wn = new WallNotifications();
             $wn->addNotificationLinks([$userId], $notification);
         }
         $this->setEntityProcessed($userId, $entityKey);
     }
 }
 private function getUpdateWikiInternal(WallNotifications $wn, $wikiId, $isCrossWiki = false)
 {
     if ($isCrossWiki) {
         $all = $wn->getWikiNotifications($this->wg->User->getId(), $wikiId, 0);
     } else {
         $all = $wn->getWikiNotifications($this->wg->User->getId(), $wikiId, 5, false, true);
     }
     $this->response->setVal('html', $this->app->renderView('WallNotifications', 'UpdateWiki', array('notifications' => $all)));
     $this->response->setVal('unread', $all['unread_count']);
     $this->response->setVal('status', true);
 }
 private function getUpdateWikiInternal(WallNotifications $wn, $wikiId, $isCrossWiki = false)
 {
     global $wgUser;
     if ($isCrossWiki) {
         $all = $wn->getWikiNotifications($wgUser->getId(), $wikiId, 0);
     } else {
         $all = $wn->getWikiNotifications($wgUser->getId(), $wikiId, 5, false, true);
     }
     $this->response->setVal('html', $this->app->renderView($this->controllerName, 'UpdateWiki', ['notifications' => $all]));
     $this->response->setVal('unread', $all['unread_count']);
     $this->response->setVal('status', true);
     $this->response->setCachePolicy(WikiaResponse::CACHE_PRIVATE);
     $this->response->setCacheValidity(WikiaResponse::CACHE_DISABLED);
 }
Пример #5
0
 public function restore($user, $reason = '')
 {
     $this->unMarkInProps(WPP_WALL_REMOVE);
     $this->unMarkInProps(WPP_WALL_ADMINDELETE);
     $this->customActionNotifyRC($user, 'wall_restore', $reason);
     $wne = $this->getAdminNotificationEntity($user, $reason);
     $wh = F::build('WallHistory', array($this->cityId));
     $wh->add(WH_RESTORE, $wne, $user);
     $this->addWatch($user);
     $wn = new WallNotifications();
     if ($this->isMain()) {
         $wn->unhideNotificationsForUniqueID($this->cityId, $this->getId());
         $this->getWall()->invalidateCache();
         $wna = new WallNotificationsAdmin();
         $wna->removeForThread($this->cityId, $this->getId());
         $wno = new WallNotificationsOwner();
         $wno->removeForThread($this->cityId, $this->getWallOwner()->getId(), $this->getId());
     } else {
         $this->getThread()->invalidateCache();
         $wna = new WallNotificationsAdmin();
         $wna->removeForReply($this->cityId, $this->getId());
         $wno = new WallNotificationsOwner();
         $wno->removeForReply($this->cityId, $this->getWallOwner()->getId(), $this->getId());
     }
 }
Пример #6
0
 public function addNotificationToData(&$data, $userId, $wikiId, $uniqueId, $entityKey, $authorId, $isReply, $read = false, $notifyeveryone = false)
 {
     return parent::addNotificationToData($data, $userId, $wikiId, $uniqueId, $entityKey, $authorId, $isReply, $read, $notifyeveryone);
 }
 public function replyToMessage()
 {
     $this->response->setVal('status', true);
     $parentId = $this->request->getVal('parent');
     $parentTitle = Title::newFromId($parentId);
     $debugParentDB = 'from slave';
     // tracing bug 95249
     if (empty($parentTitle)) {
         // try again from master
         $parentTitle = Title::newFromId($parentId, Title::GAID_FOR_UPDATE);
         $debugParentDB = 'from master';
     }
     if (empty($parentTitle)) {
         $this->response->setVal('status', false);
         return true;
     }
     Wikia::log(__METHOD__, false, 'Wall::replyToMessage for parent ' . $parentTitle->getFullUrl() . ' (parentId: ' . $parentId . ') ' . $debugParentDB, true);
     /**
      * @var $wallMessage WallMessage
      */
     $wallMessage = WallMessage::newFromTitle($parentTitle);
     $body = $this->getConvertedContent($this->request->getVal('body'));
     $reply = $wallMessage->addNewReply($body, $this->wg->User);
     if ($reply === false) {
         $this->response->setVal('status', false);
         return true;
     }
     $quotedFrom = $this->request->getVal('quotedFrom');
     if (!empty($quotedFrom)) {
         $reply->setQuoteOf($quotedFrom);
     }
     $this->replyToMessageBuildResponse($this, $reply);
     // after successfully posting a reply
     // remove notification for this thread (if user is following it)
     /**
      * @var $wn WallNotifications
      */
     $wn = new WallNotifications();
     $wn->markRead($this->wg->User->getId(), $this->wg->CityId, $this->request->getVal('parent'));
 }
Пример #8
0
 public function sendNotification($revOldId, $rcType = RC_NEW, $useMasterDB = false)
 {
     $app = F::App();
     $rev = Revision::newFromId($revOldId);
     $notif = WallNotificationEntity::createFromRev($rev, $useMasterDB);
     $wh = new WallHistory($app->wg->CityId);
     $wh->add($rcType == RC_NEW ? WH_NEW : WH_EDIT, $notif, $app->wg->User);
     if ($rcType == RC_NEW) {
         $wn = new WallNotifications();
         $wn->addNotification($notif);
     }
 }
Пример #9
0
 public function addNotificationToData(&$data, $userId, $wikiId, $notificationData)
 {
     parent::addNotificationToData($data, $userId, $wikiId, $notificationData);
 }