Open lucastbelem opened 3 years ago
Ok, I've got a bit more detail on this.
Carrissa Reffell and Lauren Germain messaged Leo by clicking "Send a message" in the course on Leo's profile card. Leo received email notifications for both and was able to go to the DM board and respond to them. At 12:53pm Leo Belem sent a DM to 1 course participant (Lauren Germain) and 1 course Coach (Carrissa Reffell). Carrissa received a message from Leo, but it said "message cannot be displayed" instead of the actual message "How are you?".
Lauren received her message from Leo properly. However, she received 2 email notifications: one with the message that was intended for her and another with the message that was intended for Carrissa.
@JonEsparaz now that I have that bit of detail, and with George, I'm wondering if you'd be interested in checking this one out?
A recommendation: having a long chain of data conversions (i.e. from JSON to DraftJS ContentState to HTML) is almost certainly the root cause.
I suggest re-implementing to mirror the blog and notes on themeetinghouse/web. When the user sends a message or reply, use draftToHtml()
from draftjs-to-html
to convert the data once, then write the HTML string to the database and directly use the HTML string (without additional data conversions) when reading.
I think in this case there is also an indexing issue with the DM page in some situations. It is filtering out the course messages. Similar to the issue with lessons. Should be using ID when selecting on the left side.
Also I think the whole implementation is overly complicated because of the inability for amplify to have indexes on the user list permissions array (which would remove the need for the rooms and user list tables...and simplify things a lot)...
I'm fine if we add another field contentHTML and then run a conversion on all the existing messages. Would be nice to keep the editor content in case we decide to implement editing down the line.
The HTML can be converted back to DraftJS: https://www.npmjs.com/package/html-to-draftjs. This is how blogs work on the TMH website (and we haven't experienced any issues with conversion using this method).
Ahhh. Cool.
I asked Lauren to send 2 messages to Igor via the "send a message" button in courses. Igor received the messages as DMs, was not notified and both messages said "messages cannot be displayed". Refreshing did not load the messages.
┆Issue is synchronized with this Wrike Task