Giter Site home page Giter Site logo

Comments (7)

swelham avatar swelham commented on June 21, 2024

Not such a bad idea - we would only need to know the last time they viewed the comments for a particular item and then just see if there are any new comments since that date.

from pullup.

sriehl avatar sriehl commented on June 21, 2024

I think a simple way to do it would be have a list of users who have seen the comments on that item. When a new comment is added, clear the list.

It's doesn't add any database calls when viewing the home page.

from pullup.

kennethrapp avatar kennethrapp commented on June 21, 2024

i'm working on this right now. It adds the date of the latest comment and name of the latest commenter to the news item object, and sets it in the view as data items in the comment link. I'm planning to use session storage (maybe) to check that when the document loads in main.js.

from pullup.

chall8908 avatar chall8908 commented on June 21, 2024

@kennethrapp wouldn't it make more sense to use localStorage?

from pullup.

kennethrapp avatar kennethrapp commented on June 21, 2024

Probably.

Since I clearly can't decide on anything I just removed storage entirely pending further discussion, since I don't know what the best solution in node would be for that. I don't want to contribute to bloat too much. It just shows the time of the latest comment.

from pullup.

treygriffith avatar treygriffith commented on June 21, 2024

@sriehl editing the same array in mongodb at the same time (which would be the case any time two users viewed a story at the same time) can be tricky. Only the $push and $addToSet operators work for this purpose, and I'm generally wary of editing the story for what is fundamentally an attribute of the user.

@chall8908 I actually think localStorage is not the right answer for this since it wouldn't translate across devices. I know that's fairly small potatoes, but I'd rather design for a multi-device world at the outset.

from pullup.

treygriffith avatar treygriffith commented on June 21, 2024

I think this was addressed, at least for the time being, by using a query string in the url to the comments page (#246). That way your browser shows the comments link as a new one if there have been new comments since your last visit. It certainly isn't a comprehensive solution, but it's simple and gets the job done.

from pullup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.