Monday, March 5, 2018

I did an apt upgrade on The Lino framework.

I continued on #2333. The last piece of the jigsaw puzzle is an interface for defining applicaton-specific notification types.

Short analysis where message types were being used until now:

  • ChangeObserver has a default message type “change”

  • notify fixture demo manually emits a notification “The database has been initialized” of type “system”.

  • lino_welfare.modlib.pcsw : RefuseClient action emits a notification of type “action”, message text is based on RefusalReasons.

  • lino_welfare.modlib.reception.CreateClientVisit uses type “change”

  • tickets when assigned_to field changes, the Ticket model emits a “action” message.

  • after creating a ticket

Side effect:

Code changes:

  • MessageType.__init__() : the ‘value’ and ‘name’ of a message type must be the same.

  • New message types : - ‘coachings’ (requires CoachingsUser role) - ‘notes’ (requires OfficeUser role) - ‘tickets’ (requires Triager role)

TODO: Wouldn’t it be interesting to define a user role “ClientsUser” and use this instead of CoachingsUser?

I realized that actually the user roles are not a useful criteria for masking notification messages. Whether a user receives a notification is decided by the application anyway. Whether they want to see a given type of message is not related to what they have permission to see. That’s why we now have lino.modlib.users.UserType.mask_notifications() and the mask_message_types set.