esi / esi-issues

Issue tracking and feature requests for ESI
https://esi.evetech.net/
209 stars 23 forks source link

Value of total unread emails is wrong when message assigned multiple labels #1354

Open joaomlneto opened 1 year ago

joaomlneto commented 1 year ago

Bug

We can retrieve the number of total unread emails of a character via the /characters/{character_id}/mail/labels/ endpoint.

However, the number of unread emails is not calculated correctly when an unread message is assigned more than one label.

For instance, let's consider we have a single unread message that is assigned two labels (plus Sent): image

Querying the ESI endpoint will return a 200 status with the following body:

{
    "labels": [
        {
            "color": "#ffff01",
            "label_id": 1,
            "name": "Inbox",
            "unread_count": 1
        },
        {
            "color": "#fe0000",
            "label_id": 2,
            "name": "Sent"
        },
        {
            "color": "#01ffff",
            "label_id": 4,
            "name": "[Corp]",
            "unread_count": 0
        },
        {
            "color": "#00ff33",
            "label_id": 8,
            "name": "[Alliance]",
            "unread_count": 0
        },
        {
            "color": "#00ff33",
            "label_id": 32,
            "name": "grrreeen",
            "unread_count": 0
        },
        {
            "color": "#660066",
            "label_id": 16,
            "name": "purrple",
            "unread_count": 1
        }
    ],
    "total_unread_count": 2
}

The total_unread_count should display 1 (as is correctly displayed in the EVE client). However, it appears to simply add the number of unread messages on each label.

Assigning a third label to this message will cause the total_unread_count to change to 3, etc…

Checklist

Check all boxes that apply to this issue: