Hi,
On Wed, Apr 5, 2017 at 11:31 PM, Emmanuel BOUAZIZ
<[email protected]> wrote:
> I aligned on v1.2.1 when it was released and suddenly most users didn't get
> notifications anymore. They were all users
> that do not have an email address: we use the `use_short_addr` option so we
> don't need to fill the email address.
>
> I noticed the modifications in ticket #12658
>
> in `mail.py` in the `match_recipient()` function in `RecipientMatcher` :
>
> before #12658, a user with no email address would not appear in
> `self.email_map` and `use_short_addr` or `smtp_default_domain` options would
> be applied.
>
> Now, any authenticated user in the database will appear in `self.users` so
> we always run the `if address in self.users:` branch for authenticated users
> and never the `elif ...` branch and the `use_short_addr` or
> `smtp_default_domain` options are never applied to these users.
>
> So this these options are broken now in this case.
Thanks for the investigating and the details.
It seems another issue is introduced by r15356 for #12658.
Could you try the attached patch? (authenticated-user-without-email.diff)
I'll add unit tests if the patch works well.
> I did not know if I should re-open the ticket or create a new one so I did
> neither.
> I also don't have a patch because the logic looks complicated with lots of
> use-cases that I don't even know exist, sorry.
Please create a new ticket about this issue.
--
Jun Omae <[email protected]> (大前 潤)
--
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.
diff --git a/trac/notification/mail.py b/trac/notification/mail.py
index 6c6adcfed..917597256 100644
--- a/trac/notification/mail.py
+++ b/trac/notification/mail.py
@@ -204,7 +204,7 @@ class RecipientMatcher(object):
return self.notify_sys.smtp_default_domain
def match_recipient(self, address):
- if not address:
+ if not address or address == 'anonymous':
return None
def is_email(address):
@@ -215,19 +215,17 @@ class RecipientMatcher(object):
return False
return True
- if address == 'anonymous':
- return None
- sid = None
- auth = 0
if address in self.users:
sid = address
auth = 1
- address = self.users[address][1]
- if not address:
- return sid, auth, None
- elif not is_email(address) and self.nodomaddr_re.match(address):
+ address = (self.users[address][1] or '').strip() or sid
+ else:
+ sid = None
+ auth = 0
+
+ if not is_email(address) and self.nodomaddr_re.match(address):
if self.use_short_addr:
- return None, 0, address
+ return sid, auth, address
if self.smtp_default_domain:
address = "%s@%s" % (address, self.smtp_default_domain)
else: