mail icon indicating copy to clipboard operation
mail copied to clipboard

'Mark all as read' doesn't work

Open meichthys opened this issue 3 years ago • 1 comments

Steps to reproduce

  1. Open Mail App and ensure multiple messages are unread
  2. Use context menu on folder and choose to "Mark all as read"
  3. Verify if the messages have been marked as read

Expected behavior

All messages should be marked as read and the number of unread emails should be 0

Actual behavior

No emails are marked as read.

Mail app version

1.13.8

Mailserver or service

generic imap

Operating system

Windows 10

PHP engine version

PHP 8.1

Web server

No response

Database

No response

Additional info

Using Nextcloud VM Trying to mark all as read in my "Archive" folder.

meichthys avatar Aug 17 '22 18:08 meichthys

Just following up to indicate that this is still a bug as of Mail v2.0.0-beta.4 (NC 25 beta5)

meichthys avatar Sep 09 '22 13:09 meichthys

I've tested and its works. @st3iny could you reproduce it?

JuliaKirschenheuter avatar Oct 03 '22 14:10 JuliaKirschenheuter

@JuliaKirschenheuter Which version are you testing against? I'm on 2.0.0-rc.1 and I don't see anything in the browser console. I do see the following in the nextcloud logs:

{
  "reqId": "uFkeYxdfHbFcL918hAJt",
  "level": 3,
  "time": "2022-10-03T12:42:58-04:00",
  "remoteAddr": "ip address",
  "user": "username",
  "app": "PHP",
  "method": "POST",
  "url": "/apps/mail/api/mailboxes/29/sync",
  "message": "Return type of OCA\\Mail\\AddressList::count() should either be compatible with Countable::count(): int, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/nextcloud/apps/mail/lib/AddressList.php#108",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0",
  "version": "25.0.0.14",
  "exception": {
    "Exception": "Error",
    "Message": "Return type of OCA\\Mail\\AddressList::count() should either be compatible with Countable::count(): int, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/nextcloud/apps/mail/lib/AddressList.php#108",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/mail/lib/AddressList.php",
        "line": 39,
        "function": "onAll",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/composer/composer/ClassLoader.php",
        "line": 571,
        "args": [
          "/var/www/nextcloud/apps/mail/lib/AddressList.php"
        ],
        "function": "include"
      },
      {
        "file": "/var/www/nextcloud/lib/composer/composer/ClassLoader.php",
        "line": 428,
        "function": "Composer\\Autoload\\includeFile"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Db/Message.php",
        "line": 143,
        "function": "loadClass",
        "class": "Composer\\Autoload\\ClassLoader",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php",
        "line": 68,
        "function": "__construct",
        "class": "OCA\\Mail\\Db\\Message",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
        "line": 322,
        "function": "fromRow",
        "class": "OCP\\AppFramework\\Db\\Entity",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php",
        "line": 340,
        "function": "mapRowToEntity",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Db/MessageMapper.php",
        "line": 1031,
        "function": "findEntities",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
        "line": 174,
        "function": "findByIds",
        "class": "OCA\\Mail\\Db\\MessageMapper",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Service/Sync/SyncService.php",
        "line": 133,
        "function": "getDatabaseSyncChanges",
        "class": "OCA\\Mail\\Service\\Sync\\SyncService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/mail/lib/Controller/MailboxesController.php",
        "line": 160,
        "function": "syncMailbox",
        "class": "OCA\\Mail\\Service\\Sync\\SyncService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "sync",
        "class": "OCA\\Mail\\Controller\\MailboxesController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1047,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Log/ErrorHandler.php",
    "Line": 99,
    "CustomMessage": "--"
  },
  "id": "633b145489250"
}

meichthys avatar Oct 03 '22 16:10 meichthys

I just tested this on latest main and couldn't reproduce it. Please let us know which IMAP server are using. Also, could you please run occ mail:account:diagnose <account-id>. You can get the account id by running occ mail:account:export <user-id>.

st3iny avatar Oct 04 '22 09:10 st3iny

@st3iny I'm using zoho: imappro.zoho.com

Here's the diagnostics:

