Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostStreamScrubber shows "0 UNREAD" when reply composer is open #3838

Open
iPurpl3x opened this issue Jun 21, 2023 · 2 comments
Open

PostStreamScrubber shows "0 UNREAD" when reply composer is open #3838

iPurpl3x opened this issue Jun 21, 2023 · 2 comments
Labels

Comments

@iPurpl3x
Copy link
Contributor

Current Behavior

When a logged in user has read all the posts of a discussion and opens the reply composer, the PostStreamScrubber unnecessarily shows "0 UNREAD".

Steps to Reproduce

  1. Login
  2. Open a discussion
  3. Scroll to the bottom to mark all posts as read
  4. Open the reply composer

Expected Behavior

"0 UNREAD" should be hidden, like it was in previous flarum versions.

Screenshots

image

Environment

Output of php flarum info

No response

Possible Solution

No response

Additional Context

No response

@gianniguida
Copy link
Contributor

This is the commit that is causing this issue: 11aa7bb

opacity: unreadPercent ? 1 : 0,

When there aren't any new unread posts, for some reason unreadPercent is evaluated true only when the composer opens..

@luceos
Copy link
Member

luceos commented Jun 26, 2023

It seems to evaluate to a negative value for me locally.

image

That is caused by

const unreadPercent = count ? Math.min(count - this.stream.index, unreadCount) / count : 0;

Where the index is increased by 1 for the draft post, being more than the count itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants