1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 04:20:55 +01:00

Add addLinkSection to MailBody to properly format URIs

Summary: Fixes T6343. Grepped for all callsites and added addLinkSection where needed.

Test Plan: Tested Differential, Maniphest, Conpherence, Ponder and Macro. Inspect HTML mail for anchor tags. Inspect text mails for non-disruption.

Reviewers: epriestley, btrahan

Reviewed By: btrahan

Subscribers: talshiri, Korvin, epriestley

Maniphest Tasks: T6343

Differential Revision: https://secure.phabricator.com/D10762
This commit is contained in:
Chad Little 2014-10-30 15:24:10 -07:00
parent a9fc343d9e
commit 1ac84c1b59
17 changed files with 23 additions and 18 deletions

View file

@ -678,7 +678,7 @@ final class PhabricatorAuditEditor
$monogram = $object->getRepository()->formatCommitName(
$object->getCommitIdentifier());
$body->addTextSection(
$body->addLinkSection(
pht('COMMIT'),
PhabricatorEnv::getProductionURI('/'.$monogram));

View file

@ -405,7 +405,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
array $xactions) {
$body = parent::buildMailBody($object, $xactions);
$body->addTextSection(
$body->addLinkSection(
pht('CONPHERENCE DETAIL'),
PhabricatorEnv::getProductionURI('/conpherence/'.$object->getID().'/'));

View file

@ -54,7 +54,7 @@ final class DifferentialChangesSinceLastUpdateField
$uri = '/'.$revision->getMonogram().'?vs='.$old_id.'&id='.$new_id;
$uri = PhabricatorEnv::getProductionURI($uri);
$body->addTextSection(pht('CHANGES SINCE LAST UPDATE'), $uri);
$body->addLinkSection(pht('CHANGES SINCE LAST UPDATE'), $uri);
}
}

View file

@ -1140,7 +1140,7 @@ final class DifferentialTransactionEditor
$changed_uri = $this->getChangedPriorToCommitURI();
if ($changed_uri) {
$body->addTextSection(
$body->addLinkSection(
pht('CHANGED PRIOR TO COMMIT'),
$changed_uri);
}
@ -1151,7 +1151,7 @@ final class DifferentialTransactionEditor
$this->renderInlineCommentsForMail($object, $inlines));
}
$body->addTextSection(
$body->addLinkSection(
pht('REVISION DETAIL'),
PhabricatorEnv::getProductionURI('/D'.$object->getID()));

View file

@ -267,7 +267,7 @@ final class FundInitiativeEditor
$body = parent::buildMailBody($object, $xactions);
$body->addTextSection(
$body->addLinkSection(
pht('INITIATIVE DETAIL'),
PhabricatorEnv::getProductionURI('/'.$object->getMonogram()));

View file

@ -194,7 +194,7 @@ final class LegalpadDocumentEditor
$body = parent::buildMailBody($object, $xactions);
$body->addTextSection(
$body->addLinkSection(
pht('DOCUMENT DETAIL'),
PhabricatorEnv::getProductionURI('/legalpad/view/'.$object->getID().'/'));

View file

@ -173,7 +173,7 @@ final class PhabricatorMacroEditor
array $xactions) {
$body = parent::buildMailBody($object, $xactions);
$body->addTextSection(
$body->addLinkSection(
pht('MACRO DETAIL'),
PhabricatorEnv::getProductionURI('/macro/view/'.$object->getID().'/'));

View file

@ -497,7 +497,7 @@ final class ManiphestTransactionEditor
$object->getDescription());
}
$body->addTextSection(
$body->addLinkSection(
pht('TASK DETAIL'),
PhabricatorEnv::getProductionURI('/T'.$object->getID()));

View file

@ -82,7 +82,13 @@ final class PhabricatorMetaMTAMailBody {
phutil_tag('div', array('style' => 'font-weight:800;'), $header),
$html_fragment,
);
return $this;
}
public function addLinkSection($header, $link) {
$html = phutil_tag('a', array('href' => $link), $link);
$this->addPlaintextSection($header, $link);
$this->addHTMLSection($header, $html);
return $this;
}
@ -98,7 +104,7 @@ final class PhabricatorMetaMTAMailBody {
return $this;
}
$this->addTextSection(
$this->addLinkSection(
pht('WHY DID I GET THIS EMAIL?'),
PhabricatorEnv::getProductionURI($xscript_uri));

View file

@ -22,7 +22,6 @@ final class PhabricatorMetaMTAMailSection {
public function addHTMLFragment($fragment) {
$this->htmlFragments[] = $fragment;
return $this;
}
public function addPlaintextFragment($fragment) {

View file

@ -167,7 +167,7 @@ final class PhabricatorPasteEditor
$body = parent::buildMailBody($object, $xactions);
$body->addTextSection(
$body->addLinkSection(
pht('PASTE DETAIL'),
PhabricatorEnv::getProductionURI('/P'.$object->getID()));

View file

@ -409,7 +409,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
}
}
$body->addTextSection(
$body->addLinkSection(
pht('MOCK DETAIL'),
PhabricatorEnv::getProductionURI('/M'.$object->getID()));

View file

@ -123,7 +123,7 @@ final class PhortuneCartEditor
$body->addTextSection(pht('ORDER CONTENTS'), implode("\n", $items));
$body->addTextSection(
$body->addLinkSection(
pht('ORDER DETAIL'),
PhabricatorEnv::getProductionURI('/phortune/cart/'.$object->getID().'/'));

View file

@ -242,7 +242,7 @@ final class PhrictionTransactionEditor
$object->getContent()->getContent());
}
$body->addTextSection(
$body->addLinkSection(
pht('DOCUMENT DETAIL'),
PhabricatorEnv::getProductionURI(
PhrictionDocument::getSlugURI($object->getSlug())));

View file

@ -98,7 +98,7 @@ final class PonderAnswerEditor extends PonderEditor {
}
}
$body->addTextSection(
$body->addLinkSection(
pht('ANSWER DETAIL'),
PhabricatorEnv::getProductionURI($object->getURI()));

View file

@ -243,7 +243,7 @@ final class PonderQuestionEditor
}
}
$body->addTextSection(
$body->addLinkSection(
$header,
PhabricatorEnv::getProductionURI($uri));

View file

@ -70,7 +70,7 @@ final class PhabricatorRepositoryPushMailWorker
$body = new PhabricatorMetaMTAMailBody();
$body->addRawSection($overview);
$body->addTextSection(pht('DETAILS'), $details_uri);
$body->addLinkSection(pht('DETAILS'), $details_uri);
if ($commit_lines) {
$body->addTextSection(pht('COMMITS'), implode("\n", $commit_lines));