@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+14 -9
+14 -9
src/applications/repository/customfield/PhabricatorCommitTagsField.php
··· 29 29 'callsign' => $this->getObject()->getRepository()->getCallsign(), 30 30 ); 31 31 32 - $tags_raw = id(new ConduitCall('diffusion.tagsquery', $params)) 33 - ->setUser($this->getViewer()) 34 - ->execute(); 32 + try { 33 + $tags_raw = id(new ConduitCall('diffusion.tagsquery', $params)) 34 + ->setUser($this->getViewer()) 35 + ->execute(); 35 36 36 - $tags = DiffusionRepositoryTag::newFromConduit($tags_raw); 37 - if (!$tags) { 38 - return; 37 + $tags = DiffusionRepositoryTag::newFromConduit($tags_raw); 38 + if (!$tags) { 39 + return; 40 + } 41 + $tag_names = mpull($tags, 'getName'); 42 + sort($tag_names); 43 + $tag_names = implode(', ', $tag_names); 44 + } catch (Exception $ex) { 45 + $tag_names = pht('<%s: %s>', get_class($ex), $ex->getMessage()); 39 46 } 40 - $tag_names = mpull($tags, 'getName'); 41 - sort($tag_names); 42 47 43 - $body->addTextSection(pht('TAGS'), implode(', ', $tag_names)); 48 + $body->addTextSection(pht('TAGS'), $tag_names); 44 49 } 45 50 46 51 }