[FW][FIX] mail: full composer auto-save does not affect other composers #194312
+5
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this commit, when some conversations were open in chat windows and the full composer was open in a chatter, the content of full composer message composition could be duplicated in other conversation composers.
Steps to reproduce:
=> the chat window of discuss conversation contains the full composer text content
This happens because when some content is typed in the non-full composer, the text content is regularly saved in local storage so that content is not lost on page reload.
The saving is debounced 5 seconds whenever the user types something.
The full composer must also be saved & restored in chatter, as this is also a frequent point of typing long messages and content may be lost without the save & restore feature.
The code to handling it was poorly written and forgot to assume there could be more than 1 composer open at once: whenever a save content in composer is in progress, it was simply checking whether a full composer is open, and if so it was simply saving the full composer content.
This explains the problem in the scenario above: when typing in discuss conversation in chat window, the save content is triggered after 5 seconds. The opening of full composer disrupts the discuss conversation composer content saving by not saving the discuss conversation composer but instead the full composer content in it.
This commit fixes the issue by enforcing debounce saving to save the content in the current composer. The full composer was never intended to be implied in the debounced save content, only the basic composer is. The full composer saving content works differently: whenever the full composer is closed in non-discard way the save of full composer in basic composer must happen.
Task-4485021
Forward-Port-Of: #194307
Forward-Port-Of: #193936