Skip to content

Edit thread message UI

Closes #2352 (closed)

Scenario example
Edit from the context menu Kapture_2019-12-06_at_17.09.45
Edit by pressing UP Kapture_2019-12-06_at_17.14.18
Updating message fails (shamelessly using #2375) Kapture_2019-12-06_at_17.17.58
Cancelling edit with ESC Kapture_2019-12-06_at_17.20.31
Update in progress Kapture_2019-12-09_at_13.15.47

Core idea

When we want to edit a thread message, we initialize threadedConversations.messageEditState object:

{
  id: "<messageId>",
  text: "draft text, starting with copy of message.text"
}

Presence of this object means a message is being edited.

Focus

Changes to focus as a part of this MR

  1. opening TMF will set focus to the TMF chat input box
  2. when opening message edit (either from context menu or by pressing UP) - we focus the message edit input box
  3. when closing the message edit input box (either by ESC or submitting an update by ENTER) we focus back on the TMF chat input box

Testing strategy

(all testing done in TMF)

  1. Messages older than 10 mins shouldn't be editable in UI
  2. Create a message and edit it by selecting "Edit" from the context menu
  3. Testing selecting the latest editable message by pressing UP
    1. Create a message with user A
    2. Create another message with user B
    3. With user A, press UP in the TMF input box
    4. Observe that the correct message (second last) is being edited
  4. Testing error state - either you can open the edit box and wait 10 minutes before submitting (server will return 400) or you can take advantage of a current bug #2375 and submit a message that will fail markdown parsing
Edited by Tomas Vik (OOO back on 2024-05-09)

Merge request reports