bugfix: Do not send HTTP request when creating a local notification

This commit is contained in:
Christophe
2019-12-13 15:51:36 +01:00
parent 9416c27971
commit 8946dbf78f
3 changed files with 70 additions and 18 deletions

View File

@ -32,7 +32,18 @@ An object allowing a User to be notified of any change on a resource or a contai
| `object` | `URLField` | | ID of the resource or the container to watch |
| `inbox` | `URLField` | | ID of the inbox to notify when the resource or the container change |
# Middlewares
There is a `CurrentUserMiddleware` that catches the connected user of the last performed HTTP request and adds
to every model before it is saved. This is useful if you need to get the connected user that performed
the last HTTP request in a `pre_saved` signal. You can get it by using the following line :
```python
getattr(instance, MODEL_MODIFICATION_USER_FIELD, "Unknown user")
```
`MODEL_MODIFICATION_USER_FIELD` is a constant that lies in `djangoldp_notification.middlewares` and
`instance` is the instance of your model before save in DB.
# Signals
@ -40,8 +51,6 @@ An object allowing a User to be notified of any change on a resource or a contai
When an object is saved, a notification is created for all the subscriptions related to this object.
## Send email when new notification
When a notification is created, an email is sent to the user.