Support not sending e-mails on WebAPI token creation
Review Request #9258 — Created Oct. 10, 2017 and submitted
Currently when a WebAPI token is created, we always send an e-mail
notifying the user of its creation. However, this is not always ideal.
Some extensions and/or integrations require a WebAPI token in order to
communicate with Review Board from some external service (such as
CircleCI). In this case, we do not need to bother the user with a
notification that the token was created.Djblets now has support for token update and create signals (via
/r/9275). We use these signals to determine if the token generated was
auto-generated. The notifications module has been modified to listen
to the new signals (instead of the genericpost_save
signal it was
listening to before) and not send e-mails when the token in question
is auto-generated.
Ran unit tests.
Description | From | Last Updated |
---|---|---|
F841 local variable 'webapi_token' is assigned to but never used |
reviewbot | |
F401 'reviewboard.webapi.signals.webapi_token_created' imported but unused |
reviewbot | |
At this point it might be nice to turn this into a table with signal, handler, sender and then iterate … |
david | |
We could just have a signal for this in djblets. It's definitely possible that other consumers of djblets.webapi will have … |
david | |
F401 'reviewboard.webapi.managers.WebAPITokenManager' imported but unused |
reviewbot | |
F401 'reviewboard.webapi.signals.webapi_token_updated' imported but unused |
reviewbot | |
Maybe a list of tuples? |
david | |
This docstring needs to be updated now. |
david | |
The outbox should default to [] at the beginning of every test. I think you can get rid of this … |
david | |
I think other things assertEqual(len(mail.outbox), 0) |
david | |
This can fit on one line. |
chipx86 | |
"WebAPIToken" |
chipx86 |
- Commit:
-
ae136263f6f7459e3ce78b48e25d0026b5b6586c630e90eb4669427a9cc8bfd06de47b092062fe91
Checks run (2 succeeded)
- Change Summary:
-
Use a table of signals and loop through it
- Commit:
-
630e90eb4669427a9cc8bfd06de47b092062fe915be1a7f85d2dcfc9176275ce31195acb8f272eac
Checks run (2 succeeded)
- Change Summary:
-
Move signals into /r/9275/
- Description:
-
Currently when a WebAPI token is created, we always send an e-mail
notifying the user of its creation. However, this is not always ideal. Some extensions and/or integrations require a WebAPI token in order to communicate with Review Board from some external service (such as CircleCI). In this case, we do not need to bother the user with a notification that the token was created. ~ To accomplish this, we now have specific WebAPI creation/update signals,
~ as well as a more specialized manager for the WebAPIToken
class so~ that we may specify at creation time whether or not an e-mail will be ~ sent. Currently the only way to not send an e-mail is via this manager. ~ ~ The notifications module has been modified to listen to these new
~ Djblets now has support for token update and create signals (via
~ /r/9275). We use these signals to determine if the token generated was ~ auto-generated. The notifications module has been modified to listen ~ to the new signals (instead of the generic post_save
signal it was~ listening to before) and not send e-mails when the token in question ~ is auto-generated. - signals (instead of the generic post_save
signal it was listening to- before) and conditionally not send e-mails when requested. - - Testing done:
- Ran unit tests. - Commit:
-
5be1a7f85d2dcfc9176275ce31195acb8f272eac23b1d7a8157d2c7c4840d9506fe3b52286a7729a
- Commit:
-
23b1d7a8157d2c7c4840d9506fe3b52286a7729a40d45803bf5ab164b6373048e5d08f9d825df73c
Checks run (2 succeeded)
- Depends On:
- Change Summary:
-
Addressed David's issues
- Commit:
-
40d45803bf5ab164b6373048e5d08f9d825df73c2312e9f8fc2ea984d1f73d336c7ceef23d69bc0b