This is a very sharp tool!  Particularly since a common programming
error would be to mess up the filter and send something which matched
every message on the server.  This is the equivalent of "DELETE FROM
Messages;" via SQL.  I'd want a few things for safety:

1) a return code which says "filterTooBroad" or something if you send an
   empty filter.

2) a strong suggestion in the implementation docs that you use ifInState
   to avoid race conditions with new things being delivered that you
   didn't mean to include.

...

Having said that, I'm generally in favour of protocols allowing you to
express your intent, and "delete everything in my Trash folder" is a
common user intent.  As is "move all the messages matching this
expression into a folder", so:


setMessages({  filter: {    from: 'br...@fastmail.fm'  },  update: {
folderId: "xyz",
    isUnread: false, } })

Yep, I could see that being useful.  It would blow your cache pretty
badly with the large getMessageUpdates in response, but a client that
didn't care about updates could do bulk operations without having to
know all the IDs.

>From a server implementation standpoint, this is quite easy to write as
well, because you already have something for converting a filter into a
list of IDs, and something for applying changes to messages based on ID.

Bron.

On Tue, 18 Oct 2016, at 00:52, D David wrote:
> Hi all,
>
> I was investigating a way for a JMAP client to empty a folder (the
> usual "Empty Trash" scenario) and it turned out there's nothing in the
> spec allowing me to do this.
> The only possible solution would be to fetch Message IDs with a call
> to getMessageList and then destroy all these IDs with a call to
> setMessages. Is my understanding right or am I missing something?
>
> If I'm right, Linagora would like to propose a simple but effective
> way to implement such "mass" actions on all messages in a given
> Mailbox: the setFilteredMessages API. This API will be very similar to
> setMessages but will apply update and/or destroy operations on
> messages matching a filter (the filter would behave exactly as the
> filter option of getMessageList: it will select messages matching the
> filter expression). Two examples below:
>  * Empty a folder
>
> setMessages({  filter: {    inMailboxes: ['<my-mailbox-id>']  },
> destroy: true })
>
>
>  * Mark all messages from me as read
>
> setMessages({  filter: {    from: 'ddo.linag...@gmail.com'  },
> update: {    isUnread: false  } })
>
>
> Some restrictions would apply, mainly:
>  * destroy MUST be a Boolean value. If True, matched messages are
>    permanently destroyed.
>  * update MUST be an object containing updated properties. Ther server
>    MUST apply the modifications to the matched messages.
>
> What do you all think? Once we agree on the proposal, I can prepare a
> PR to the spec quickly.
>
> Thanks,
> Regards,
>
> David
>
> --
>  You received this message because you are subscribed to the Google
>  Groups "JMAP" group.
>  To unsubscribe from this group and stop receiving emails from it,
>  send an email to jmap-discuss+unsubscr...@googlegroups.com.
>  To post to this group, send email to jmap-discuss@googlegroups.com.
>  To view this discussion on the web visit
>  
> https://groups.google.com/d/msgid/jmap-discuss/2720bfba-ea49-4739-baf4-681e0055f7ff%40googlegroups.com[1].
>  For more options, visit https://groups.google.com/d/optout.

--
  Bron Gondwana
  br...@fastmail.fm



Links:

  1. 
https://groups.google.com/d/msgid/jmap-discuss/2720bfba-ea49-4739-baf4-681e0055f7ff%40googlegroups.com?utm_medium=email&utm_source=footer

-- 
You received this message because you are subscribed to the Google Groups 
"JMAP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jmap-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to jmap-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jmap-discuss/1476741901.2883076.758954961.07FB71D4%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to