private function indexComment(ConpherenceThread $thread, ConpherenceTransaction $xaction)
 {
     $previous = id(new ConpherenceTransactionQuery())->setViewer($this->getViewer())->withObjectPHIDs(array($thread->getPHID()))->withTransactionTypes(array(PhabricatorTransactions::TYPE_COMMENT))->setAfterID($xaction->getID())->setLimit(1)->executeOne();
     $index = id(new ConpherenceIndex())->setThreadPHID($thread->getPHID())->setTransactionPHID($xaction->getPHID())->setPreviousTransactionPHID($previous ? $previous->getPHID() : null)->setCorpus($xaction->getComment()->getContent());
     queryfx($index->establishConnection('w'), 'INSERT INTO %T
     (threadPHID, transactionPHID, previousTransactionPHID, corpus)
     VALUES (%s, %s, %ns, %s)
     ON DUPLICATE KEY UPDATE corpus = VALUES(corpus)', $index->getTableName(), $index->getThreadPHID(), $index->getTransactionPHID(), $index->getPreviousTransactionPHID(), $index->getCorpus());
 }
コード例 #2
0
 private function renderThread(ConpherenceThread $thread)
 {
     $user = $this->getUser();
     $uri = $this->baseURI . $thread->getID() . '/';
     $data = $thread->getDisplayData($user);
     $title = $data['title'];
     $subtitle = $data['subtitle'];
     $unread_count = $data['unread_count'];
     $epoch = $data['epoch'];
     $image = $data['image'];
     $dom_id = $thread->getPHID() . '-nav-item';
     return id(new ConpherenceMenuItemView())->setUser($user)->setTitle($title)->setSubtitle($subtitle)->setHref($uri)->setEpoch($epoch)->setImageURI($image)->setUnreadCount($unread_count)->setID($thread->getPHID() . '-nav-item')->addSigil('conpherence-menu-click')->setMetadata(array('title' => $data['js_title'], 'id' => $dom_id, 'threadID' => $thread->getID()));
 }
コード例 #3
0
 private function renderThread(ConpherenceThread $thread, array $policy_objects)
 {
     $user = $this->getUser();
     $uri = '/' . $thread->getMonogram();
     $data = $thread->getDisplayData($user);
     $icon = id(new PHUIIconView())->addClass('msr')->setIcon($thread->getPolicyIconName($policy_objects));
     $title = phutil_tag('span', array(), array($icon, $data['title']));
     $subtitle = $data['subtitle'];
     $unread_count = $data['unread_count'];
     $epoch = $data['epoch'];
     $image = $data['image'];
     $dom_id = $thread->getPHID() . '-nav-item';
     return id(new ConpherenceMenuItemView())->setUser($user)->setTitle($title)->setSubtitle($subtitle)->setHref($uri)->setEpoch($epoch)->setImageURI($image)->setUnreadCount($unread_count)->setID($thread->getPHID() . '-nav-item')->addSigil('conpherence-menu-click')->setMetadata(array('title' => $data['title'], 'id' => $dom_id, 'threadID' => $thread->getID()));
 }
コード例 #4
0
 private function renderThread(ConpherenceThread $thread, array $policy_objects)
 {
     $user = $this->getUser();
     $uri = '/' . $thread->getMonogram();
     $data = $thread->getDisplayData($user);
     $icon = id(new PHUIIconView())->addClass('msr')->setIcon($thread->getPolicyIconName($policy_objects));
     $title = phutil_tag('span', array(), array($icon, $data['title']));
     $subtitle = $data['subtitle'];
     $unread_count = $data['unread_count'];
     $epoch = $data['epoch'];
     $image = $data['image'];
     $dom_id = $thread->getPHID() . '-nav-item';
     $glyph_pref = PhabricatorUserPreferences::PREFERENCE_TITLES;
     $preferences = $user->loadPreferences();
     if ($preferences->getPreference($glyph_pref) == 'glyph') {
         $glyph = id(new PhabricatorConpherenceApplication())->getTitleGlyph() . ' ';
     } else {
         $glyph = null;
     }
     return id(new ConpherenceMenuItemView())->setUser($user)->setTitle($title)->setSubtitle($subtitle)->setHref($uri)->setEpoch($epoch)->setImageURI($image)->setUnreadCount($unread_count)->setID($thread->getPHID() . '-nav-item')->addSigil('conpherence-menu-click')->setMetadata(array('title' => $glyph . $data['title'], 'id' => $dom_id, 'threadID' => $thread->getID()));
 }
コード例 #5
0
 public function generateTransactionsFromText(PhabricatorUser $viewer, ConpherenceThread $conpherence, $text)
 {
     $files = array();
     $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles($viewer, array($text));
     // Since these are extracted from text, we might be re-including the
     // same file -- e.g. a mock under discussion. Filter files we
     // already have.
     $existing_file_phids = $conpherence->getFilePHIDs();
     $file_phids = array_diff($file_phids, $existing_file_phids);
     if ($file_phids) {
         $files = id(new PhabricatorFileQuery())->setViewer($this->getActor())->withPHIDs($file_phids)->execute();
     }
     $xactions = array();
     if ($files) {
         $xactions[] = id(new ConpherenceTransaction())->setTransactionType(ConpherenceTransaction::TYPE_FILES)->setNewValue(array('+' => mpull($files, 'getPHID')));
     }
     $xactions[] = id(new ConpherenceTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new ConpherenceTransactionComment())->setContent($text)->setConpherencePHID($conpherence->getPHID()));
     return $xactions;
 }
コード例 #6
0
 private function getNeededTransactions(ConpherenceThread $conpherence, $message_id)
 {
     if ($message_id) {
         $newer_transactions = $conpherence->getTransactions();
         $query = id(new ConpherenceTransactionQuery())->setViewer($this->getRequest()->getUser())->withObjectPHIDs(array($conpherence->getPHID()))->setAfterID($message_id)->needHandles(true)->setLimit(self::OLDER_FETCH_LIMIT);
         $older_transactions = $query->execute();
         $handles = array();
         foreach ($older_transactions as $transaction) {
             $handles += $transaction->getHandles();
         }
         $conpherence->attachHandles($conpherence->getHandles() + $handles);
         $transactions = array_merge($newer_transactions, $older_transactions);
         $conpherence->attachTransactions($transactions);
     } else {
         $transactions = $conpherence->getTransactions();
     }
     return $transactions;
 }
コード例 #7
0
 public function generateTransactionsFromText(PhabricatorUser $viewer, ConpherenceThread $conpherence, $text)
 {
     $xactions = array();
     $xactions[] = id(new ConpherenceTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new ConpherenceTransactionComment())->setContent($text)->setConpherencePHID($conpherence->getPHID()));
     return $xactions;
 }