Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14120374
D20586.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D20586.diff
View Options
diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php
--- a/src/applications/audit/editor/PhabricatorAuditEditor.php
+++ b/src/applications/audit/editor/PhabricatorAuditEditor.php
@@ -485,7 +485,8 @@
return $phids;
}
- protected function getObjectLinkButtonLabelForMail() {
+ protected function getObjectLinkButtonLabelForMail(
+ PhabricatorLiskDAO $object) {
return pht('View Commit');
}
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -601,7 +601,8 @@
return $xactions;
}
- protected function getObjectLinkButtonLabelForMail() {
+ protected function getObjectLinkButtonLabelForMail(
+ PhabricatorLiskDAO $object) {
return pht('View Revision');
}
@@ -614,8 +615,7 @@
$body = id(new PhabricatorMetaMTAMailBody())
->setViewer($viewer);
- $revision_uri = $object->getURI();
- $revision_uri = PhabricatorEnv::getProductionURI($revision_uri);
+ $revision_uri = $this->getObjectLinkButtonURIForMail($object);
$new_uri = $revision_uri.'/new/';
$this->addHeadersAndCommentsToMailBody(
diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
--- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php
+++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
@@ -206,7 +206,8 @@
->setSubject("T{$id}: {$title}");
}
- protected function getObjectLinkButtonLabelForMail() {
+ protected function getObjectLinkButtonLabelForMail(
+ PhabricatorLiskDAO $object) {
return pht('View Task');
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -3423,17 +3423,39 @@
->setContextObject($object);
$button_label = $this->getObjectLinkButtonLabelForMail($object);
+ $button_uri = $this->getObjectLinkButtonURIForMail($object);
+
+ $this->addHeadersAndCommentsToMailBody(
+ $body,
+ $xactions,
+ $button_label,
+ $button_uri);
- $this->addHeadersAndCommentsToMailBody($body, $xactions, $button_label);
$this->addCustomFieldsToMailBody($body, $object, $xactions);
return $body;
}
- protected function getObjectLinkButtonLabelForMail() {
+ protected function getObjectLinkButtonLabelForMail(
+ PhabricatorLiskDAO $object) {
return null;
}
+ protected function getObjectLinkButtonURIForMail(
+ PhabricatorLiskDAO $object) {
+
+ // Most objects define a "getURI()" method which does what we want, but
+ // this isn't formally part of an interface at time of writing. Try to
+ // call the method, expecting an exception if it does not exist.
+
+ try {
+ $uri = $object->getURI();
+ return PhabricatorEnv::getProductionURI($uri);
+ } catch (Exception $ex) {
+ return null;
+ }
+ }
+
/**
* @task mail
*/
@@ -3455,7 +3477,7 @@
PhabricatorMetaMTAMailBody $body,
array $xactions,
$object_label = null,
- $object_href = null) {
+ $object_uri = null) {
// First, remove transactions which shouldn't be rendered in mail.
foreach ($xactions as $key => $xaction) {
@@ -3521,7 +3543,7 @@
$headers_html = phutil_implode_html(phutil_tag('br'), $headers_html);
$header_button = null;
- if ($object_label !== null) {
+ if ($object_label !== null && $object_uri !== null) {
$button_style = array(
'text-decoration: none;',
'padding: 4px 8px;',
@@ -3540,7 +3562,7 @@
'a',
array(
'style' => implode(' ', $button_style),
- 'href' => $object_href,
+ 'href' => $object_uri,
),
$object_label);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 8:27 AM (4 h, 45 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6808435
Default Alt Text
D20586.diff (4 KB)
Attached To
Mode
D20586: Fix missing link targets for "View Object" header buttons in HTML email
Attached
Detach File
Event Timeline
Log In to Comment