Patchwork FYI: new emails from phabricator can be replied to

login
register
mail settings
Submitter Jun Wu
Date Sept. 7, 2017, 8:24 p.m.
Message ID <1504815738-sup-3214@x1c>
Download mbox | patch
Permalink /patch/23734/
State Not Applicable
Headers show

Comments

Jun Wu - Sept. 7, 2017, 8:24 p.m.
Excerpts from Augie Fackler's message of 2017-09-07 14:54:56 -0400:
> Hopefully this means if you don't have a phabricator account, you can
> still get comments attached to phabricator-sent patches.

By default Phabricator requires "From" address to match an existing user.

I think we can patch Phabricator to allow replying using a dummy user
account if not registered.

Patch

diff --git a/src/applications/metamta/receiver/PhabricatorMailReceiver.php b/src/applications/metamta/receiver/PhabricatorMailReceiver.php
index 05b44f364..2beb88119 100644
--- a/src/applications/metamta/receiver/PhabricatorMailReceiver.php
+++ b/src/applications/metamta/receiver/PhabricatorMailReceiver.php
@@ -100,6 +100,11 @@  abstract class PhabricatorMailReceiver extends Phobject {
 
     // Try to find a user with this email address.
     $user = PhabricatorUser::loadOneWithEmailAddress($from);
+    if (!$user) {
+      // Use a predefined fallback user
+      $from = PhabricatorEnv::getEnvConfigIfExists('metamta.fallback-from');
+      $user = PhabricatorUser::loadOneWithEmailAddress($from);
+    }
     if ($user) {
       return $user;
     } else {