enBloc-org / kindly

Open source repository for the development of Kindly
GNU General Public License v3.0
18 stars 21 forks source link

Unread messages not being flagged in `ConversationCard.tsx` #329

Closed camelPhonso closed 1 month ago

camelPhonso commented 2 months ago

Description of the Bug

In our seed data there is a message unread for each of the test users in separate conversations.

When we first start the environment we can see the notification dot over the button linking to /conversations but once we navigate to that route the notification is not showing in the appropriate conversation.

From / Image

From /conversations Image

Similarly, if you send a new message and then log in as the other user you can see that the /conversations link shows a notification dot but the relevant ConversationCard.tsx does not.

What should happen instead

The conversation that previews "Unread to refugee" should be marked as unread when you are logged in as the refugee. The same should happen with the last conversation on the list when you log in as the donor.

Note: Marking a conversation as unread by clicking the dropdown menu on the ConversationCard.tsx still works as expected. Image

Steps to reproduce this bug

  1. npx supabase db reset if you have been interacting with the data before this
  2. start the application
  3. log in as the test refugee or test donor
  4. visit the /conversations route
  5. you should see one of the conversations highlighted with a notification dot, but you don't right now

What could we do to solve this bug?

ConversationsList.tsx sets a state that is intended to map through the list of all conversations and map out an array of the conversation_id value of each conversation that has notifications (check the database schema for this). That list is passed down to the ConversationCard.tsx to allow an evaluation that decides whether the notification dot should be showing.

This at least is how it was working before, but that logic seems to have been lost maybe in a merge.

The solution may look different now, but will surely need touching those files.

🧪 This will need some E2E tests being added to avoid further regression. Cypress is still frighteningly blind to our messaging right now.

Assignment

This issue is free for anyone to take

github-actions[bot] commented 1 month ago

🤖 meep morp!

This Issue is now marked as stale because there has been no activity for a while.

🔎 The Issue will be automaticaly unassigned and moved to the Backlog if it doesn't receive new activity in the next 7 days.

💡 To unstale this Issue please push any commits that are ready or provide an update in the comments.

AnyaVeselova commented 1 month ago

!request I'd like to take on the issue.

camelPhonso commented 1 month ago

I'd like to take on the issue.

This issue has a pr in review at the moment :)