Wednesday, November 23, 2016

The controller of a notifiction message

On 22/11/16 14:51, Mathieu wrote:

Peux-tu enlever de la page d’accueil le panneau « Mes messages » ? Ca fait double emploi avec la réception des mails et la panneau salle d’attente.

Mathieu a absolument raison en observant que cela fait double emploi. Il faut différencier deux types de messages:

  • “Client X a été modifié par user Y”

  • “Client X t’attend dans la salle d’attente”

Le premier a besoin d’un méchanisme pour éviter d’envoyer dix mails quand un collègue fait dix petites modifications successives dans le dossier d’un bénéficiaire donné, pour le deuxième ce méchanisme n’a pas de sens.

This “mechanism” is exactly why we have the owner lino.modlib.notify.models.Message.owner> field.

CheckinVisitor should not create a “controlled” message because we don’t want that mechanism there.

CheckinVisitor inherits from NotifyingAction. It seems that the normal situation is to have no controller. So I changed lino.modlib.notify.actions.NotifyingAction.get_notify_owner() to return None (i.e. no longer the object on which the action was triggered).

That’s a little change, and I am trying to document what I am learning, but the notification system is still not finished. We are learning by doing here. For example User.notifyme_mode must not be a checkbox but a ChoiceList (Never, Instantly, Daily summary, Weekly summary, …)

And both daily and often email sender tasks should always run (this should not depend on whether use_websockets is set or not.