''' IMAP capabilities:- ACL- AUTH- CHILDREN- CONDSTORE- ESEARCH- ID- IDLE- IMAP4REV1- LIST-EXTENDED- LIST-STATUS- LITERAL-- MOVE- NAMESPACE- SASL-IR- UIDPLUS- UNSELECT- WITHIN- XLISTAccount has 72006 messages in 12 mailboxes '''

meichthys avatar Oct 04 '22 11:10 meichthys

Dear @meichthys

we can't reproduce this bug anymore. Please update dependencies and please try to reproduce this bug again (after clicking to "Mark all as read" it needs 1-2 seconds). If you would reproduce it, i will have a look again.

For now i'll close this ticket. Thank you!

JuliaKirschenheuter avatar Oct 04 '22 13:10 JuliaKirschenheuter

@st3iny Is there a specific IMAP capability that is required for this to work? It works on the default mail app on my phone, but not in nextcloud mail :/

@JuliaKirschenheuter I do see the "Mark all as read" option grey out for about 1-2 seconds, but even after waiting for a significant amount of time, the unread items are still unread: image

Afaik, all of my dependencies are up to date. I'm also using the Nextcloud VM and i believe that comes with the needed dependencies. Could it be that the mailbox is too large (over 60k messages)? I'm thinking this may be the case since I can get it to work on a small folder: Before: image After: image

meichthys avatar Oct 04 '22 17:10 meichthys

Are the messages marked as read in other clients?

ChristophWurst avatar Oct 05 '22 12:10 ChristophWurst

The log points toward a PHP8.1 incompatibility: "message": "Return type of OCA\\Mail\\AddressList::count() should either be compatible with Countable::count(): int, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/nextcloud/apps/mail/lib/AddressList.php#108",

Can you see what is in your file? We have added that Attribute already.

miaulalala avatar Oct 05 '22 16:10 miaulalala

A deprecation notice doesn't interrupt the application flow.

ChristophWurst avatar Oct 05 '22 16:10 ChristophWurst

Are the messages marked as read in other clients?

Yes it works fine in thunderbird.

meichthys avatar Oct 05 '22 22:10 meichthys

@miaulalala Here's the contents around line 108 in /var/www/nextcloud/apps/mail/lib/AddressList.php:

        #[ReturnTypeWillChange]
        public function jsonSerialize() {
                return array_map(function (Address $address) {
                        return $address->jsonSerialize();
                }, $this->addresses);
        }

        /**
         * @return int
         */
        public function count() {                        <---------- Line 108
                return count($this->addresses);
        }

meichthys avatar Oct 06 '22 01:10 meichthys

Are the messages marked as read in other clients?

Yes it works fine in thunderbird.

If mark all as read here shows all messages as rad in Thunderbird problem is not a missing update of the messages on IMAP but that our app doesn't reflect the changes.

ChristophWurst avatar Oct 06 '22 06:10 ChristophWurst

Just following up here to indicate that i'm still seeing this issue in v2.3.0A1

meichthys avatar Feb 15 '23 14:02 meichthys

This worked in v 3.3.0-alpha.1 (maybe it would work in earlier versions too?). It did, however, lock up my Firefox browser tab. I had to force re-fresh the tab to get the page to re-load, after which the folder was completely marked as read!

meichthys avatar Jul 12 '23 19:07 meichthys

So the only issue now is that you have to force re-fresh to see the change?

auroraanna avatar Aug 22 '23 12:08 auroraanna

I think the performance could be improved by not sending a request for every envelope to the server but instead sending one request and having the server change every envelope.

That way, if you client crahes, the server should still successfully carry out the operation.

I can't think of any argument against this.

auroraanna avatar Aug 22 '23 12:08 auroraanna

So the only issue now is that you have to force re-fresh to see the change?

It seems like clearing the cache in the nextcloud mail folder works as well - but this required debug mode to be turned on for nextcloud.

meichthys avatar Aug 23 '23 04:08 meichthys

I don't know the backend so if this was to be implemented then someone else'd need to do it.

auroraanna avatar Aug 23 '23 10:08 auroraanna