Closed Bug 2014004 Opened 3 months ago Closed 3 months ago

gMsgCompose.bodyModified is set by selecting different `from` identity

Categories

(Thunderbird :: Message Compose Window, defect)

Thunderbird 140
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: axel.grude, Unassigned)

Details

Description:
Selecting a different “From” identity in the composer sets gMsgCompose.bodyModified to true, even if the user has not typed anything in the message. As a result, Thunderbird prompts the user to save the message on close, even though nothing was modified.

Steps to Reproduce:

  1. Open a new message in Thunderbird.
  2. Do not type anything in the body.
  3. Change the “From” identity using the identity chooser (even selecting the same suggested identity).
  4. Close the composer.

Actual Result:

  • The user is prompted to save the message.
  • gMsgCompose.bodyModified is set to true, despite no user input.

Expected Result:

  • The composer should not prompt to save if the user has typed nothing.
  • gMsgCompose.bodyModified should remain false unless the user actually modifies the message body.

Notes:

  • This behavior also affects add-ons that rely on gMsgCompose.bodyModified to detect user changes or modify identity (e.g., Identity Picker, SmartTemplates).
  • see the API compose.setComposeDetails() - if it is used to set the from identity, even adding isModified:false to the details structure does not help - Thunderbird back end code will still immediately set the bodyModified. Technically I feel this is a wrong setting of a flag that governs "content" not structure. The user has not inserted any data only selected an identity - asking to save is bad UX.
  • It appears independent of any add-on and occurs in vanilla Thunderbird as well.
Summary: isBodyModified is set by selecting different from identity → gMsgCompose.bodyModified is set by selecting different `from` identity

This was deliberately changed in bug 1850192. Setting isModified to false with compose.setComposeDetails() should work (at least in my add-on it does…).

Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → INVALID

(In reply to Hartmut Welpmann [:welpy-cw] from comment #1)

This was deliberately changed in bug 1850192. Setting isModified to false with compose.setComposeDetails() should work (at least in my add-on it does…).

It doesn't work during the call (I patched identity picker which only sets the send to put isModified:false at the same time) - this is ignored and set to true anyway.

that's not good - I have a listener that consumes the "compose-from-changed" event - at that stage (immediately after selecting a different from or when the other Add-on identity picker selects a from) the isModified is set to true. My Add-on applies new templates (which completely rebuilds the email) and wants to avoid deleting anything the user has typed, but i do not know whether it was or not at this stage.

Instead of flagging as RESOLVED/INVALID, Can we convert this issue into a feature request to turn off the behavior (Thunderbird setting isBodyModified=true before firing compose-from-changed event) or should I create a new bug request?

Also I would like the compose API to not ignore the isModified:false when it decides to change "from" in the same call - that would also fix the permanent problem in "identity picker" (And the add-on owner could expose this as an option on their end) - at least then there wouldn't be additional UI on the Thunderbird side.

You need to log in before you can comment on or make changes to this bug.