App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-10-30] Negative notification displayed in tab

Open isagoico opened this issue 5 years ago • 25 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

Unclear (?)

  1. Log in and open all unread messages in app.

Expected Result:

There should not be any negative number's in the notification status or badges

Actual Result:

There's a negative number of notifications for the user.

Workaround:

N/A

Platform:

Where is this issue occurring?

  • Web

Version Number: 1.0.83-0

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

image

Expensify/Expensify Issue URL:

View all open jobs on Upwork


From @thienlnam https://expensify.slack.com/archives/C01GTK53T8Q/p1628105225147400

Seeing -1 with no unread messages

isagoico avatar Aug 05 '21 17:08 isagoico

Triggered auto assignment to @alex-mechler (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 05 '21 17:08 MelvinBot

I wonder if this is somehow related to https://github.com/Expensify/App/issues/4273.

Either way, looks like a good external issue!

alex-mechler avatar Aug 05 '21 17:08 alex-mechler

Triggered auto assignment to @trjExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Aug 05 '21 17:08 MelvinBot

Could be related but a quick fix for this can be:

Proposal

In updateUnread/index.website.js Change the code from const hasUnread = totalCount !== 0; --> const hasUnread = totalCount > 0;

This block in UnreadIndicatorUpdate must be causing it:

const throttledUpdatePageTitleAndUnreadCount = _.throttle(() => {
    // If all of our nonzero unread action counts show -1, update the unread count to be -1 as well so we don't show a
    // number in the indicator badge.
    if (_.every(unreadActionCounts, count => count < 1) && _.some(unreadActionCounts, count => count === -1)) {
        updateUnread(-1); // THIS CALL
        return;
    }

mananjadhav avatar Aug 05 '21 17:08 mananjadhav

Looks like a dupe of this issue: https://github.com/Expensify/App/issues/4273 so I'm going to close this out. Let me know if you disagree, or missed something!

trjExpensify avatar Aug 09 '21 21:08 trjExpensify

I think this issue should be reopened explained by my comments here: https://github.com/Expensify/App/issues/4273#issuecomment-927821515

-1 seems to be a special case we're intentionally setting as a count (see updateUnread(-1))

https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/index.js#L15-L18

But we're only handling the -1 case on iOS

https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.js#L9-L15

While the rest of the platforms leave the count as is:

Desktop

https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.js#L10-L14

Web

https://github.com/Expensify/App/blob/b4c876a19e14b4dfb39afacd2e39514adf4c5c7b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js#L11-L15


It's seems this comment is outdated:

If all of our nonzero unread action counts show -1, update the unread count to be -1 as well so we don't show a number in the indicator badge.

Because on iOS we're specifically showing (1) when totalCount is -1

Can we clarify the expected behavior when totalCount is -1

  • show no badge/tab count
  • show (1)

cc @trjExpensify

kidroca avatar Sep 27 '21 13:09 kidroca

Thats the direction had put, starting we're forcefully updating -1 in my comment https://github.com/Expensify/App/issues/4425#issuecomment-893659947

mananjadhav avatar Sep 27 '21 14:09 mananjadhav

Happy to reopen and investigate, let's get someone from the CME team to take a look. I'll re-add the label!

trjExpensify avatar Sep 29 '21 18:09 trjExpensify

Triggered auto assignment to @alex-mechler (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Sep 29 '21 18:09 MelvinBot

@yuwenmemon I see you in the blame for the iOS files. Do you have any context you can add here?

alex-mechler avatar Sep 29 '21 19:09 alex-mechler

Can we clarify the expected behavior when totalCount is -1

We should be showing (1)

yuwenmemon avatar Sep 29 '21 20:09 yuwenmemon

Ok so it seems we can update the call updateUnread(-1) to have a check like in .ios and call with updateUnread(1). So that we don't make the -1 check per each platform

kidroca avatar Sep 30 '21 10:09 kidroca

@trjExpensify Looks like this can go external now that we know what the expected behavior is

alex-mechler avatar Sep 30 '21 19:09 alex-mechler

Triggered auto assignment to @iwiznia (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Sep 30 '21 23:09 MelvinBot

Perfect. Job is up on Upwork here, but I'm adding n6-hold 👍

trjExpensify avatar Sep 30 '21 23:09 trjExpensify

Ok so it seems we can update the call updateUnread(-1) to have a check like in .ios and call with updateUnread(1). So that we don't make the -1 check per each platform

Sounds good to me. @trjExpensify can you hire @kidroca?

iwiznia avatar Oct 01 '21 10:10 iwiznia

I've submitted a proposal in Upwork

kidroca avatar Oct 04 '21 15:10 kidroca

Perfect, thanks! Hired! 👍

trjExpensify avatar Oct 04 '21 16:10 trjExpensify

I've applied the change, but I can't find a way to test and verify it works

Tracing the code so far it seems a -1 count would be made when we have reports that have a preference of REPORT.NOTIFICATION_PREFERENCE.DAILY

This preference seems to be set from ReportDetailsPage A link to this page seems to be available from the Report Header, but only for certain report types - isDefaultRoom I don't seem to have any such reports (All my reports have chatType: '') and I don't know how to create one of the default types:

  • CONST.REPORT.CHAT_TYPE.POLICY_ADMINS
  • CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE
  • or CONST.REPORT.CHAT_TYPE.DOMAIN_ALL

https://github.com/Expensify/App/blob/04083b154f5171b125fd92a8223e2863db799973/src/pages/home/HeaderView.js#L126-L133

When I press the header of a report I see participant(s) details

I can get to this page on web by appending /details to the url of a report, but can't do it on the rest of the platforms any tips?

kidroca avatar Oct 06 '21 13:10 kidroca

Ah @yuwenmemon, do you know how external contributors can access rooms to test, or is adding @kidroca to the beta the only way?

trjExpensify avatar Oct 07 '21 00:10 trjExpensify