#959 copr-fe-dev shouldn't send emails to everybody
Merged 6 years ago by praiskup. Opened 6 years ago by schlupov.
copr/ schlupov/copr sending_emails  into  master

No commits found

rebased onto de97ef30539cc73d64d99d80c48b3dbcab4a3351

6 years ago

why this if condition? Just use send_mail([user.mail]), unless you really expect that user.mail variable can hold array value.

rebased onto 9d771f85357e1a801702fbeff9f6e8e43144a7e5

6 years ago

1 new commit added

  • Adding test for function filter_recipients
6 years ago

nitpick, don't you want to s/recepient/recepients/? And fix the comment to "List of recepient emails" or something?

I'd simply do:

if not app.config["WHITELIST_EMAILS"]: 
    return recepients

Because if the config option is empty (production), it is useless to iterate over all the recipients.

and you can do return [r for r in recepients if r in app.config["WHITELIST_EMAILS"]]

rebased onto 95def9224952b2e2cdafa03ca3085fbf2026e9cf

6 years ago

Personally, I would preserve the same input types for send_mail function (i.e. both one email or list of emails) and therefore omitting this and many similar changes like this one that are lower in this PR.

It was added in the same commit as the whitelisting feature, but it is not necessary for that feature, so I am interested in the idea behind it :-)

Aha, that was probably related to this, right?

nitpick, don't you want to s/recepient/recepients/? And fix the comment to "List of recepient emails" or something?

@praiskup do you prefer it this way?

Yeah, I sort of disliked doing if type(recepient) on multiple places. No huge preference, it was rather suggestion since I think that stronger typing is usually better.

nitpick: I would prefer a slightly longer, but more descriptive function name, e.g. filter_whitelisted_recipients. This is IMHO too generic and when reading its name, I have no idea why/what would I even filter.

I believed that we removed this multiple-types-for-one-arguments from send_mail, if we did not - we should IMO

nitpick: I am absolutely aware of how unimportant this is for the majority of people, and how annoying I am for always pointing that out, but can you please move the condition above the with statement, reverse it to if not ... and return if it is met? This will avoid unnecessary nesting and make me happy. Also, it would be a good idea to log some message, that the email will not be sent because there is no whitelisted recipient.

Ok, no problem with me. Let's accept just list of email addresses. I was just a little bit confused because it was in the same commit as the feature and they are not related to each other.

Ok, I think we should have these two commits squashed.

rebased onto 78be9b966b6513c9eb33a4ed7d1a109838e7bd0f

6 years ago

rebased onto 05e170c8399b4ecfe13250686bd2221dd95f88bf

6 years ago

rebased onto 81f2925

6 years ago

Commit 51e452a fixes this pull-request

Pull-Request has been merged by praiskup

6 years ago