dominno / django-moderation

django-moderation is reusable application for Django framework, that allows to moderate any model objects.
BSD 3-Clause "New" or "Revised" License
268 stars 91 forks source link

Notifying users | `changed_by` #191

Open tobyspark opened 4 years ago

tobyspark commented 4 years ago

The docs suggest that notification emails will be sent to whoever changed the object –

notify_user Defines if notification e-mails will be send to user. When moderator approves or reject object changes then e-mail notification is send to user that changed this object. It will inform user if his changes were accepted or rejected and inform him why it was rejected or approved. Default: True

However, on investigation for this to happen the changed_by field of moderated_object needs to be set. In my use this was not being set, e.g. in both a DRF serializer and function-based view. I had to set and save this field subsequent to the model save. Am I missing something, or should I file a PR with a documentation change?

DmytroLitvinov commented 4 years ago

Hi @tobyspark , I might had the same unexpected behaviour but I do not remember exactly. Currently, I am not working with that library now so if you could investigate the codebase and provide your opinion on that(with PR updates if needs) - that would be great!

tobyspark commented 4 years ago

I think that keeping this issue open should make the issue visible to those with the symptoms, and it provides a route forward for them. And if they read this, they can comment with what their preferred course of action would be: note it in the documentation, or work up a PR.

There’s merit in either, I’m not sure if it’s possible to guarantee changed_by being set automatically due to the various contexts within which it might be set.