Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionCommitController.php
| Show All 18 Lines | final class DiffusionCommitController extends DiffusionController { | ||||
| public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
| $response = $this->loadDiffusionContext(); | $response = $this->loadDiffusionContext(); | ||||
| if ($response) { | if ($response) { | ||||
| return $response; | return $response; | ||||
| } | } | ||||
| $drequest = $this->getDiffusionRequest(); | $drequest = $this->getDiffusionRequest(); | ||||
| $viewer = $request->getUser(); | |||||
| $user = $request->getUser(); | |||||
| if ($request->getStr('diff')) { | if ($request->getStr('diff')) { | ||||
| return $this->buildRawDiffResponse($drequest); | return $this->buildRawDiffResponse($drequest); | ||||
| } | } | ||||
| $repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
| $content = array(); | |||||
| $commit = id(new DiffusionCommitQuery()) | $commit = id(new DiffusionCommitQuery()) | ||||
| ->setViewer($request->getUser()) | ->setViewer($viewer) | ||||
| ->withRepository($repository) | ->withRepository($repository) | ||||
| ->withIdentifiers(array($drequest->getCommit())) | ->withIdentifiers(array($drequest->getCommit())) | ||||
| ->needCommitData(true) | ->needCommitData(true) | ||||
| ->needAuditRequests(true) | ->needAuditRequests(true) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| $crumbs = $this->buildCrumbs(array( | $crumbs = $this->buildCrumbs(array( | ||||
| 'commit' => true, | 'commit' => true, | ||||
| )); | )); | ||||
| $crumbs->setBorder(true); | |||||
| if (!$commit) { | if (!$commit) { | ||||
| if (!$this->getCommitExists()) { | if (!$this->getCommitExists()) { | ||||
| return new Aphront404Response(); | return new Aphront404Response(); | ||||
| } | } | ||||
| $error = id(new PHUIInfoView()) | $error = id(new PHUIInfoView()) | ||||
| ->setTitle(pht('Commit Still Parsing')) | ->setTitle(pht('Commit Still Parsing')) | ||||
| Show All 9 Lines | if (!$commit) { | ||||
| ), | ), | ||||
| array( | array( | ||||
| 'title' => pht('Commit Still Parsing'), | 'title' => pht('Commit Still Parsing'), | ||||
| )); | )); | ||||
| } | } | ||||
| $audit_requests = $commit->getAudits(); | $audit_requests = $commit->getAudits(); | ||||
| $this->auditAuthorityPHIDs = | $this->auditAuthorityPHIDs = | ||||
| PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user); | PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($viewer); | ||||
| $commit_data = $commit->getCommitData(); | $commit_data = $commit->getCommitData(); | ||||
| $is_foreign = $commit_data->getCommitDetail('foreign-svn-stub'); | $is_foreign = $commit_data->getCommitDetail('foreign-svn-stub'); | ||||
| $error_panel = null; | |||||
| if ($is_foreign) { | if ($is_foreign) { | ||||
| $subpath = $commit_data->getCommitDetail('svn-subpath'); | $subpath = $commit_data->getCommitDetail('svn-subpath'); | ||||
| $error_panel = new PHUIInfoView(); | $error_panel = new PHUIInfoView(); | ||||
| $error_panel->setTitle(pht('Commit Not Tracked')); | $error_panel->setTitle(pht('Commit Not Tracked')); | ||||
| $error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING); | $error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING); | ||||
| $error_panel->appendChild( | $error_panel->appendChild( | ||||
| pht( | pht( | ||||
| "This Diffusion repository is configured to track only one ". | "This Diffusion repository is configured to track only one ". | ||||
| "subdirectory of the entire Subversion repository, and this commit ". | "subdirectory of the entire Subversion repository, and this commit ". | ||||
| "didn't affect the tracked subdirectory ('%s'), so no ". | "didn't affect the tracked subdirectory ('%s'), so no ". | ||||
| "information is available.", | "information is available.", | ||||
| $subpath)); | $subpath)); | ||||
| $content[] = $error_panel; | |||||
| } else { | } else { | ||||
| $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); | $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); | ||||
| $engine->setConfig('viewer', $user); | $engine->setConfig('viewer', $viewer); | ||||
| $headsup_view = id(new PHUIHeaderView()) | $commit_tag = $this->renderCommitHashTag($drequest); | ||||
| $header = id(new PHUIHeaderView()) | |||||
| ->setHeader(nonempty($commit->getSummary(), pht('Commit Detail'))) | ->setHeader(nonempty($commit->getSummary(), pht('Commit Detail'))) | ||||
| ->setSubheader(pht('Commit: %s', $commit->getCommitIdentifier())); | ->setHeaderIcon('fa-code-fork') | ||||
| ->addTag($commit_tag); | |||||
| if ($commit->getAuditStatus()) { | |||||
| $icon = PhabricatorAuditCommitStatusConstants::getStatusIcon( | |||||
| $commit->getAuditStatus()); | |||||
| $color = PhabricatorAuditCommitStatusConstants::getStatusColor( | |||||
| $commit->getAuditStatus()); | |||||
| $status = PhabricatorAuditCommitStatusConstants::getStatusName( | |||||
| $commit->getAuditStatus()); | |||||
| $headsup_actions = $this->renderHeadsupActionList($commit, $repository); | $header->setStatus($icon, $color, $status); | ||||
| } | |||||
| $commit_properties = $this->loadCommitProperties( | $curtain = $this->buildCurtain($commit, $repository); | ||||
| $subheader = $this->buildSubheaderView($commit, $commit_data); | |||||
| $details = $this->buildPropertyListView( | |||||
| $commit, | $commit, | ||||
| $commit_data, | $commit_data, | ||||
| $audit_requests); | $audit_requests); | ||||
| $property_list = id(new PHUIPropertyListView()) | |||||
| ->setHasKeyboardShortcuts(true) | |||||
| ->setUser($user) | |||||
| ->setObject($commit); | |||||
| foreach ($commit_properties as $key => $value) { | |||||
| $property_list->addProperty($key, $value); | |||||
| } | |||||
| $message = $commit_data->getCommitMessage(); | $message = $commit_data->getCommitMessage(); | ||||
| $revision = $commit->getCommitIdentifier(); | $revision = $commit->getCommitIdentifier(); | ||||
| $message = $this->linkBugtraq($message); | $message = $this->linkBugtraq($message); | ||||
| $message = $engine->markupText($message); | $message = $engine->markupText($message); | ||||
| $property_list->invokeWillRenderEvent(); | |||||
| $property_list->setActionList($headsup_actions); | |||||
| $detail_list = new PHUIPropertyListView(); | $detail_list = new PHUIPropertyListView(); | ||||
| $detail_list->addSectionHeader( | |||||
| pht('Description'), | |||||
| PHUIPropertyListView::ICON_SUMMARY); | |||||
| $detail_list->addTextContent( | $detail_list->addTextContent( | ||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'diffusion-commit-message phabricator-remarkup', | 'class' => 'diffusion-commit-message phabricator-remarkup', | ||||
| ), | ), | ||||
| $message)); | $message)); | ||||
| $headsup_view->setTall(true); | if ($this->getCommitErrors()) { | ||||
| $error_panel = id(new PHUIInfoView()) | |||||
| $object_box = id(new PHUIObjectBoxView()) | ->appendChild($this->getCommitErrors()) | ||||
| ->setHeader($headsup_view) | ->setSeverity(PHUIInfoView::SEVERITY_WARNING); | ||||
| ->setFormErrors($this->getCommitErrors()) | } | ||||
| ->addPropertyList($property_list) | |||||
| ->addPropertyList($detail_list); | |||||
| $content[] = $object_box; | |||||
| } | } | ||||
| $content[] = $this->buildComments($commit); | $timeline = $this->buildComments($commit); | ||||
| $hard_limit = 1000; | $hard_limit = 1000; | ||||
| if ($commit->isImported()) { | if ($commit->isImported()) { | ||||
| $change_query = DiffusionPathChangeQuery::newFromDiffusionRequest( | $change_query = DiffusionPathChangeQuery::newFromDiffusionRequest( | ||||
| $drequest); | $drequest); | ||||
| $change_query->setLimit($hard_limit + 1); | $change_query->setLimit($hard_limit + 1); | ||||
| $changes = $change_query->loadChanges(); | $changes = $change_query->loadChanges(); | ||||
| } else { | } else { | ||||
| $changes = array(); | $changes = array(); | ||||
| } | } | ||||
| $was_limited = (count($changes) > $hard_limit); | $was_limited = (count($changes) > $hard_limit); | ||||
| if ($was_limited) { | if ($was_limited) { | ||||
| $changes = array_slice($changes, 0, $hard_limit); | $changes = array_slice($changes, 0, $hard_limit); | ||||
| } | } | ||||
| $content[] = $this->buildMergesTable($commit); | $merge_table = $this->buildMergesTable($commit); | ||||
| $highlighted_audits = $commit->getAuthorityAudits( | $highlighted_audits = $commit->getAuthorityAudits( | ||||
| $user, | $viewer, | ||||
| $this->auditAuthorityPHIDs); | $this->auditAuthorityPHIDs); | ||||
| $count = count($changes); | $count = count($changes); | ||||
| $bad_commit = null; | $bad_commit = null; | ||||
| if ($count == 0) { | if ($count == 0) { | ||||
| $bad_commit = queryfx_one( | $bad_commit = queryfx_one( | ||||
| id(new PhabricatorRepository())->establishConnection('r'), | id(new PhabricatorRepository())->establishConnection('r'), | ||||
| 'SELECT * FROM %T WHERE fullCommitName = %s', | 'SELECT * FROM %T WHERE fullCommitName = %s', | ||||
| PhabricatorRepository::TABLE_BADCOMMIT, | PhabricatorRepository::TABLE_BADCOMMIT, | ||||
| $commit->getMonogram()); | $commit->getMonogram()); | ||||
| } | } | ||||
| $show_changesets = false; | $show_changesets = false; | ||||
| $info_panel = null; | |||||
| $change_list = null; | |||||
| $change_table = null; | |||||
| if ($bad_commit) { | if ($bad_commit) { | ||||
| $content[] = $this->renderStatusMessage( | $info_panel = $this->renderStatusMessage( | ||||
| pht('Bad Commit'), | pht('Bad Commit'), | ||||
| $bad_commit['description']); | $bad_commit['description']); | ||||
| } else if ($is_foreign) { | } else if ($is_foreign) { | ||||
| // Don't render anything else. | // Don't render anything else. | ||||
| } else if (!$commit->isImported()) { | } else if (!$commit->isImported()) { | ||||
| $content[] = $this->renderStatusMessage( | $info_panel = $this->renderStatusMessage( | ||||
| pht('Still Importing...'), | pht('Still Importing...'), | ||||
| pht( | pht( | ||||
| 'This commit is still importing. Changes will be visible once '. | 'This commit is still importing. Changes will be visible once '. | ||||
| 'the import finishes.')); | 'the import finishes.')); | ||||
| } else if (!count($changes)) { | } else if (!count($changes)) { | ||||
| $content[] = $this->renderStatusMessage( | $info_panel = $this->renderStatusMessage( | ||||
| pht('Empty Commit'), | pht('Empty Commit'), | ||||
| pht( | pht( | ||||
| 'This commit is empty and does not affect any paths.')); | 'This commit is empty and does not affect any paths.')); | ||||
| } else if ($was_limited) { | } else if ($was_limited) { | ||||
| $content[] = $this->renderStatusMessage( | $info_panel = $this->renderStatusMessage( | ||||
| pht('Enormous Commit'), | pht('Enormous Commit'), | ||||
| pht( | pht( | ||||
| 'This commit is enormous, and affects more than %d files. '. | 'This commit is enormous, and affects more than %d files. '. | ||||
| 'Changes are not shown.', | 'Changes are not shown.', | ||||
| $hard_limit)); | $hard_limit)); | ||||
| } else if (!$this->getCommitExists()) { | } else if (!$this->getCommitExists()) { | ||||
| $content[] = $this->renderStatusMessage( | $info_panel = $this->renderStatusMessage( | ||||
| pht('Commit No Longer Exists'), | pht('Commit No Longer Exists'), | ||||
| pht('This commit no longer exists in the repository.')); | pht('This commit no longer exists in the repository.')); | ||||
| } else { | } else { | ||||
| $show_changesets = true; | $show_changesets = true; | ||||
| // The user has clicked "Show All Changes", and we should show all the | // The user has clicked "Show All Changes", and we should show all the | ||||
| // changes inline even if there are more than the soft limit. | // changes inline even if there are more than the soft limit. | ||||
| $show_all_details = $request->getBool('show_all'); | $show_all_details = $request->getBool('show_all'); | ||||
| $header = id(new PHUIHeaderView()) | $change_header = id(new PHUIHeaderView()) | ||||
| ->setHeader(pht('Changes (%s)', new PhutilNumber($count))); | ->setHeader(pht('Changes (%s)', new PhutilNumber($count))); | ||||
| $warning_view = null; | $warning_view = null; | ||||
| if ($count > self::CHANGES_LIMIT && !$show_all_details) { | if ($count > self::CHANGES_LIMIT && !$show_all_details) { | ||||
| $button = id(new PHUIButtonView()) | $button = id(new PHUIButtonView()) | ||||
| ->setText(pht('Show All Changes')) | ->setText(pht('Show All Changes')) | ||||
| ->setHref('?show_all=true') | ->setHref('?show_all=true') | ||||
| ->setTag('a') | ->setTag('a') | ||||
| ->setIcon('fa-files-o'); | ->setIcon('fa-files-o'); | ||||
| $warning_view = id(new PHUIInfoView()) | $warning_view = id(new PHUIInfoView()) | ||||
| ->setSeverity(PHUIInfoView::SEVERITY_WARNING) | ->setSeverity(PHUIInfoView::SEVERITY_WARNING) | ||||
| ->setTitle(pht('Very Large Commit')) | ->setTitle(pht('Very Large Commit')) | ||||
| ->addButton($button) | |||||
| ->appendChild( | ->appendChild( | ||||
| pht('This commit is very large. Load each file individually.')); | pht('This commit is very large. Load each file individually.')); | ||||
| $change_header->addActionLink($button); | |||||
| } | } | ||||
| $changesets = DiffusionPathChange::convertToDifferentialChangesets( | $changesets = DiffusionPathChange::convertToDifferentialChangesets( | ||||
| $user, | $viewer, | ||||
| $changes); | $changes); | ||||
| // TODO: This table and panel shouldn't really be separate, but we need | // TODO: This table and panel shouldn't really be separate, but we need | ||||
| // to clean up the "Load All Files" interaction first. | // to clean up the "Load All Files" interaction first. | ||||
| $change_table = $this->buildTableOfContents( | $change_table = $this->buildTableOfContents( | ||||
| $changesets, | $changesets, | ||||
| $header, | $change_header, | ||||
| $warning_view); | $warning_view); | ||||
| $content[] = $change_table; | |||||
| $vcs = $repository->getVersionControlSystem(); | $vcs = $repository->getVersionControlSystem(); | ||||
| switch ($vcs) { | switch ($vcs) { | ||||
| case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: | case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: | ||||
| $vcs_supports_directory_changes = true; | $vcs_supports_directory_changes = true; | ||||
| break; | break; | ||||
| case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: | case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: | ||||
| case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: | case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: | ||||
| $vcs_supports_directory_changes = false; | $vcs_supports_directory_changes = false; | ||||
| Show All 29 Lines | if ($bad_commit) { | ||||
| $changeset->setID($path_ids[$changeset->getFilename()]); | $changeset->setID($path_ids[$changeset->getFilename()]); | ||||
| } | } | ||||
| if ($count <= self::CHANGES_LIMIT || $show_all_details) { | if ($count <= self::CHANGES_LIMIT || $show_all_details) { | ||||
| $visible_changesets = $changesets; | $visible_changesets = $changesets; | ||||
| } else { | } else { | ||||
| $visible_changesets = array(); | $visible_changesets = array(); | ||||
| $inlines = PhabricatorAuditInlineComment::loadDraftAndPublishedComments( | $inlines = PhabricatorAuditInlineComment::loadDraftAndPublishedComments( | ||||
| $user, | $viewer, | ||||
| $commit->getPHID()); | $commit->getPHID()); | ||||
| $path_ids = mpull($inlines, null, 'getPathID'); | $path_ids = mpull($inlines, null, 'getPathID'); | ||||
| foreach ($changesets as $key => $changeset) { | foreach ($changesets as $key => $changeset) { | ||||
| if (array_key_exists($changeset->getID(), $path_ids)) { | if (array_key_exists($changeset->getID(), $path_ids)) { | ||||
| $visible_changesets[$key] = $changeset; | $visible_changesets[$key] = $changeset; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| $change_list_title = $commit->getDisplayName(); | $change_list_title = $commit->getDisplayName(); | ||||
| $change_list = new DifferentialChangesetListView(); | $change_list = new DifferentialChangesetListView(); | ||||
| $change_list->setTitle($change_list_title); | $change_list->setTitle($change_list_title); | ||||
| $change_list->setChangesets($changesets); | $change_list->setChangesets($changesets); | ||||
| $change_list->setVisibleChangesets($visible_changesets); | $change_list->setVisibleChangesets($visible_changesets); | ||||
| $change_list->setRenderingReferences($references); | $change_list->setRenderingReferences($references); | ||||
| $change_list->setRenderURI( | $change_list->setRenderURI($repository->getPathURI('diff/')); | ||||
| $repository->getPathURI('diff/')); | |||||
| $change_list->setRepository($repository); | $change_list->setRepository($repository); | ||||
| $change_list->setUser($user); | $change_list->setUser($viewer); | ||||
| $change_list->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); | |||||
| // TODO: Try to setBranch() to something reasonable here? | // TODO: Try to setBranch() to something reasonable here? | ||||
| $change_list->setStandaloneURI( | $change_list->setStandaloneURI( | ||||
| $repository->getPathURI('diff/')); | $repository->getPathURI('diff/')); | ||||
| $change_list->setRawFileURIs( | $change_list->setRawFileURIs( | ||||
| // TODO: Implement this, somewhat tricky if there's an octopus merge | // TODO: Implement this, somewhat tricky if there's an octopus merge | ||||
| // or whatever? | // or whatever? | ||||
| null, | null, | ||||
| $repository->getPathURI('diff/?view=r')); | $repository->getPathURI('diff/?view=r')); | ||||
| $change_list->setInlineCommentControllerURI( | $change_list->setInlineCommentControllerURI( | ||||
| '/diffusion/inline/edit/'.phutil_escape_uri($commit->getPHID()).'/'); | '/diffusion/inline/edit/'.phutil_escape_uri($commit->getPHID()).'/'); | ||||
| $content[] = $change_list->render(); | |||||
| } | } | ||||
| $content[] = $this->renderAddCommentPanel($commit, $audit_requests); | $add_comment = $this->renderAddCommentPanel($commit, $audit_requests); | ||||
| $prefs = $user->loadPreferences(); | $prefs = $viewer->loadPreferences(); | ||||
| $pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE; | $pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE; | ||||
| $pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED; | $pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED; | ||||
| $show_filetree = $prefs->getPreference($pref_filetree); | $show_filetree = $prefs->getPreference($pref_filetree); | ||||
| $collapsed = $prefs->getPreference($pref_collapse); | $collapsed = $prefs->getPreference($pref_collapse); | ||||
| $nav = null; | |||||
| if ($show_changesets && $show_filetree) { | if ($show_changesets && $show_filetree) { | ||||
| $nav = id(new DifferentialChangesetFileTreeSideNavBuilder()) | $nav = id(new DifferentialChangesetFileTreeSideNavBuilder()) | ||||
| ->setTitle($commit->getDisplayName()) | ->setTitle($commit->getDisplayName()) | ||||
| ->setBaseURI(new PhutilURI($commit->getURI())) | ->setBaseURI(new PhutilURI($commit->getURI())) | ||||
| ->build($changesets) | ->build($changesets) | ||||
| ->setCrumbs($crumbs) | ->setCrumbs($crumbs) | ||||
| ->setCollapsed((bool)$collapsed) | ->setCollapsed((bool)$collapsed); | ||||
| ->appendChild($content); | |||||
| $content = $nav; | |||||
| } else { | |||||
| $content = array($crumbs, $content); | |||||
| } | } | ||||
| return $this->buildApplicationPage( | $view = id(new PHUITwoColumnView()) | ||||
| $content, | ->setHeader($header) | ||||
| ->setSubheader($subheader) | |||||
| ->setMainColumn(array( | |||||
| $error_panel, | |||||
| $timeline, | |||||
| $merge_table, | |||||
| $info_panel, | |||||
| )) | |||||
| ->setFooter(array( | |||||
| $change_table, | |||||
| $change_list, | |||||
| $add_comment, | |||||
| )) | |||||
| ->addPropertySection(pht('DESCRIPTION'), $detail_list) | |||||
| ->addPropertySection(pht('DETAILS'), $details) | |||||
| ->setCurtain($curtain); | |||||
| $page = $this->newPage() | |||||
| ->setTitle($commit->getDisplayName()) | |||||
| ->setCrumbs($crumbs) | |||||
| ->setPageObjectPHIDS(array($commit->getPHID())) | |||||
| ->appendChild( | |||||
| array( | array( | ||||
| 'title' => $commit->getDisplayName(), | $view, | ||||
| 'pageObjects' => array($commit->getPHID()), | |||||
| )); | )); | ||||
| if ($nav) { | |||||
| $page->setNavigation($nav); | |||||
| } | } | ||||
| private function loadCommitProperties( | return $page; | ||||
| } | |||||
| private function buildPropertyListView( | |||||
| PhabricatorRepositoryCommit $commit, | PhabricatorRepositoryCommit $commit, | ||||
| PhabricatorRepositoryCommitData $data, | PhabricatorRepositoryCommitData $data, | ||||
| array $audit_requests) { | array $audit_requests) { | ||||
| $viewer = $this->getRequest()->getUser(); | $viewer = $this->getViewer(); | ||||
| $commit_phid = $commit->getPHID(); | $commit_phid = $commit->getPHID(); | ||||
| $drequest = $this->getDiffusionRequest(); | $drequest = $this->getDiffusionRequest(); | ||||
| $repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
| $view = id(new PHUIPropertyListView()) | |||||
| ->setUser($this->getRequest()->getUser()); | |||||
| $edge_query = id(new PhabricatorEdgeQuery()) | $edge_query = id(new PhabricatorEdgeQuery()) | ||||
| ->withSourcePHIDs(array($commit_phid)) | ->withSourcePHIDs(array($commit_phid)) | ||||
| ->withEdgeTypes(array( | ->withEdgeTypes(array( | ||||
| DiffusionCommitHasTaskEdgeType::EDGECONST, | DiffusionCommitHasTaskEdgeType::EDGECONST, | ||||
| DiffusionCommitHasRevisionEdgeType::EDGECONST, | DiffusionCommitHasRevisionEdgeType::EDGECONST, | ||||
| DiffusionCommitRevertsCommitEdgeType::EDGECONST, | DiffusionCommitRevertsCommitEdgeType::EDGECONST, | ||||
| DiffusionCommitRevertedByCommitEdgeType::EDGECONST, | DiffusionCommitRevertedByCommitEdgeType::EDGECONST, | ||||
| )); | )); | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | private function buildPropertyListView( | ||||
| $handles = array(); | $handles = array(); | ||||
| if ($phids) { | if ($phids) { | ||||
| $handles = $this->loadViewerHandles($phids); | $handles = $this->loadViewerHandles($phids); | ||||
| } | } | ||||
| $props = array(); | $props = array(); | ||||
| if ($commit->getAuditStatus()) { | |||||
| $status = PhabricatorAuditCommitStatusConstants::getStatusName( | |||||
| $commit->getAuditStatus()); | |||||
| $tag = id(new PHUITagView()) | |||||
| ->setType(PHUITagView::TYPE_STATE) | |||||
| ->setName($status); | |||||
| switch ($commit->getAuditStatus()) { | |||||
| case PhabricatorAuditCommitStatusConstants::NEEDS_AUDIT: | |||||
| $tag->setBackgroundColor(PHUITagView::COLOR_ORANGE); | |||||
| break; | |||||
| case PhabricatorAuditCommitStatusConstants::CONCERN_RAISED: | |||||
| $tag->setBackgroundColor(PHUITagView::COLOR_RED); | |||||
| break; | |||||
| case PhabricatorAuditCommitStatusConstants::PARTIALLY_AUDITED: | |||||
| $tag->setBackgroundColor(PHUITagView::COLOR_BLUE); | |||||
| break; | |||||
| case PhabricatorAuditCommitStatusConstants::FULLY_AUDITED: | |||||
| $tag->setBackgroundColor(PHUITagView::COLOR_GREEN); | |||||
| break; | |||||
| } | |||||
| $props['Status'] = $tag; | |||||
| } | |||||
| if ($audit_requests) { | if ($audit_requests) { | ||||
| $user_requests = array(); | $user_requests = array(); | ||||
| $other_requests = array(); | $other_requests = array(); | ||||
| foreach ($audit_requests as $audit_request) { | foreach ($audit_requests as $audit_request) { | ||||
| if ($audit_request->isUser()) { | if ($audit_request->isUser()) { | ||||
| $user_requests[] = $audit_request; | $user_requests[] = $audit_request; | ||||
| } else { | } else { | ||||
| $other_requests[] = $audit_request; | $other_requests[] = $audit_request; | ||||
| } | } | ||||
| } | } | ||||
| if ($user_requests) { | if ($user_requests) { | ||||
| $props['Auditors'] = $this->renderAuditStatusView( | $view->addProperty( | ||||
| $user_requests); | pht('Auditors'), | ||||
| $this->renderAuditStatusView($user_requests)); | |||||
| } | } | ||||
| if ($other_requests) { | if ($other_requests) { | ||||
| $props['Project/Package Auditors'] = $this->renderAuditStatusView( | $view->addProperty( | ||||
| $other_requests); | pht('Project/Package Auditors'), | ||||
| $this->renderAuditStatusView($other_requests)); | |||||
| } | } | ||||
| } | } | ||||
| $author_phid = $data->getCommitDetail('authorPHID'); | $author_phid = $data->getCommitDetail('authorPHID'); | ||||
| $author_name = $data->getAuthorName(); | $author_name = $data->getAuthorName(); | ||||
| if (!$repository->isSVN()) { | |||||
| $authored_info = id(new PHUIStatusItemView()); | |||||
| $author_epoch = $data->getCommitDetail('authorEpoch'); | $author_epoch = $data->getCommitDetail('authorEpoch'); | ||||
| if ($author_epoch !== null) { | |||||
| $authored_info->setNote( | |||||
| phabricator_datetime($author_epoch, $viewer)); | |||||
| } | |||||
| if ($author_phid) { | |||||
| $authored_info->setTarget($handles[$author_phid]->renderLink()); | |||||
| } else if (strlen($author_name)) { | |||||
| $authored_info->setTarget($author_name); | |||||
| } | |||||
| $props['Authored'] = id(new PHUIStatusListView()) | |||||
| ->addItem($authored_info); | |||||
| } | |||||
| $committed_info = id(new PHUIStatusItemView()) | $committed_info = id(new PHUIStatusItemView()) | ||||
| ->setNote(phabricator_datetime($commit->getEpoch(), $viewer)); | ->setNote(phabricator_datetime($commit->getEpoch(), $viewer)); | ||||
| $committer_phid = $data->getCommitDetail('committerPHID'); | $committer_phid = $data->getCommitDetail('committerPHID'); | ||||
| $committer_name = $data->getCommitDetail('committer'); | $committer_name = $data->getCommitDetail('committer'); | ||||
| if ($committer_phid) { | if ($committer_phid) { | ||||
| $committed_info->setTarget($handles[$committer_phid]->renderLink()); | $committed_info->setTarget($handles[$committer_phid]->renderLink()); | ||||
| } else if (strlen($committer_name)) { | } else if (strlen($committer_name)) { | ||||
| $committed_info->setTarget($committer_name); | $committed_info->setTarget($committer_name); | ||||
| } else if ($author_phid) { | } else if ($author_phid) { | ||||
| $committed_info->setTarget($handles[$author_phid]->renderLink()); | $committed_info->setTarget($handles[$author_phid]->renderLink()); | ||||
| } else if (strlen($author_name)) { | } else if (strlen($author_name)) { | ||||
| $committed_info->setTarget($author_name); | $committed_info->setTarget($author_name); | ||||
| } | } | ||||
| $props['Committed'] = id(new PHUIStatusListView()) | $view->addProperty( | ||||
| ->addItem($committed_info); | pht('Committed'), | ||||
| $committed_info); | |||||
| if ($push_logs) { | if ($push_logs) { | ||||
| $pushed_list = new PHUIStatusListView(); | $pushed_list = new PHUIStatusListView(); | ||||
| foreach ($push_logs as $push_log) { | foreach ($push_logs as $push_log) { | ||||
| $pushed_item = id(new PHUIStatusItemView()) | $pushed_item = id(new PHUIStatusItemView()) | ||||
| ->setTarget($handles[$push_log->getPusherPHID()]->renderLink()) | ->setTarget($handles[$push_log->getPusherPHID()]->renderLink()) | ||||
| ->setNote(phabricator_datetime($push_log->getEpoch(), $viewer)); | ->setNote(phabricator_datetime($push_log->getEpoch(), $viewer)); | ||||
| $pushed_list->addItem($pushed_item); | $pushed_list->addItem($pushed_item); | ||||
| } | } | ||||
| $props['Pushed'] = $pushed_list; | $view->addProperty( | ||||
| pht('Pushed'), | |||||
| $pushed_list); | |||||
| } | } | ||||
| $reviewer_phid = $data->getCommitDetail('reviewerPHID'); | $reviewer_phid = $data->getCommitDetail('reviewerPHID'); | ||||
| if ($reviewer_phid) { | if ($reviewer_phid) { | ||||
| $props['Reviewer'] = $handles[$reviewer_phid]->renderLink(); | $view->addProperty( | ||||
| pht('Reviewer'), | |||||
| $handles[$reviewer_phid]->renderLink()); | |||||
| } | } | ||||
| if ($revision_phid) { | if ($revision_phid) { | ||||
| $props['Differential Revision'] = $handles[$revision_phid]->renderLink(); | $view->addProperty( | ||||
| pht('Differential Revision'), | |||||
| $handles[$revision_phid]->renderLink()); | |||||
| } | } | ||||
| $parents = $this->getCommitParents(); | $parents = $this->getCommitParents(); | ||||
| if ($parents) { | if ($parents) { | ||||
| $props['Parents'] = $viewer->renderHandleList(mpull($parents, 'getPHID')); | $view->addProperty( | ||||
| pht('Parents'), | |||||
| $viewer->renderHandleList(mpull($parents, 'getPHID'))); | |||||
| } | } | ||||
| if ($this->getCommitExists()) { | if ($this->getCommitExists()) { | ||||
| $props['Branches'] = phutil_tag( | $view->addProperty( | ||||
| pht('Branches'), | |||||
| phutil_tag( | |||||
| 'span', | 'span', | ||||
| array( | array( | ||||
| 'id' => 'commit-branches', | 'id' => 'commit-branches', | ||||
| ), | ), | ||||
| pht('Unknown')); | pht('Unknown'))); | ||||
| $props['Tags'] = phutil_tag( | |||||
| $view->addProperty( | |||||
| pht('Tags'), | |||||
| phutil_tag( | |||||
| 'span', | 'span', | ||||
| array( | array( | ||||
| 'id' => 'commit-tags', | 'id' => 'commit-tags', | ||||
| ), | ), | ||||
| pht('Unknown')); | pht('Unknown'))); | ||||
| $identifier = $commit->getCommitIdentifier(); | $identifier = $commit->getCommitIdentifier(); | ||||
| $root = $repository->getPathURI("commit/{$identifier}"); | $root = $repository->getPathURI("commit/{$identifier}"); | ||||
| Javelin::initBehavior( | Javelin::initBehavior( | ||||
| 'diffusion-commit-branches', | 'diffusion-commit-branches', | ||||
| array( | array( | ||||
| $root.'/branches/' => 'commit-branches', | $root.'/branches/' => 'commit-branches', | ||||
| $root.'/tags/' => 'commit-tags', | $root.'/tags/' => 'commit-tags', | ||||
| )); | )); | ||||
| } | } | ||||
| $refs = $this->getCommitRefs(); | $refs = $this->getCommitRefs(); | ||||
| if ($refs) { | if ($refs) { | ||||
| $ref_links = array(); | $ref_links = array(); | ||||
| foreach ($refs as $ref_data) { | foreach ($refs as $ref_data) { | ||||
| $ref_links[] = phutil_tag( | $ref_links[] = phutil_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'href' => $ref_data['href'], | 'href' => $ref_data['href'], | ||||
| ), | ), | ||||
| $ref_data['ref']); | $ref_data['ref']); | ||||
| } | } | ||||
| $props['References'] = phutil_implode_html(', ', $ref_links); | $view->addProperty( | ||||
| pht('References'), | |||||
| phutil_implode_html(', ', $ref_links)); | |||||
| } | } | ||||
| if ($reverts_phids) { | if ($reverts_phids) { | ||||
| $props[pht('Reverts')] = $viewer->renderHandleList($reverts_phids); | $view->addProperty( | ||||
| pht('Reverts'), | |||||
| $viewer->renderHandleList($reverts_phids)); | |||||
| } | } | ||||
| if ($reverted_by_phids) { | if ($reverted_by_phids) { | ||||
| $props[pht('Reverted By')] = $viewer->renderHandleList( | $view->addProperty( | ||||
| $reverted_by_phids); | pht('Reverted By'), | ||||
| $viewer->renderHandleList($reverted_by_phids)); | |||||
| } | } | ||||
| if ($task_phids) { | if ($task_phids) { | ||||
| $task_list = array(); | $task_list = array(); | ||||
| foreach ($task_phids as $phid) { | foreach ($task_phids as $phid) { | ||||
| $task_list[] = $handles[$phid]->renderLink(); | $task_list[] = $handles[$phid]->renderLink(); | ||||
| } | } | ||||
| $task_list = phutil_implode_html(phutil_tag('br'), $task_list); | $task_list = phutil_implode_html(phutil_tag('br'), $task_list); | ||||
| $props['Tasks'] = $task_list; | $view->addProperty( | ||||
| pht('Tasks'), | |||||
| $task_list); | |||||
| } | } | ||||
| return $props; | return $view; | ||||
| } | |||||
| private function buildSubheaderView( | |||||
| PhabricatorRepositoryCommit $commit, | |||||
| PhabricatorRepositoryCommitData $data) { | |||||
| $viewer = $this->getViewer(); | |||||
| $drequest = $this->getDiffusionRequest(); | |||||
| $repository = $drequest->getRepository(); | |||||
| if ($repository->isSVN()) { | |||||
| return null; | |||||
| } | } | ||||
| $author_phid = $data->getCommitDetail('authorPHID'); | |||||
| $author_name = $data->getAuthorName(); | |||||
| $author_epoch = $data->getCommitDetail('authorEpoch'); | |||||
| $date = null; | |||||
| if ($author_epoch !== null) { | |||||
| $date = phabricator_datetime($author_epoch, $viewer); | |||||
| } | |||||
| if ($author_phid) { | |||||
| $handles = $viewer->loadHandles(array($author_phid)); | |||||
| $image_uri = $handles[$author_phid]->getImageURI(); | |||||
| $image_href = $handles[$author_phid]->getURI(); | |||||
| $author = $handles[$author_phid]->renderLink(); | |||||
| } else if (strlen($author_name)) { | |||||
| $author = $author_name; | |||||
| $image_uri = null; | |||||
| $image_href = null; | |||||
| } | |||||
| $author = phutil_tag('strong', array(), $author); | |||||
| if ($date) { | |||||
| $content = pht('Authored by %s on %s.', $author, $date); | |||||
| } else { | |||||
| $content = pht('Authored by %s.', $author); | |||||
| } | |||||
| return id(new PHUIHeadThingView()) | |||||
| ->setImage($image_uri) | |||||
| ->setImageHref($image_href) | |||||
| ->setContent($content); | |||||
| } | |||||
| private function buildComments(PhabricatorRepositoryCommit $commit) { | private function buildComments(PhabricatorRepositoryCommit $commit) { | ||||
| $timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
| $commit, | $commit, | ||||
| new PhabricatorAuditTransactionQuery()); | new PhabricatorAuditTransactionQuery()); | ||||
| $commit->willRenderTimeline($timeline, $this->getRequest()); | $commit->willRenderTimeline($timeline, $this->getRequest()); | ||||
| return $timeline; | return $timeline; | ||||
| } | } | ||||
| private function renderAddCommentPanel( | private function renderAddCommentPanel( | ||||
| PhabricatorRepositoryCommit $commit, | PhabricatorRepositoryCommit $commit, | ||||
| array $audit_requests) { | array $audit_requests) { | ||||
| assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest'); | assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest'); | ||||
| $request = $this->getRequest(); | $request = $this->getRequest(); | ||||
| $user = $request->getUser(); | $viewer = $request->getUser(); | ||||
| if (!$user->isLoggedIn()) { | if (!$viewer->isLoggedIn()) { | ||||
| return id(new PhabricatorApplicationTransactionCommentView()) | return id(new PhabricatorApplicationTransactionCommentView()) | ||||
| ->setUser($user) | ->setUser($viewer) | ||||
| ->setRequestURI($request->getRequestURI()); | ->setRequestURI($request->getRequestURI()); | ||||
| } | } | ||||
| $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | ||||
| $pane_id = celerity_generate_unique_node_id(); | $pane_id = celerity_generate_unique_node_id(); | ||||
| Javelin::initBehavior( | Javelin::initBehavior( | ||||
| 'differential-keyboard-navigation', | 'differential-keyboard-navigation', | ||||
| array( | array( | ||||
| 'haunt' => $pane_id, | 'haunt' => $pane_id, | ||||
| )); | )); | ||||
| $draft = id(new PhabricatorDraft())->loadOneWhere( | $draft = id(new PhabricatorDraft())->loadOneWhere( | ||||
| 'authorPHID = %s AND draftKey = %s', | 'authorPHID = %s AND draftKey = %s', | ||||
| $user->getPHID(), | $viewer->getPHID(), | ||||
| 'diffusion-audit-'.$commit->getID()); | 'diffusion-audit-'.$commit->getID()); | ||||
| if ($draft) { | if ($draft) { | ||||
| $draft = $draft->getDraft(); | $draft = $draft->getDraft(); | ||||
| } else { | } else { | ||||
| $draft = null; | $draft = null; | ||||
| } | } | ||||
| $actions = $this->getAuditActions($commit, $audit_requests); | $actions = $this->getAuditActions($commit, $audit_requests); | ||||
| $mailable_source = new PhabricatorMetaMTAMailableDatasource(); | $mailable_source = new PhabricatorMetaMTAMailableDatasource(); | ||||
| $auditor_source = new DiffusionAuditorDatasource(); | $auditor_source = new DiffusionAuditorDatasource(); | ||||
| $form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
| ->setUser($user) | ->setUser($viewer) | ||||
| ->setAction('/audit/addcomment/') | ->setAction('/audit/addcomment/') | ||||
| ->addHiddenInput('commit', $commit->getPHID()) | ->addHiddenInput('commit', $commit->getPHID()) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormSelectControl()) | id(new AphrontFormSelectControl()) | ||||
| ->setLabel(pht('Action')) | ->setLabel(pht('Action')) | ||||
| ->setName('action') | ->setName('action') | ||||
| ->setID('audit-action') | ->setID('audit-action') | ||||
| ->setOptions($actions)) | ->setOptions($actions)) | ||||
| Show All 16 Lines | $form = id(new AphrontFormView()) | ||||
| ->setDisableBehavior(true) | ->setDisableBehavior(true) | ||||
| ->setDatasource($mailable_source)) | ->setDatasource($mailable_source)) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new PhabricatorRemarkupControl()) | id(new PhabricatorRemarkupControl()) | ||||
| ->setLabel(pht('Comments')) | ->setLabel(pht('Comments')) | ||||
| ->setName('content') | ->setName('content') | ||||
| ->setValue($draft) | ->setValue($draft) | ||||
| ->setID('audit-content') | ->setID('audit-content') | ||||
| ->setUser($user)) | ->setUser($viewer)) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
| ->setValue(pht('Submit'))); | ->setValue(pht('Submit'))); | ||||
| $header = new PHUIHeaderView(); | $header = new PHUIHeaderView(); | ||||
| $header->setHeader( | $header->setHeader( | ||||
| $is_serious ? pht('Audit Commit') : pht('Creative Accounting')); | $is_serious ? pht('Audit Commit') : pht('Creative Accounting')); | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | final class DiffusionCommitController extends DiffusionController { | ||||
| * This shows the user valid actions, and does not show nonsense/invalid | * This shows the user valid actions, and does not show nonsense/invalid | ||||
| * actions (like closing an already-closed commit, or resigning from a commit | * actions (like closing an already-closed commit, or resigning from a commit | ||||
| * you have no association with). | * you have no association with). | ||||
| */ | */ | ||||
| private function getAuditActions( | private function getAuditActions( | ||||
| PhabricatorRepositoryCommit $commit, | PhabricatorRepositoryCommit $commit, | ||||
| array $audit_requests) { | array $audit_requests) { | ||||
| assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest'); | assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest'); | ||||
| $user = $this->getRequest()->getUser(); | $viewer = $this->getViewer(); | ||||
| $user_is_author = ($commit->getAuthorPHID() == $user->getPHID()); | $user_is_author = ($commit->getAuthorPHID() == $viewer->getPHID()); | ||||
| $user_request = null; | $user_request = null; | ||||
| foreach ($audit_requests as $audit_request) { | foreach ($audit_requests as $audit_request) { | ||||
| if ($audit_request->getAuditorPHID() == $user->getPHID()) { | if ($audit_request->getAuditorPHID() == $viewer->getPHID()) { | ||||
| $user_request = $audit_request; | $user_request = $audit_request; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| $actions = array(); | $actions = array(); | ||||
| $actions[PhabricatorAuditActionConstants::COMMENT] = true; | $actions[PhabricatorAuditActionConstants::COMMENT] = true; | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | private function buildMergesTable(PhabricatorRepositoryCommit $commit) { | ||||
| $history_table = id(new DiffusionHistoryTableView()) | $history_table = id(new DiffusionHistoryTableView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setDiffusionRequest($drequest) | ->setDiffusionRequest($drequest) | ||||
| ->setHistory($merges); | ->setHistory($merges); | ||||
| $history_table->loadRevisions(); | $history_table->loadRevisions(); | ||||
| $panel = new PHUIObjectBoxView(); | $panel = id(new PHUIObjectBoxView()) | ||||
| $panel->setHeaderText(pht('Merged Changes')); | ->setHeaderText(pht('Merged Changes')) | ||||
| $panel->setTable($history_table); | ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ||||
| ->setTable($history_table); | |||||
| if ($caption) { | if ($caption) { | ||||
| $panel->setInfoView($caption); | $panel->setInfoView($caption); | ||||
| } | } | ||||
| return $panel; | return $panel; | ||||
| } | } | ||||
| private function renderHeadsupActionList( | private function buildCurtain( | ||||
| PhabricatorRepositoryCommit $commit, | PhabricatorRepositoryCommit $commit, | ||||
| PhabricatorRepository $repository) { | PhabricatorRepository $repository) { | ||||
| $request = $this->getRequest(); | $request = $this->getRequest(); | ||||
| $user = $request->getUser(); | $viewer = $this->getViewer(); | ||||
| $curtain = $this->newCurtainView($commit); | |||||
| $actions = id(new PhabricatorActionListView()) | |||||
| ->setUser($user) | |||||
| ->setObject($commit); | |||||
| $can_edit = PhabricatorPolicyFilter::hasCapability( | $can_edit = PhabricatorPolicyFilter::hasCapability( | ||||
| $user, | $viewer, | ||||
| $commit, | $commit, | ||||
| PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
| $identifier = $commit->getCommitIdentifier(); | $identifier = $commit->getCommitIdentifier(); | ||||
| $uri = $repository->getPathURI("commit/{$identifier}/edit/"); | $uri = $repository->getPathURI("commit/{$identifier}/edit/"); | ||||
| $action = id(new PhabricatorActionView()) | $action = id(new PhabricatorActionView()) | ||||
| ->setName(pht('Edit Commit')) | ->setName(pht('Edit Commit')) | ||||
| ->setHref($uri) | ->setHref($uri) | ||||
| ->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
| ->setDisabled(!$can_edit) | ->setDisabled(!$can_edit) | ||||
| ->setWorkflow(!$can_edit); | ->setWorkflow(!$can_edit); | ||||
| $actions->addAction($action); | $curtain->addAction($action); | ||||
| require_celerity_resource('phabricator-object-selector-css'); | require_celerity_resource('phabricator-object-selector-css'); | ||||
| require_celerity_resource('javelin-behavior-phabricator-object-selector'); | require_celerity_resource('javelin-behavior-phabricator-object-selector'); | ||||
| $maniphest = 'PhabricatorManiphestApplication'; | $maniphest = 'PhabricatorManiphestApplication'; | ||||
| if (PhabricatorApplication::isClassInstalled($maniphest)) { | if (PhabricatorApplication::isClassInstalled($maniphest)) { | ||||
| $action = id(new PhabricatorActionView()) | $action = id(new PhabricatorActionView()) | ||||
| ->setName(pht('Edit Maniphest Tasks')) | ->setName(pht('Edit Maniphest Tasks')) | ||||
| ->setIcon('fa-anchor') | ->setIcon('fa-anchor') | ||||
| ->setHref('/search/attach/'.$commit->getPHID().'/TASK/edge/') | ->setHref('/search/attach/'.$commit->getPHID().'/TASK/edge/') | ||||
| ->setWorkflow(true) | ->setWorkflow(true) | ||||
| ->setDisabled(!$can_edit); | ->setDisabled(!$can_edit); | ||||
| $actions->addAction($action); | $curtain->addAction($action); | ||||
| } | } | ||||
| $action = id(new PhabricatorActionView()) | $action = id(new PhabricatorActionView()) | ||||
| ->setName(pht('Download Raw Diff')) | ->setName(pht('Download Raw Diff')) | ||||
| ->setHref($request->getRequestURI()->alter('diff', true)) | ->setHref($request->getRequestURI()->alter('diff', true)) | ||||
| ->setIcon('fa-download'); | ->setIcon('fa-download'); | ||||
| $actions->addAction($action); | $curtain->addAction($action); | ||||
| return $actions; | return $curtain; | ||||
| } | } | ||||
| private function buildRawDiffResponse(DiffusionRequest $drequest) { | private function buildRawDiffResponse(DiffusionRequest $drequest) { | ||||
| $raw_diff = $this->callConduitWithDiffusionRequest( | $raw_diff = $this->callConduitWithDiffusionRequest( | ||||
| 'diffusion.rawdiffquery', | 'diffusion.rawdiffquery', | ||||
| array( | array( | ||||
| 'commit' => $drequest->getCommit(), | 'commit' => $drequest->getCommit(), | ||||
| 'path' => $drequest->getPath(), | 'path' => $drequest->getPath(), | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | private function buildTableOfContents( | ||||
| $header, | $header, | ||||
| $info_view) { | $info_view) { | ||||
| $drequest = $this->getDiffusionRequest(); | $drequest = $this->getDiffusionRequest(); | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $toc_view = id(new PHUIDiffTableOfContentsListView()) | $toc_view = id(new PHUIDiffTableOfContentsListView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setHeader($header); | ->setHeader($header) | ||||
| ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); | |||||
| if ($info_view) { | if ($info_view) { | ||||
| $toc_view->setInfoView($info_view); | $toc_view->setInfoView($info_view); | ||||
| } | } | ||||
| // TODO: This is hacky, we just want access to the linkX() methods on | // TODO: This is hacky, we just want access to the linkX() methods on | ||||
| // DiffusionView. | // DiffusionView. | ||||
| $diffusion_view = id(new DiffusionEmptyResultView()) | $diffusion_view = id(new DiffusionEmptyResultView()) | ||||
| ▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines | |||||