Excerpts from Jun Wu's message of 2017-09-07 13:24:27 -0700:
> 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.
> 
> 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 {

Sorry but the above code missed a "null" check. I didn't have email infra to
test the patch but in theory it should work:


diff --git a/src/applications/metamta/receiver/PhabricatorMailReceiver.php 
b/src/applications/metamta/receiver/PhabricatorMailReceiver.php
index 05b44f364..030962142 100644
--- a/src/applications/metamta/receiver/PhabricatorMailReceiver.php
+++ b/src/applications/metamta/receiver/PhabricatorMailReceiver.php
@@ -100,6 +100,13 @@ abstract class PhabricatorMailReceiver extends Phobject {
 
     // Try to find a user with this email address.
     $user = PhabricatorUser::loadOneWithEmailAddress($from);
+    if (!$user) {
+      // Use a predefined default user
+      $from = PhabricatorEnv::getEnvConfigIfExists('metamta.fallback-from');
+      if ($from) {
+        $user = PhabricatorUser::loadOneWithEmailAddress($from);
+      }
+    }
     if ($user) {
       return $user;
     } else {
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to