@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.

Make some Herald errors more spider-resistant

Summary:
Fixes T9328. There's no way to hit these error states by clicking things in the UI that I could find, but if you mash stuff into your URL bar or "Inspect Element..." and then edit the form to be full of garbage you can hit them.

Make them a little more informative and don't send them to the log, since these are pretty much just fancy 404s.

Test Plan: Bashed my fist on the URL bar to hit all these messages.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9328

Differential Revision: https://secure.phabricator.com/D14164

+31 -7
+31 -7
src/applications/herald/controller/HeraldRuleController.php
··· 24 24 } 25 25 $cancel_uri = $this->getApplicationURI("rule/{$id}/"); 26 26 } else { 27 + $new_uri = $this->getApplicationURI('new/'); 28 + 27 29 $rule = new HeraldRule(); 28 30 $rule->setAuthorPHID($viewer->getPHID()); 29 31 $rule->setMustMatchAll(1); ··· 33 35 34 36 $rule_type = $request->getStr('rule_type'); 35 37 if (!isset($rule_type_map[$rule_type])) { 36 - $rule_type = HeraldRuleTypeConfig::RULE_TYPE_PERSONAL; 38 + return $this->newDialog() 39 + ->setTitle(pht('Invalid Rule Type')) 40 + ->appendParagraph( 41 + pht( 42 + 'The selected rule type ("%s") is not recognized by Herald.', 43 + $rule_type)) 44 + ->addCancelButton($new_uri); 37 45 } 38 46 $rule->setRuleType($rule_type); 39 47 40 - $adapter = HeraldAdapter::getAdapterForContentType( 41 - $rule->getContentType()); 48 + try { 49 + $adapter = HeraldAdapter::getAdapterForContentType( 50 + $rule->getContentType()); 51 + } catch (Exception $ex) { 52 + return $this->newDialog() 53 + ->setTitle(pht('Invalid Content Type')) 54 + ->appendParagraph( 55 + pht( 56 + 'The selected content type ("%s") is not recognized by '. 57 + 'Herald.', 58 + $rule->getContentType())) 59 + ->addCancelButton($new_uri); 60 + } 42 61 43 62 if (!$adapter->supportsRuleType($rule->getRuleType())) { 44 - throw new Exception( 45 - pht( 46 - "This rule's content type does not support the selected rule ". 47 - "type.")); 63 + return $this->newDialog() 64 + ->setTitle(pht('Rule/Content Mismatch')) 65 + ->appendParagraph( 66 + pht( 67 + 'The selected rule type ("%s") is not supported by the selected '. 68 + 'content type ("%s").', 69 + $rule->getRuleType(), 70 + $rule->getContentType())) 71 + ->addCancelButton($new_uri); 48 72 } 49 73 50 74 if ($rule->isObjectRule()) {