mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +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:
parent
0883ea6977
commit
1a5de83ad1
1 changed files with 15 additions and 11 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue