Skip to content

Conversation

@staticpayload
Copy link

@staticpayload staticpayload commented Dec 28, 2025

Summary

Fixes #71

The Problem

In the threads view, it's hard to know which threads have unread comments. The regular room unread logic (based on timestamp) doesn't work for threads because you could have read everything in a recent thread but have unread comments in an older thread.

The Solution

Made the "Last reply [timestamp]" bold and black when there's unread activity in a thread for participating users.

Implementation

1. Thread Model (app/models/rooms/thread.rb)

Added two methods:

participating?(user) - Returns true if user:

  • Created the parent message (original message being threaded)
  • Created the thread (first commenter)
  • Has a visible membership (not "invisible" involvement)
  • Was mentioned (which gives them a membership)

unread_for_participating?(user) - Checks if the user's membership has unread messages based on unread_at timestamp.

2. Threads View (app/views/messages/_threads.html.erb)

<% is_participating = thread.participating?(Current.user) %>
<% has_unread = is_participating && thread.unread_for_participating?(Current.user) %>

<% timestamp_class = has_unread ? "txt-primary fw-800" : "txt-muted" %>
<span class="<%= timestamp_class %>">Last reply <%= local_datetime_tag ... %></span>

3. Utility CSS (app/assets/stylesheets/application/utilities.css)

Added .fw-800 { font-weight: 800; } to match sidebar bold styling.

Visual Result

State Appearance
Unread (participating) Last reply 2 hours ago (bold, black)
Read (participating) Last reply 2 hours ago (muted, gray)
Non-participating Last reply 2 hours ago (muted, gray)

Testing

  • Participating user sees bold timestamp for unread threads
  • Participating user sees muted timestamp for read threads
  • Non-participating user always sees muted timestamp
  • Participation correctly detected (parent creator, thread creator, membership)

AI Disclosure

This PR was developed with AI assistance:

  • Opus 4.5 for planning and code review
  • GLM 4.7 for code execution
  • GitHub PR review for quality assurance

@staticpayload

This comment was marked as spam.

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.

Show unread status on threads you're participating in

1 participant