@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix error for URL's that could mean several commits

Summary: Ref T13001, URLs that return multiple commits should show a list of those commits. Not sure if the actual list looks very pretty this way, but was wondering if this approach was vaguely correct.

Test Plan:
- Navigate to `install/rPbd3c23`
- User should see a list view providing links to `install/rPbd3c2355e8e2b220ae5e3cbfe4a057c8088c6a38` and `install/rPbd3c239d5aada68a31db5742bbb8ec099074a561`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T13001

Differential Revision: https://secure.phabricator.com/D18816

authored by

lkassianik and committed by
lpriestley
46d496b8 c924351a

+40 -4
+40 -4
src/applications/diffusion/controller/DiffusionCommitController.php
··· 39 39 return $this->buildRawDiffResponse($drequest); 40 40 } 41 41 42 - $commit = id(new DiffusionCommitQuery()) 42 + $commits = id(new DiffusionCommitQuery()) 43 43 ->setViewer($viewer) 44 44 ->withRepository($repository) 45 45 ->withIdentifiers(array($commit_identifier)) 46 46 ->needCommitData(true) 47 47 ->needAuditRequests(true) 48 - ->executeOne(); 48 + ->setLimit(100) 49 + ->execute(); 50 + 51 + $multiple_results = count($commits) > 1; 49 52 50 53 $crumbs = $this->buildCrumbs(array( 51 - 'commit' => true, 54 + 'commit' => !$multiple_results, 52 55 )); 53 56 $crumbs->setBorder(true); 54 57 55 - if (!$commit) { 58 + if (!$commits) { 56 59 if (!$this->getCommitExists()) { 57 60 return new Aphront404Response(); 58 61 } ··· 70 73 ->setTitle($title) 71 74 ->setCrumbs($crumbs) 72 75 ->appendChild($error); 76 + } else if ($multiple_results) { 73 77 78 + $warning_message = 79 + pht( 80 + 'The identifier %s is ambiguous and matches more than one commit.', 81 + phutil_tag( 82 + 'strong', 83 + array(), 84 + $commit_identifier)); 85 + 86 + $error = id(new PHUIInfoView()) 87 + ->setTitle(pht('Ambiguous Commit')) 88 + ->setSeverity(PHUIInfoView::SEVERITY_WARNING) 89 + ->appendChild($warning_message); 90 + 91 + $list = id(new DiffusionCommitListView()) 92 + ->setViewer($viewer) 93 + ->setCommits($commits) 94 + ->setNoDataString(pht('No recent commits.')); 95 + 96 + $crumbs->addTextCrumb(pht('Ambiguous Commit')); 97 + 98 + $matched_commits = id(new PHUITwoColumnView()) 99 + ->setFooter(array( 100 + $error, 101 + $list, 102 + )); 103 + 104 + return $this->newPage() 105 + ->setTitle(pht('Ambiguous Commit')) 106 + ->setCrumbs($crumbs) 107 + ->appendChild($matched_commits); 108 + } else { 109 + $commit = head($commits); 74 110 } 75 111 76 112 $audit_requests = $commit->getAudits();