Skip to content

Fix #789 (wrong mailbox name when unread messages)

Chris Oelmueller requested to merge bugfix/unread-mailbox-name into master

by no longer overwriting text through partial name matching with :contains.

also improve the code + semantics by appending the unread count through CSS (after filling it into a data attribute with jQuery) and switching number placement so the unread count comes first, before the mailbox name.

Closes #789 (closed)

Reproduction:

you'll need two mailboxes and their ID is important:

  • lower ID, e.g. 30 with name = prefix-region-1 and thus generated mailbox address prefix-region-1@foodsharing.network
  • higher ID, e.g. 31 with name = region-1 and thus generated mailbox address region-1@foodsharing.network

now you'll need to fill both of those mailboxes with at least one unread message each, ideally use a different amount. After opening the mailbox page http://localhost:18080/?page=mailbox there should be two unread tree entries, and both should show region-1@... as mailbox name.
This happens because its ID (31) comes later and thus the code is executed later, and both mailbox names in the DOM/tree (prefix-region-1@... and region-1@...) match the string 'region-1@foodsharing.network' as far as contains is concerned. So they're both overwritten with the mailbox text + unread count of the second mailbox, region-1@....

Edited by Chris Oelmueller

Merge request reports