当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorRepositoryCommit::getAuthorPHID方法代码示例

本文整理汇总了PHP中PhabricatorRepositoryCommit::getAuthorPHID方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorRepositoryCommit::getAuthorPHID方法的具体用法?PHP PhabricatorRepositoryCommit::getAuthorPHID怎么用?PHP PhabricatorRepositoryCommit::getAuthorPHID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorRepositoryCommit的用法示例。


在下文中一共展示了PhabricatorRepositoryCommit::getAuthorPHID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderCommitTooltip

 private function renderCommitTooltip(PhabricatorRepositoryCommit $commit, array $handles, $author)
 {
     $viewer = $this->getRequest()->getUser();
     $date = phabricator_date($commit->getEpoch(), $viewer);
     $summary = trim($commit->getSummary());
     if ($commit->getAuthorPHID()) {
         $author = $handles[$commit->getAuthorPHID()]->getName();
     }
     return "{$summary}\n{$date} · {$author}";
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:10,代码来源:DiffusionBrowseFileController.php

示例2: getAuditActions

 /**
  * Return a map of available audit actions for rendering into a <select />.
  * This shows the user valid actions, and does not show nonsense/invalid
  * actions (like closing an already-closed commit, or resigning from a commit
  * you have no association with).
  */
 private function getAuditActions(PhabricatorRepositoryCommit $commit, array $audit_requests)
 {
     assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
     $user = $this->getRequest()->getUser();
     $user_is_author = $commit->getAuthorPHID() == $user->getPHID();
     $user_request = null;
     foreach ($audit_requests as $audit_request) {
         if ($audit_request->getAuditorPHID() == $user->getPHID()) {
             $user_request = $audit_request;
             break;
         }
     }
     $actions = array();
     $actions[PhabricatorAuditActionConstants::COMMENT] = true;
     $actions[PhabricatorAuditActionConstants::ADD_CCS] = true;
     $actions[PhabricatorAuditActionConstants::ADD_AUDITORS] = true;
     // We allow you to accept your own commits. A use case here is that you
     // notice an issue with your own commit and "Raise Concern" as an indicator
     // to other auditors that you're on top of the issue, then later resolve it
     // and "Accept". You can not accept on behalf of projects or packages,
     // however.
     $actions[PhabricatorAuditActionConstants::ACCEPT] = true;
     $actions[PhabricatorAuditActionConstants::CONCERN] = true;
     // To resign, a user must have authority on some request and not be the
     // commit's author.
     if (!$user_is_author) {
         $may_resign = false;
         $authority_map = array_fill_keys($this->auditAuthorityPHIDs, true);
         foreach ($audit_requests as $request) {
             if (empty($authority_map[$request->getAuditorPHID()])) {
                 continue;
             }
             $may_resign = true;
             break;
         }
         // If the user has already resigned, don't show "Resign...".
         $status_resigned = PhabricatorAuditStatusConstants::RESIGNED;
         if ($user_request) {
             if ($user_request->getAuditStatus() == $status_resigned) {
                 $may_resign = false;
             }
         }
         if ($may_resign) {
             $actions[PhabricatorAuditActionConstants::RESIGN] = true;
         }
     }
     $status_concern = PhabricatorAuditCommitStatusConstants::CONCERN_RAISED;
     $concern_raised = $commit->getAuditStatus() == $status_concern;
     $can_close_option = PhabricatorEnv::getEnvConfig('audit.can-author-close-audit');
     if ($can_close_option && $user_is_author && $concern_raised) {
         $actions[PhabricatorAuditActionConstants::CLOSE] = true;
     }
     foreach ($actions as $constant => $ignored) {
         $actions[$constant] = PhabricatorAuditActionConstants::getActionName($constant);
     }
     return $actions;
 }
开发者ID:ryancford,项目名称:phabricator,代码行数:63,代码来源:DiffusionCommitController.php

示例3: publishFeedStory

 private function publishFeedStory(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, PhabricatorRepositoryCommitData $data)
 {
     if (time() > $commit->getEpoch() + 24 * 60 * 60) {
         // Don't publish stories that are more than 24 hours old, to avoid
         // ridiculous levels of feed spam if a repository is imported without
         // disabling feed publishing.
         return;
     }
     $author_phid = $commit->getAuthorPHID();
     $committer_phid = $data->getCommitDetail('committerPHID');
     $publisher = new PhabricatorFeedStoryPublisher();
     $publisher->setStoryType(PhabricatorFeedStoryTypeConstants::STORY_COMMIT);
     $publisher->setStoryData(array('commitPHID' => $commit->getPHID(), 'summary' => $data->getSummary(), 'authorName' => $data->getAuthorName(), 'authorPHID' => $author_phid, 'committerName' => $data->getCommitDetail('committer'), 'committerPHID' => $committer_phid));
     $publisher->setStoryTime($commit->getEpoch());
     $publisher->setRelatedPHIDs(array_filter(array($author_phid, $committer_phid)));
     if ($author_phid) {
         $publisher->setStoryAuthorPHID($author_phid);
     }
     $publisher->publish();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:20,代码来源:PhabricatorRepositoryCommitHeraldWorker.php


注:本文中的PhabricatorRepositoryCommit::getAuthorPHID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。