webext-docs icon indicating copy to clipboard operation
webext-docs copied to clipboard

Function messages.delete in The Current Beta - Document Generator Failed to Properly Render The Options Object

Open WoofGrrrr opened this issue 9 months ago • 0 comments

I described this on the Add-on Developers Topicbox, and I was requested to file this issue here.

Recently I switched to the Release Channel and got 137.0.2. I had been using the ESR Channel.

My extension uses messages.delete().

In the past, the second (optional) parameter is a simple boolean: skipTrash, and my extension has been using that. But after the switch to the Release Channel, I am seeing the following in the Thunderbird Console:

13:49:04.917 Error: Specify the options object instead of a plain boolean to delete messages permanently. background.js:473 markAsReadAndDeleteSelectedMessages moz-extension://7066c16b-9675-4890-9fc9-0f0592a2ef7d/background.js:473

But the current Beta docs say I can pass either boolean or object:

delete(messageIds, [options])

Deletes messages permanently, or moves them to the trash folder (honoring the account’s deletion behavior settings). Deleting external messages will throw an ExtensionError. The deletePermanently parameter allows immediate permanent deletion, bypassing the trash folder.

Parameters

messageIds

(array of MessageId)

The IDs of the messages to delete.

[options]

(boolean or object, optional)

Passing in a boolean should not be reported as an "Error", I believe. I do see that it's deprecated. (Is a deprecation and error?)

The docs should actually describe this "object". Also, "isUserAction" isn't described at all for delete, but is described for other functions, e.g. messages.copy()

From searchfox:

"parameters": [
  {
    "name": "messageIds",
    "type": "array",
    "description": "The IDs of the messages to delete.",
    "items": {
      "$ref": "messages.MessageId"
    }
  },
  {
    "name": "options",
    "optional": true,
    "choices": [
      {
        "type": "boolean",
        "deprecated": "Specify the options object instead of a plain boolean to delete messages permanently.",
        "description": "Whether the message will be deleted permanently, regardless of the account's deletion behavior settings."
      },
      {
        "type": "object",
        "properties": {
          "deletePermanently": {
            "type": "boolean",
            "optional": true,
            "description": "Whether the message will be deleted permanently, regardless of the account's deletion behavior settings. Use this with care!"
          },
          "isUserAction": {
            "type": "boolean",
            "optional": true,
            "description": "Whether this copy operation should be treated as a user action, for example allowing undo. Note: Deleting messages permanently cannot be undone!"
          }
        }
      }
    ]
  }
]

WoofGrrrr avatar Apr 18 '25 17:04 WoofGrrrr