Page MenuHomePhorge

Invalid logic in PhabricatorEmailPreferencesSettingsPanel::processRequest()
Closed, ResolvedPublic

Description

In https://we.phorge.it/source/phorge/browse/master/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php$101 , the expression
$all_tags[$tag]['count'];
on a separate line does not do anything.
So a few lines later, if ($info['count'] > 1) { is always false because 0 !> 1.
So a few lines later, if ($common_tags) is always false.

Event Timeline

This broken code is intended to find MailTags (means: each entry listed under http://phorge.localhost/settings/panel/emailpreferences/ , grep for const MAILTAG_ to get a list of them) defined more than once to display them in a Common section on top:

Screenshot from 2024-07-09 23-13-28.png (438×1 px, 90 KB)

However, as currently all MailTags are prefixed with their application (examples: phame-post-content, vote:responses, maniphest-owner) there is nothing to display anyway.

You can test this by changing a random MailTag to another already existing MailTag to make it "common", e.g. replace the line const MAILTAG_OWNER = 'maniphest-owner'; with const MAILTAG_OWNER = 'phriction-content'; in src/applications/maniphest/storage/ManiphestTransaction.php, plus applying the patch I'll upload soon.