Skip to content

Commit a869769

Browse files
committed
Fix read row display, again
This was broken by the caching commit because we only refreshed the leftmost td. The code is now modified to refresh the entire row, so that the row classes are also updated.
1 parent be5ad55 commit a869769

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
- state = state || {}
2+
- note_count = note_count.to_i
3+
- participation = participation || {}
4+
- team_readers = team_readers || []
5+
6+
tr id=dom_id(topic) class="topic-row topic-#{state[:status] || 'new'}" data-topic-id=topic.id data-last-message-id=topic.messages.maximum(:id)
7+
= render partial: "topics/status_cell", locals: { topic: topic, state: state, note_count: note_count, team_readers: team_readers }
8+
td.topic-activity data-label="Activity"
9+
- last_message = topic.messages.order(:created_at).last
10+
- replies_count = [topic.messages.count - 1, 0].max
11+
.activity-info.compact
12+
.activity-replies = pluralize(replies_count, "reply")
13+
.activity-time title=absolute_time_display(last_message.created_at) = smart_time_display(last_message.created_at)
14+
td.topic-participants data-label="Participants"
15+
- participants = topic.participant_aliases(limit: 5)
16+
- participant_count = topic.participant_count
17+
= render partial: "avatar_list", locals: { participants: participants, total_participants: participant_count }
18+
- if topic.has_contributor_activity?
19+
- contributor_participants = topic.contributor_participants
20+
- contributor_count = contributor_participants.size
21+
div class ="topic-icon activity-#{ topic.highest_contributor_activity }" data-controller="hover-popover" data-hover-popover-delay-value="200" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide"
22+
i.fa-solid.fa-users-rays
23+
- if contributor_count.positive?
24+
span.topic-icon-badge = contributor_count
25+
- if contributor_participants.any?
26+
.topic-icon-hover data-hover-popover-target="popover" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide"
27+
- contributor_participants.each do |participant|
28+
= render partial: "participant_row", locals: { participant: participant, avatar_size: 32 }
29+
= render partial: "topics/participation_icon", locals: { topic: topic, participation: participation }

app/views/topics/_topics.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- topics.each do |topic|
2-
tr class="topic-row" data-topic-id=topic.id data-last-message-id=topic.messages.maximum(:id)
2+
tr id=dom_id(topic) class="topic-row" data-topic-id=topic.id data-last-message-id=topic.messages.maximum(:id)
33
= render partial: "topics/status_cell", locals: { topic: topic, state: {}, note_count: 0, team_readers: [] }
44
td.topic-activity data-label="Activity"
55
- last_message = topic.messages.order(:created_at).last

app/views/topics/user_state_frame.turbo_stream.slim

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
- participation = @participation_flags&.dig(topic.id) || {}
55
- team_readers = state[:team_readers] || []
66

7-
= turbo_stream.replace dom_id(topic, "status_cell") do
8-
= render partial: "topics/status_cell", locals: { topic: topic, state: state, note_count: note_count, team_readers: team_readers }
9-
10-
= turbo_stream.replace dom_id(topic, "participation") do
11-
= render partial: "topics/participation_icon", locals: { topic: topic, participation: participation }
7+
= turbo_stream.replace dom_id(topic) do
8+
= render partial: "topics/topic_row_user", locals: { topic: topic, state: state, note_count: note_count, participation: participation, team_readers: team_readers }

0 commit comments

Comments
 (0)