Page MenuHomePhabricator

[lib][native] Displaying edited messages from database
ClosedPublic

Authored by kuba on Mar 7 2023, 1:44 AM.
Tags
None
Referenced Files
F1437122: D6965.id24404.diff
Thu, Mar 28, 2:29 PM
F1431049: D6965.id24404.diff
Thu, Mar 28, 1:05 AM
F1431048: D6965.id23982.diff
Thu, Mar 28, 1:05 AM
F1431047: D6965.id23981.diff
Thu, Mar 28, 1:05 AM
F1431046: D6965.id23528.diff
Thu, Mar 28, 1:05 AM
F1431045: D6965.id23478.diff
Thu, Mar 28, 1:05 AM
F1431010: D6965.id.diff
Thu, Mar 28, 1:04 AM
F1430948: D6965.diff
Thu, Mar 28, 12:55 AM
Subscribers

Details

Summary

Now edited messages are visible in the chats. Currently, it's only possible to edit the message (send a new message with edit_message type) from the database. Editing message
which is source of sidebar currently isn't visible in the sidebar view.

Test Plan
  • added edited message to the database, checked if it shows correctly,
  • edited several times the same message, checked if the latest one is shown,
  • edited a few messages in one thread, checked if the messages are updated correctly,
  • edited a few messages in a few threads, checked if the messages are correctly updated

Screenshot 2023-03-07 at 11.01.26.png (1×2 px, 782 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/selectors/chat-selectors.js
403 ↗(On Diff #23478)

See comment in D6966 about read-only types

lib/types/messages/text.js
31 ↗(On Diff #23478)

Make this read-only

kuba marked 2 inline comments as done.

Responded to comments, made read-only 'text' property

Looks good to me, but I haven't worked with this code so it would be nice if someone else could also take a look.

This revision is now accepted and ready to land.Mar 13 2023, 5:59 AM
This revision now requires review to proceed.Mar 13 2023, 9:47 AM

accepting with one question inline

lib/selectors/chat-selectors.js
405 ↗(On Diff #23528)

Could we simply this condition to this? Or are we concerned about newText possibly being an empty string?

This revision is now accepted and ready to land.Mar 16 2023, 5:33 PM
kuba marked an inline comment as done.

Simplified condition

kuba retitled this revision from [lib][native] Displaying edited messages from database to [lib] Displaying edited messages from database.Mar 22 2023, 5:23 AM
kuba marked an inline comment as not done.
kuba retitled this revision from [lib] Displaying edited messages from database to [lib][native] Displaying edited messages from database.

Revert the changes

lib/selectors/chat-selectors.js
405 ↗(On Diff #23528)

I changed it, but then after more thought, I believe, that it should stay like this. If the newText is empty we would prefer to display an even empty message, than the original content (that is what the user would probably want). I revert the changes.

We can consider preventing users from sending empty edit messages.

But in the future, it would be easy to add deleting messages by sending edit messages with empty text. We would just not display them at all.

We can consider preventing users from sending empty edit messages.

We should do this. We don't allow empty messages for messageTypes.TEXT. Can you create a follow-up Linear task for this before landing?

We can consider preventing users from sending empty edit messages.

We should do this. We don't allow empty messages for messageTypes.TEXT. Can you create a follow-up Linear task for this before landing?

Done: https://linear.app/comm/issue/ENG-3395/prevent-empty-messages-in-message-editing