예제 #1
0
 protected function _postSave($is_new)
 {
     if ($is_new) {
         $tty = $this->getTargetType();
         $tid = $this->getTargetID();
         if (array_key_exists($tty, self::$_comment_count) && array_key_exists($tid, self::$_comment_count[$tty]) && array_key_exists((int) $this->isSystemComment(), self::$_comment_count[$tty][$tid])) {
             self::$_comment_count[$tty][$tid][(int) $this->isSystemComment()]++;
         }
         if (!$this->isSystemComment()) {
             if ($this->_getParser()->hasMentions()) {
                 foreach ($this->_getParser()->getMentions() as $user) {
                     if ($user->getID() == TBGContext::getUser()->getID()) {
                         continue;
                     }
                     $this->_addNotification(TBGNotification::TYPE_COMMENT_MENTIONED, $user);
                 }
             }
             if ($this->getTargetType() == self::TYPE_ISSUE) {
                 $this->_addIssueNotifications();
                 if (TBGSettings::getUserSetting(TBGSettings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ISSUES, $this->getPostedByID())) {
                     $this->getTarget()->addSubscriber($this->getPostedByID());
                 }
             }
             if ($this->getTargetType() == self::TYPE_ARTICLE) {
                 if (TBGSettings::getUserSetting(TBGSettings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ARTICLES, $this->getPostedByID())) {
                     $this->getTarget()->addSubscriber($this->getPostedByID());
                 }
             }
         }
     }
 }
예제 #2
0
 protected function _getOrGenerateRssKey()
 {
     static $key;
     $key = $key === null ? TBGSettings::getUserSetting($this->getID(), TBGSettings::USER_RSS_KEY) : $key;
     if ($key === null) {
         $key = $this->_generateRssKey();
     }
     return $key;
 }
예제 #3
0
 protected function _postSave($is_new)
 {
     $this->_saveCustomFieldValues();
     if (!$is_new) {
         $related_issues_to_save = $this->_processChanges();
         $comment = isset($this->_save_comment) ? $this->_save_comment : $this->addSystemComment('', TBGContext::getUser()->getID());
         $this->triggerSaveEvent($comment, TBGContext::getUser());
         if (count($related_issues_to_save)) {
             foreach (array_keys($related_issues_to_save) as $i_id) {
                 $related_issue = TBGIssuesTable::getTable()->selectById((int) $i_id);
                 $related_issue->save();
             }
         }
     } else {
         $this->addLogEntry(TBGLogTable::LOG_ISSUE_CREATED, null, false, $this->getPosted());
         $this->_addCreateNotifications($this->getPostedBy());
         TBGEvent::createNew('core', 'TBGIssue::createNew', $this)->trigger();
     }
     if (in_array(TBGSettings::getUserSetting(TBGSettings::SETTINGS_USER_SUBSCRIBE_CREATED_UPDATED_COMMENTED_ISSUES, TBGContext::getUser()->getID()), array(null, true))) {
         $this->addSubscriber(TBGContext::getUser()->getID());
     }
     $this->_clearChangedProperties();
     $this->_log_items_added = array();
     $this->getProject()->clearRecentActivities();
     if ($this->getMilestone() instanceof TBGMilestone) {
         $this->getMilestone()->updateStatus();
     }
     return true;
 }