Bug 440524 - Expiry settings not displayed properly from Akonadi config
Summary: Expiry settings not displayed properly from Akonadi config
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: folders (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR grave (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-02 15:44 UTC by Thiago Macieira
Modified: 2021-08-03 05:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.18.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2021-08-02 15:44:23 UTC
SUMMARY
The folder properties for expiry are not getting saved.

STEPS TO REPRODUCE
1. Modify the expiry settings of a folder to expire (say) every 30 days
2. Click ok
3. Open the expiry dialog tab again

OBSERVED RESULT
The settings have disappeared.

EXPECTED RESULT
The settings are retained.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2 + kde patches

ADDITIONAL INFORMATION
Comment 1 Thiago Macieira 2021-08-02 15:46:17 UTC
This is a DATA LOSS issue for me. If I don't move emails from certain folders before a deadline, they get removed.

This used to work a few weeks ago. It might have been a recent update that caused this issue.
Comment 2 Laurent Montel 2021-08-02 15:53:49 UTC
It seems that it works here.
Which is the version ?
Comment 3 Thiago Macieira 2021-08-02 15:58:50 UTC
In akonadiconsole, checking the properties of the folder in question, the Attributes tab has a "expirationcollectionattribute", but it's empty. That confirms the "not saving" part.
Comment 4 Thiago Macieira 2021-08-02 15:59:16 UTC
(In reply to Laurent Montel from comment #2)
> It seems that it works here.
> Which is the version ?

$ kmail --version
kmail2 5.17.3 (21.04.3)
$ akonadictl --version
akonadictl 5.17.3 (21.04.3)
Comment 5 Thiago Macieira 2021-08-02 16:23:01 UTC
MariaDB [akonadi]> select type, hex(value) from collectionattributetable where type='expirationcollectionattribute';
+-------------------------------+--------------------------------------------------------------+
| type                          | hex(value)                                                   |
+-------------------------------+--------------------------------------------------------------+
| expirationcollectionattribute | FFFFFFFFFFFFFFFF000000000000000100000078000000000000001E0100 |
| expirationcollectionattribute | FFFFFFFFFFFFFFFF00000000000000010000016D000000000000001E0100 |
| expirationcollectionattribute | 00000000000000F500000001000000010000001E000000000000001E0100 |
| expirationcollectionattribute | 00000000000000F6000000010000000100000015000000000000001E0100 |
+-------------------------------+--------------------------------------------------------------+
4 rows in set (0.001 sec)
Comment 6 Thiago Macieira 2021-08-02 18:25:04 UTC
(In reply to Thiago Macieira from comment #5)
> MariaDB [akonadi]> select type, hex(value) from collectionattributetable
> where type='expirationcollectionattribute';
> +-------------------------------+--------------------------------------------
> ------------------+
> | type                          | hex(value)                                
> |
> +-------------------------------+--------------------------------------------
> ------------------+
> | expirationcollectionattribute |
> FFFFFFFFFFFFFFFF000000000000000100000078000000000000001E0100 |
> | expirationcollectionattribute |
> FFFFFFFFFFFFFFFF00000000000000010000016D000000000000001E0100 |
> | expirationcollectionattribute |
> 00000000000000F500000001000000010000001E000000000000001E0100 |
> | expirationcollectionattribute |
> 00000000000000F6000000010000000100000015000000000000001E0100 |
> +-------------------------------+--------------------------------------------
> ------------------+
> 4 rows in set (0.001 sec)

Given:

QByteArray ExpireCollectionAttribute::serialized() const
{
    QByteArray result;
    QDataStream s(&result, QIODevice::WriteOnly);

    s << mExpireToFolderId;
    s << (int)mExpireAction;
    s << (int)mReadExpireUnits;
    s << mReadExpireAge;
    s << (int)mUnreadExpireUnits;
    s << mUnreadExpireAge;
    s << mExpireMessages;

    return result;
}

Decode as:
                       Read messages   Unread mesgs
FolderId    Action    Units   ReadAge  Units   Age   ExpireMessages
-1          0         1       120      0       30    true
-1          0         1       365      0       30    true
245         1         1       30       0       30    true
246         1         1       21       0       30    true

So I have 4 folders with expiry settings. Two of them delete (target folder ID is -1) and two of them move to another folder.

The settings appear to be correct. This is indeed what I had configured.

But the settings page is not reloading the settings.
Comment 7 Thiago Macieira 2021-08-02 18:27:41 UTC
> But the settings page is not reloading the settings.

I've just made a change to one of the folders to expire unread emails too. The MySQL database reflects the change:

MariaDB [akonadi]> select type, hex(value) from collectionattributetable where type='expirationcollectionattribute';
+-------------------------------+--------------------------------------------------------------+
| type                          | hex(value)                                                   |
+-------------------------------+--------------------------------------------------------------+
| expirationcollectionattribute | FFFFFFFFFFFFFFFF000000000000000100000078000000000000001E0100 |
| expirationcollectionattribute | FFFFFFFFFFFFFFFF00000000000000010000016D000000000000001E0100 |
| expirationcollectionattribute | 00000000000000F500000001000000010000001E000000010000001E0100 |
| expirationcollectionattribute | 00000000000000F6000000010000000100000015000000000000001E0100 |
+-------------------------------+--------------------------------------------------------------+
4 rows in set (0.001 sec)

See the "1" in the third line, for the expiration of unread emails too.

After making this change, KMail / Akonadi does display the modified settings for this folder.
Comment 8 Thiago Macieira 2021-08-02 18:30:07 UTC
(In reply to Thiago Macieira from comment #7)
> After making this change, KMail / Akonadi does display the modified settings
> for this folder.

Looks like the setting does get reloaded properly if the expiry for unread messages is activated. The moment I turn it off again, the setting is not displayed properly on the Expiry tab.
Comment 9 Laurent Montel 2021-08-03 05:21:20 UTC
Git commit 6ed6903a8b6b78869e60a2aab91ed997e6c9bf31 by Laurent Montel.
Committed on 03/08/2021 at 05:20.
Pushed by mlaurent into branch 'release/21.08'.

Fix Bug 440524 - Expiry settings not displayed properly from Akonadi config

FIXED-IN: 5.18.0

(loading was incorrect:
-        settings.mUnreadExpireUnits = attr->readExpireUnits();
-        settings.mReadExpireUnits = attr->unreadExpireUnits();
+        settings.mUnreadExpireUnits = attr->unreadExpireUnits();
+        settings.mReadExpireUnits = attr->readExpireUnits();
)

M  +2    -2    src/collectionpage/collectionexpirypage.cpp
M  +20   -0    src/collectionpage/collectionexpirywidget.cpp
M  +2    -6    src/collectionpage/collectionexpirywidget.h

https://invent.kde.org/pim/mailcommon/commit/6ed6903a8b6b78869e60a2aab91ed997e6c9bf31