Ignore thread labels that aren't listed in the account's labels

Summary:
An "important" label has been showing up for some users, rather than the usual
important markers. We generally have a list of labels that are hidden, including
the important label, but this list starts with the labels for the entire account.
In these cases, we believe gmail stopped returning the important label for the
accounts, while we still had threads marked as important. This resulted in the
important label not being properly hidden. To fix this, we added a clause that
ignores labels if they are not in the account's list of labels.

Test Plan: Tested locally

Reviewers: annie, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D3123
This commit is contained in:
Halla Moore 2016-07-26 13:59:35 -07:00
parent 02c33ea3f3
commit 7626bf6728

View file

@ -43,7 +43,9 @@ export default class MailLabelSet extends React.Component {
const ignoredNames = MessageStore.CategoryNamesHiddenByDefault;
for (const label of thread.sortedCategories()) {
if (ignoredNames.includes(label.name) || ignoredIds.includes(label.id)) {
const labelExists = CategoryStore.byId(thread.accountId, label.id);
if (ignoredNames.includes(label.name) || ignoredIds.includes(label.id) ||
!labelExists) {
continue;
}