Open JAWD-001 opened 1 year ago
@bbelderbos I am thinking of something for a chat messages notification. I was going to put a "read" attribute on the private chat message model with a default of false. Then in the view, when it calls all the messages, we can filter new messages that have a false value in the read attribute. Then on the front end do a little something like "if len(new_messages) > 0 in context:" with a little html element to populate for a visual notification to the user. What do you think?
I was thinking of the chat view right after we query all chat messages to render on the front end, do a check or something. Like
new_messages = PrivateChatMessage.objects.filter(read = False) new_messages.read = True new_messages.save
Does this make sense?
I like that. You code marks them all "read", that's because they are displayed all at once? Then that works.
Yeah, we can do it at the view where we populate all old messages from the db. Then after that immediately could store the new_messages as saved with the new True value for read. Good flow right? Hey, I'm getting there even in my problem solving!
Great! But does this feature make sense for chat? When you're chatting the messages usually are instantly read no? Or is this when you close the chat and come back later? (Like Slack?)
Future Feature
Create a notification system that provides user with notification of chat message in private chats or friend request received
Potentially add comments on user posts as well