mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 04:32:43 +01:00
(stable) Recover gracefully from Conduit failure when building "Tags" field in commit mail
Summary: Ref T9458. This is basically the same as D13319, but the "Tags" field didn't get covered in that change. Specifically, the issue is: - We try to generate mail to a disabled user (later, we'll drop it without delivering it, but that filtering doesn't happen yet). - The disabled user doesn't have permission to use Conduit (or any other Conduit-related problem occurs). - We fail here, then retry generating the mail again later. Instead, just degrade to not building the field and showing what went wrong. Test Plan: - Pushed some commits, saw mail generate. - Added a fake exception to the field, saw the mail generate with an error message. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9458 Differential Revision: https://secure.phabricator.com/D14142
This commit is contained in:
parent
22e60f9fbd
commit
9a651c18ec
1 changed files with 14 additions and 9 deletions
|
@ -29,18 +29,23 @@ final class PhabricatorCommitTagsField
|
||||||
'callsign' => $this->getObject()->getRepository()->getCallsign(),
|
'callsign' => $this->getObject()->getRepository()->getCallsign(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$tags_raw = id(new ConduitCall('diffusion.tagsquery', $params))
|
try {
|
||||||
->setUser($this->getViewer())
|
$tags_raw = id(new ConduitCall('diffusion.tagsquery', $params))
|
||||||
->execute();
|
->setUser($this->getViewer())
|
||||||
|
->execute();
|
||||||
|
|
||||||
$tags = DiffusionRepositoryTag::newFromConduit($tags_raw);
|
$tags = DiffusionRepositoryTag::newFromConduit($tags_raw);
|
||||||
if (!$tags) {
|
if (!$tags) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
$tag_names = mpull($tags, 'getName');
|
||||||
|
sort($tag_names);
|
||||||
|
$tag_names = implode(', ', $tag_names);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
$tag_names = pht('<%s: %s>', get_class($ex), $ex->getMessage());
|
||||||
}
|
}
|
||||||
$tag_names = mpull($tags, 'getName');
|
|
||||||
sort($tag_names);
|
|
||||||
|
|
||||||
$body->addTextSection(pht('TAGS'), implode(', ', $tag_names));
|
$body->addTextSection(pht('TAGS'), $tag_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue