Document toolboxDocument toolbox

Thread

This text regards the new notes and messages system, which is to be introduced during 2019.

Even though notes and messages are considered two different things from the user perspective, they will be implemented using the same Microbizz objects.

Data structure

Both notes and messages are implemented using two objects: Thread and Message. The thread is used to attach the messages to an object and keep track on who is participating in the conversation, and the messages is what people are writing.

When a thread isn't linked to any object in Microbizz, it is considered part of the message-system where user is communicating with each other.

We will refer to a combination of a thread and its attached messages as a conversation, and this will both cover the concept of entering notes, and messaging each other.

Notes

The system can be used as notes on Microbizz objects.

Creating notes

When creating a new note, both a thread and a message is created, where the thread is linked to the relevant object, and the message is linked to the thread. If the object is public, then the thread is also suggested to be public.

In case of a tasks both internal and external subscribers to the task is added as suggested subscribers, but can be deselected or others can be added.

Responding to notes

A response to a note (message), creates a new message linked to the same thread as the message being answered. Subscribers are suggested as saved on the thread, and any changes to subscribers are saved to the thread.

Send to "next who performs a checkin"

A virtual subscriber to a thread is “the next user who checks in on the object to which the thread is attached”. When this subscriber is selected, then the isflaggedforcheckin field is set on the thread.

When a user checks in on an object, then it is checked if this object have any threads with this field set attached to them. If this is the case, the following happens:

  • The user who checked in, is added as a subscriber to the thread (if they are not already).

  • The user is sent a push-message: “Please check the notes on where you just checked in”.

  • The isflaggedforcheckin field is unset on the thread.

Messages (as in Microbizz message system)

In the following we will refer to the Message class as “message” and a message in the Microbizz message system as a MBmessage.

Creating a new MBmessage

A MBmessage can be directed at one or several other users. When a new MBmessage is saved, the system will try to find an existing thread containing exactly the right participants (the sender, and the receivers), which isn't attached to any object (making it a note). If one is found, no new thread is created and a new message is added to the found thread. If no existing thread is found, one is created.

Responding to MBmessages

Responding to a MBmessage will just add a new message to the appropriate thread. The subscribers of a thread cannot be edited when it represents a MBmessage.

Email integration

When a new message is created (either as a note or a MBmessage), a mail is sent to the relevant subscribers.

It should be possible to reply on these mails and create new messages from the replies.

It should be identified who sent a given mail, where the sender should be resolved in the following order:

  • Users participating in the thread.

  • Persons participating in the thread.

  • Any user.

  • Any person.

  • An unknown email address.

It should be considered if unresolved senders should be allowed to create new messages by mailing.

Message confirmation

A message can be required to be confirmed. Everyone reading such a message can confirm it, and in doing so, it will be registered on the message, who confirmed it and when they did confirm it.

Data migration

The goal is to import the existing note system and message system into this new system, so it can totally replace these systems.

Note inheritance

Where the old note system “bubbled” (or copied) notes to other objects of relevance, the new note system instead chooses to display threads from other objects.

This can easily be achieved using the ThreadUI→includeThreads(array($modcode ⇒ $ids)) function.

Voting

Voting may be enable for threads,. This is done in ThreadUI, by setting   $threadui→allowlike = true.

Lock

ThreadUI supports locking of a single thread in the UI. This is enabled by setting   $threadui→allowlock = true.

A locked thread wil be displayed at the top of the list of threads/notes.