-
Notifications
You must be signed in to change notification settings - Fork 47
Message Flow
Synopsis
Messages have both an owner and an author. The owner decides who should receive it. The author also has certain rights, such as the right to rescind a post. The owner can rescind the entire conversation. The person who creates the initial conversation is "usually" the owner, except if it's a (so-called) wall-to-wall post in which case the owner is the person who owns the wall.
Examples
Bilbo posts a message and restricts it to Frodo and Sauron.
include/notifier.php looks at the item and sees who to send it to. It finds Frodo and Sauron and sends them a copy.
Frodo makes a comment. Frodo doesn't know who received the original post, so Frodo starts a 'relay' by sending the comment back to Bilbo (the item owner) with a special flag.
Bilbo receives the comment and calls the notifier again but without the special flag - so the notifier goes back to the original post and sees who received that. It then recreates the original message list and sends the comment to Frodo and Sauron.
Frodo gets the comment back again, but notices that it's a duplicate and ignores it. Sauron receives the comment and adds it to the conversation.
Sauron isn't interested and deletes the comment. The notifier gets it (or not - it may have been caught earlier in the process) and sees that Sauron isn't the author of the comment or the owner. The end result is that the delete request is processed locally but does not propagate.
On the other hand, Bilbo may decide the entire thread stinks. Bilbo owns the conversation since he started it. When he sends the delete request, the notifier propagates it to the original recipients and Frodo and Sauron delete the entire conversation, since the deletion occurred for the top level item.
But let's forget about this and pretend it didn't happen to explore the other case, Frodo deletes his comment. The notifier sees that it's a comment being deleted and once again does the relay thing - sending the item (which now contains a deleted flag) as a "relay" post back to the owner, who redistributes it to all the conversation members.
That's it in a nutshell.
Forums and tag deliveries are a bit more complicated because you've got two owners and two lists of recipients and the owners need to synchronise actions with each other.