Closed Bug 1990187 Opened 6 months ago Closed 6 months ago

Fix the behaviour of EwsFolder::MarkMessagesRead

Categories

(MailNews Core :: Networking: Exchange, task)

Tracking

(Not tracked)

RESOLVED FIXED
145 Branch

People

(Reporter: babolivier, Assigned: jtracey)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The implementation in bug 1924804 strongly differs with how we do other operations, in that it does the local operation first then the remote operation second. The general approach with EWS operations is that we want the local copy of the account to replicate what's on the server as much as we can. Therefore, we usually do the remote operation first, so that if it fails we don't end up diverging from the server's view of what a given folder looks like. This is not the case for MarkMessagesRead, meaning that if the remote operation fails the user ends up with a local list of unread messages that differs from the one on the server.

Summary: Fix the behaviour of `EwsFolder::MarkMessagesRead` → Fix the behaviour of EwsFolder::MarkMessagesRead
Assignee: nobody → jtracey

The pending patch fixes the most likely issues, but I want to mention my experimenting with partial successes. If you delete some message on some other client (e.g., the web interface), then, before Thunderbird notices the message is gone, select the deleted message plus some others in Thunderbird and mark them as (un)read, you can get a response that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="9137" MinorBuildNumber="19" Version="V2018_01_08" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
  </s:Header>
  <s:Body>
    <m:UpdateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:UpdateItemResponseMessage ResponseClass="Error">
          <m:MessageText>The specified object was not found in the store., The process failed to get the correct properties.</m:MessageText>
          <m:ResponseCode>ErrorItemNotFound</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
          <m:Items/>
        </m:UpdateItemResponseMessage>
        <m:UpdateItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items><t:Message>
            <t:ItemId Id="AAMkAGJiMGY5MDgzLTFiZmEtNGVlMy04ODUxLTg3NmIyM2VkMDA0NgBGAAAAAADgUhWlP53VT4jyNwduhuAnBwCyaX6rK9DuTbXda0s+SIVxAAJqoE6PAACyaX6rK9DuTbXda0s+SIVxAAJqoItRAAA=" ChangeKey="CQAAABYAAACyaX6rK9DuTbXda0s+SIVxAAJqMKDZ"/>
          </t:Message>
          </m:Items>
          <m:ConflictResults>
            <t:Count>0</t:Count>
          </m:ConflictResults>
        </m:UpdateItemResponseMessage>
        <m:UpdateItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:Message>
              <t:ItemId Id="AAMkAGJiMGY5MDgzLTFiZmEtNGVlMy04ODUxLTg3NmIyM2VkMDA0NgBGAAAAAADgUhWlP53VT4jyNwduhuAnBwCyaX6rK9DuTbXda0s+SIVxAAJqoE6PAACyaX6rK9DuTbXda0s+SIVxAAJqoItPAAA=" ChangeKey="CQAAABYAAACyaX6rK9DuTbXda0s+SIVxAAJqMJ7r"/>
            </t:Message>
          </m:Items>
          <m:ConflictResults>
            <t:Count>0</t:Count>
          </m:ConflictResults>
        </m:UpdateItemResponseMessage>
        <m:UpdateItemResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Items>
            <t:Message>
              <t:ItemId Id="AAMkAGJiMGY5MDgzLTFiZmEtNGVlMy04ODUxLTg3NmIyM2VkMDA0NgBGAAAAAADgUhWlP53VT4jyNwduhuAnBwCyaX6rK9DuTbXda0s+SIVxAAJqoE6PAACyaX6rK9DuTbXda0s+SIVxAAJqoIs3AAA=" ChangeKey="CQAAABYAAACyaX6rK9DuTbXda0s+SIVxAAJqMIG2"/>
            </t:Message>
          </m:Items>
          <m:ConflictResults>
            <t:Count>0</t:Count>
          </m:ConflictResults>
        </m:UpdateItemResponseMessage>
      </m:ResponseMessages>
    </m:UpdateItemResponse>
  </s:Body>
</s:Envelope>

With the pending patch, we update the successfully marked messages as appropriate, and do nothing for the deleted message, which leaves it still visible (until the next refresh) and logs an error. Do we think this is the correct behavior? Should we try to sync the containing folder right away? Should we try to log this as a warning instead of an error? Other operations can presumably have this happen as well, should we be more careful to handle partial successes there too?

Pushed by edicharry@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/ca8d005d82a1
Use a listener when marking EWS messages as read. r=edicharry

Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: