code-corps-ember icon indicating copy to clipboard operation
code-corps-ember copied to clipboard

Mark conversations as read

Open joshsmith opened this issue 7 years ago • 1 comments

What's in this PR?

WIP.

Basic logic is the following:

  • check the conversation or its latest conversation part has not been read and that it can be marked as read by this user
    • if yes, PATCH conversation with virtual attribute read: true
      • on the server this should update readAt for the conversation if the current user can mark it as read
      • sets readAt for all conversation parts where readAt is null and the current user can mark it as read
    • if no, do nothing

We mark the message read when the user is active and either of the following are true:

  • The conversation is unread and either:
    • The message was sent by an admin and the user is the target
    • The message was sent to the project and the user did not author it
  • The latest conversation part is unread and either:
    • The user is the target and the part was not written by them
    • The user is a project admin and the part was written by the target

A lot of this logic being done client-side may need to be reimplemented server-side, but my thinking here is that we are saving a potentially large number of network requests by doing some client-side checking. Distributed computing on the client in JS is much cheaper than paid servers.

joshsmith avatar Dec 22 '17 07:12 joshsmith

I'm sure this logic can be refactored/simplified, especially since I'm tired now. It does seem like the hard parts are mostly figured out, though.

joshsmith avatar Dec 22 '17 07:12 joshsmith