Skip to content

Conversation

@musonza
Copy link
Owner

@musonza musonza commented Jan 5, 2026

Summary

  • Fixes readAll() to only update notifications where is_sender=0
  • Previously it updated ALL notifications for a participant, including their sent messages
  • This was inefficient and could cause unintended side effects

The Problem

When a user called readAll(), it would mark ALL their message notifications as read, including messages they sent. While sent messages already have is_seen=1 from creation, the update query was still hitting those rows unnecessarily.

The Fix

Added ->where('is_sender', 0) condition to the update query so only received messages are marked as read.

Test plan

  • Added test that verifies sent messages are not updated by readAll()
  • All existing tests pass (78 total)

Closes #210

Previously, readAll() would update all message notifications for a
participant, including messages they sent. This was unnecessary since
sent messages already have is_seen=1 from creation.

Now readAll() only updates notifications where is_sender=0, ensuring
only received messages are marked as read. This is more efficient and
prevents unintended side effects on sent message notifications.

Closes #210
@musonza musonza merged commit 54a5237 into master Jan 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReadAll sets status for all participants

2 participants