Closed Bug 1670379 Opened 1 year ago Closed 11 months ago

Extend compose API to edit messages/templates as new message

Categories

(Thunderbird :: Add-Ons: Extensions API, enhancement)

enhancement

Tracking

(thunderbird_esr78 fixed)

RESOLVED FIXED
84 Branch
Tracking Status
thunderbird_esr78 --- fixed

People

(Reporter: tobias.bengfort, Assigned: darktrojan)

References

Details

Attachments

(2 files, 1 obsolete file)

Attached patch 0001-add-compose.beginEdit.patch (obsolete) — Splinter Review

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

I am currently in the process of porting my conversations extension (https://github.com/xi/xi-conversations -- not the will known one) to TB78

Actual results:

The following nsIMsgCompType values are currently covered in the compose API:

  • New
  • Reply
  • ReplyToList
  • ReplyAll
  • ForwardInline
  • ForwardAsAttachment

The following values are yet not covered:

  • EditAsNew
  • Draft
  • Template
  • EditTemplate

I guess the last 3 cases are somewhat special but the first one is just as useful as reply/forward.

Expected results:

The included patch adds compose.beginEdit with the single choice "editAsNew" for type.

typo

Attachment #9180825 - Attachment is obsolete: true

Hi, thanks for this, at first glance it looks good, but I'll take a proper look as soon as I get some time.

Assignee: nobody → tobias.bengfort
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9180826 - Flags: review?(geoff)

Did you have this working? For me it just opens an empty compose window. I think I know why, but I wanted to find out if it ever worked as intended.

Flags: needinfo?(tobias.bengfort)

You guessed correctly: The version I actually use in my extension is quite different: https://github.com/xi/xi-conversations/blob/2ae800b66822d7335b1cdb1c378104d0d7aecdc9/experiment-api/api.js#L124

I tried to align this with the existing API but wasn't able to test it (at least not by simply patching omni.ja on a standard thunderbird installation).

I think I know why, but I wanted to find out if it ever worked as intended.

I would be happy to learn more about that and adapt the patch accordingly.

Flags: needinfo?(tobias.bengfort)
Attachment #9180826 - Flags: review?(geoff)

I'm going to take this in a different direction which I think fits better. The patch I just posted covers EditAsNew and Template by passing the message identifier as the first argument to beginNew, which matches beginReply and beginForward. (It's an optional argument, and the extensions framework is clever enough to know what to do if it's missing, so existing code doesn't break.)

Assignee: tobias.bengfort → geoff

Thanks for contributing, Tobias. We might end up with something completely different from the patch you submitted, but don't let that discourage you. You inspired me to do something about a problem I've been ignoring until now.

Thanks for working on this! Your proposed patch covers my usecase perfectly. I am glad I could help filling this gap.

Summary: Extend compose API with beginEdit → Extend compose API to edit messages/templates as new message
Target Milestone: --- → 84 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/586b5aeb2563
Extend compose API to edit messages and templates as new messages. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Duplicate of this bug: 1663497

Comment on attachment 9182842 [details]
Bug 1670379 - Extend compose API to edit messages and templates as new messages. r?mkmelin

[Approval Request Comment]
User impact if declined:
In general: Add-on developers can not use the latest fixes and improvements of our WebExtension API.
Specifically this bug: Bug 1658132 (which is an API fix) needs this bug to be uplifted as well.

Testing completed (on c-c, etc.):
https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=3cdff293d5d1bd77777f5da371caaa02c4b05de3

Risk to taking this patch (and alternatives if risky):
I hope none

Remark:
The provided try run includes all bugs I want to uplift for TB 78.7 and shows a working patch order.
Bug 1680653 is the first one, who does not have a bug number in the commit message.
This is the 3rd one.

Attachment #9182842 - Flags: approval-comm-esr78?

Comment on attachment 9182842 [details]
Bug 1670379 - Extend compose API to edit messages and templates as new messages. r?mkmelin

[Triage Comment]
Approved for esr78

Attachment #9182842 - Flags: approval-comm-esr78? → approval-comm-esr78+
You need to log in before you can comment on or make changes to this bug.