1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

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
This commit is contained in:
Neal Poole 2013-10-04 00:28:52 -07:00
parent 0883ea6977
commit 1a5de83ad1

View file

@ -11,22 +11,24 @@ final class DifferentialBranchFieldSpecification
return 'Branch:'; return 'Branch:';
} }
public function renderValueForRevisionView() { private function getBranchOrBookmarkDescription(DifferentialDiff $diff) {
$diff = $this->getManualDiff();
$branch = $diff->getBranch(); $branch = $diff->getBranch();
$bookmark = $diff->getBookmark(); $bookmark = $diff->getBookmark();
$has_branch = ($branch != ''); $has_branch = ($branch != '');
$has_bookmark = ($bookmark != ''); $has_bookmark = ($bookmark != '');
if ($has_branch && $has_bookmark) { if ($has_branch && $has_bookmark) {
$branch = "{$bookmark} bookmark on {$branch} branch"; return "{$bookmark} bookmark on {$branch} branch";
} else if ($has_bookmark) { } else if ($has_bookmark) {
$branch = "{$bookmark} bookmark"; return "{$bookmark} bookmark";
} else if (!$has_branch) { } else if ($has_branch) {
return null; return $branch;
} }
return null;
}
return $branch; public function renderValueForRevisionView() {
$diff = $this->getManualDiff();
return $this->getBranchOrBookmarkDescription($diff);
} }
public function renderValueForMail($phase) { public function renderValueForMail($phase) {
@ -39,11 +41,13 @@ final class DifferentialBranchFieldSpecification
$diff = $this->getRevision()->loadActiveDiff(); $diff = $this->getRevision()->loadActiveDiff();
if ($diff) { if ($diff) {
$branch = $diff->getBranch(); $description = $this->getBranchOrBookmarkDescription($diff);
if ($branch) { if ($description) {
return "BRANCH\n $branch"; return "BRANCH\n {$description}";
} }
} }
return null;
} }
public function didWriteRevision(DifferentialRevisionEditor $editor) { public function didWriteRevision(DifferentialRevisionEditor $editor) {