Skip to content
New issue

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

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

Already on GitHub? # to your account

Mark All As Read doesn't really #1353

Closed
ThisIsMissEm opened this issue Apr 7, 2014 · 6 comments
Closed

Mark All As Read doesn't really #1353

ThisIsMissEm opened this issue Apr 7, 2014 · 6 comments
Assignees
Milestone

Comments

@ThisIsMissEm
Copy link
Contributor

When on: https://community.nodebb.org/unread

I have 20+ unread threads, I click Mark All As Read, then reload the page, to see yet more unread items.

@julianlam
Copy link
Member

For scalability purposes, the "Unread" page only checks unread from the past 30 days. This was done for scalability purposes (otherwise if you had no unread, we'd check every single topic for read state).

Mark All As Read does the same I believe... calls getUnreadTids and marks those tids unread. Perhaps we should just use async.whilst and repeatedly call getUnreadTids, until the # of returned tids is 0.

@julianlam julianlam added bug and removed bug labels Apr 7, 2014
@julianlam julianlam added this to the 0.4.1 milestone Apr 7, 2014
@psychobunny
Copy link
Contributor

Alternatively, save the last time the button was pressed and don't return
posts before that date
On 2014-04-06 10:13 PM, "Julian Lam" notifications@github.com wrote:

For scalability purposes, the "Unread" page only checks unread from the
past 30 days. This was done for scalability purposes (otherwise if you had
no unread, we'd check every single topic for read state).

Mark All As Read does the same I believe... calls getUnreadTids and marks
those tids unread. Perhaps we should just use async.whilsthttps://github.com/caolan/async#whilstand repeatedly call getUnreadTids, until the # of returned tids is 0.

Reply to this email directly or view it on GitHubhttps://github.com//issues/1353#issuecomment-39691173
.

@RayBenefield
Copy link

Dammit psycho that's what I was going to suggest. :p I think it could work.

@ThisIsMissEm
Copy link
Contributor Author

@psychobunny that's sort of what I'm thinking. Looking through the code, the storage of this seems a little strange at the moment, as it's thread -> user mappings, rather that user -> thread mappings.

I think change the internal storage of this might make things nicer. But then again, my eyes are getting a little blurry and it's 3am.

If we stored the unread state for threads as a a list per user, then we could just truncate that list. However, that means you're stored 0-M values in N lists, where M is the number of threads on in total on the forum, and N is the number of users. That's a lot of duplicate data.

However, we can save on that data by for each user, also storing the last time they pressed Mark All As Read, if it's nil, then we can assume that they've never read anything, in which case, they don't need a list of unread topics. We just give them all the topics.

I think the inversed mapping is the way to go, unless there's a deeper reason for it being this way?

@barisusakli
Copy link
Member

Yeah reversing the mapping makes it complicated when someone makes a new post to a topic and you have to mark that topic as unread for all users. You would have to go through all users and add the topic to their unread list. Right now it is just a single command to clear the read by uid set. Also see #1090. Before it was marking everything maybe we can revert back to that.

@ThisIsMissEm
Copy link
Contributor Author

What about if we stored both? (I guess that could lead to consistency problems unless implemented with MULTI/EXEC or Transactions.)

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants