1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02: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:';
}
public function renderValueForRevisionView() {
$diff = $this->getManualDiff();
private function getBranchOrBookmarkDescription(DifferentialDiff $diff) {
$branch = $diff->getBranch();
$bookmark = $diff->getBookmark();
$has_branch = ($branch != '');
$has_bookmark = ($bookmark != '');
if ($has_branch && $has_bookmark) {
$branch = "{$bookmark} bookmark on {$branch} branch";
return "{$bookmark} bookmark on {$branch} branch";
} else if ($has_bookmark) {
$branch = "{$bookmark} bookmark";
} else if (!$has_branch) {
return null;
return "{$bookmark} bookmark";
} else if ($has_branch) {
return $branch;
}
return null;
}
return $branch;
public function renderValueForRevisionView() {
$diff = $this->getManualDiff();
return $this->getBranchOrBookmarkDescription($diff);
}
public function renderValueForMail($phase) {
@ -39,11 +41,13 @@ final class DifferentialBranchFieldSpecification
$diff = $this->getRevision()->loadActiveDiff();
if ($diff) {
$branch = $diff->getBranch();
if ($branch) {
return "BRANCH\n $branch";
$description = $this->getBranchOrBookmarkDescription($diff);
if ($description) {
return "BRANCH\n {$description}";
}
}
return null;
}
public function didWriteRevision(DifferentialRevisionEditor $editor) {