Skip to content

Commit 1a5de83

Browse files
committed
Add support for bookmarks in Phabricator emails.
Summary: Right now emails don't include bookmark info (wasn't added in D2897). Lets include it so it's consistent with the web UI. Test Plan: Inspected code, made sure it matched web UI code. Verified that web UI with these changes was consistent with rendering before refactoring. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Differential Revision: https://secure.phabricator.com/D7215
1 parent 0883ea6 commit 1a5de83

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ public function renderLabelForRevisionView() {
1111
return 'Branch:';
1212
}
1313

14-
public function renderValueForRevisionView() {
15-
$diff = $this->getManualDiff();
16-
14+
private function getBranchOrBookmarkDescription(DifferentialDiff $diff) {
1715
$branch = $diff->getBranch();
1816
$bookmark = $diff->getBookmark();
1917
$has_branch = ($branch != '');
2018
$has_bookmark = ($bookmark != '');
2119
if ($has_branch && $has_bookmark) {
22-
$branch = "{$bookmark} bookmark on {$branch} branch";
20+
return "{$bookmark} bookmark on {$branch} branch";
2321
} else if ($has_bookmark) {
24-
$branch = "{$bookmark} bookmark";
25-
} else if (!$has_branch) {
26-
return null;
22+
return "{$bookmark} bookmark";
23+
} else if ($has_branch) {
24+
return $branch;
2725
}
26+
return null;
27+
}
2828

29-
return $branch;
29+
public function renderValueForRevisionView() {
30+
$diff = $this->getManualDiff();
31+
return $this->getBranchOrBookmarkDescription($diff);
3032
}
3133

3234
public function renderValueForMail($phase) {
@@ -39,11 +41,13 @@ public function renderValueForMail($phase) {
3941

4042
$diff = $this->getRevision()->loadActiveDiff();
4143
if ($diff) {
42-
$branch = $diff->getBranch();
43-
if ($branch) {
44-
return "BRANCH\n $branch";
44+
$description = $this->getBranchOrBookmarkDescription($diff);
45+
if ($description) {
46+
return "BRANCH\n {$description}";
4547
}
4648
}
49+
50+
return null;
4751
}
4852

4953
public function didWriteRevision(DifferentialRevisionEditor $editor) {

0 commit comments

Comments
 (0)