|
1 | 1 | - topics.each do |topic| |
2 | | - - state = @topic_states&.dig(topic.id) || {} |
3 | | - - team_readers = state[:team_readers] || [] |
4 | | - - filtered_readers = team_readers |
5 | | - - if params[:team_id].present? |
6 | | - - filtered_readers = team_readers.select { |r| r[:team_ids]&.include?(params[:team_id].to_i) } |
7 | | - - other_team_readers = filtered_readers.reject { |r| r[:user].id == current_user&.id }.uniq { |r| r[:user].id } |
8 | | - tr class="topic-row topic-#{state[:status]}" data-topic-id=topic.id data-last-message-id=topic.messages.maximum(:id) |
9 | | - td class="topic-title status-border status-#{state[:status] || 'new'}" data-label="Topic" |
10 | | - - if state[:status] == :reading |
11 | | - - unread_count = [topic.messages.count - state[:read_count], 0].max |
12 | | - .topic-icon.topic-icon-reading |
13 | | - i.fa-solid.fa-envelope |
14 | | - - if unread_count.positive? |
15 | | - span.topic-icon-badge.topic-icon-badge-sup = unread_count |
16 | | - - if user_signed_in? && other_team_readers.any? |
17 | | - - reader_count = other_team_readers.size |
18 | | - div class="topic-icon activity-team-read" data-controller="hover-popover" data-hover-popover-delay-value="200" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide" |
19 | | - i.fa-solid.fa-users |
20 | | - - if reader_count.positive? |
21 | | - span.topic-icon-badge = reader_count |
22 | | - .topic-icon-hover data-hover-popover-target="popover" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide" |
23 | | - - other_team_readers.each do |reader| |
24 | | - - alias_record = reader[:user].primary_alias || reader[:user].aliases.first |
25 | | - - next unless alias_record |
26 | | - - participant_stub = { alias: alias_record } |
27 | | - = render partial: "participant_row", locals: { participant: participant_stub, avatar_size: 32, tooltip: "#{alias_record.name} (#{reader[:status]})" } |
28 | | - - if user_signed_in? |
29 | | - - note_count = @topic_note_counts&.dig(topic.id).to_i |
30 | | - - if note_count.positive? |
31 | | - div class="topic-icon activity-note" data-controller="hover-popover" data-hover-popover-delay-value="200" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide" |
32 | | - i.fa-solid.fa-note-sticky |
33 | | - span.topic-icon-badge = note_count |
34 | | - - if topic.attachments.exists? |
35 | | - .topic-icon |
36 | | - i.fa-solid.fa-paperclip |
37 | | - = link_to topic.title, topic_path(topic), class: "topic-link" |
| 2 | + tr class="topic-row" data-topic-id=topic.id data-last-message-id=topic.messages.maximum(:id) |
| 3 | + = render partial: "topics/status_cell", locals: { topic: topic, state: {}, note_count: 0, team_readers: [] } |
38 | 4 | td.topic-activity data-label="Activity" |
39 | 5 | - last_message = topic.messages.order(:created_at).last |
40 | 6 | - replies_count = [topic.messages.count - 1, 0].max |
|
56 | 22 | .topic-icon-hover data-hover-popover-target="popover" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide" |
57 | 23 | - contributor_participants.each do |participant| |
58 | 24 | = render partial: "participant_row", locals: { participant: participant, avatar_size: 32 } |
59 | | - - if user_signed_in? |
60 | | - - participation = @participation_flags&.dig(topic.id) |
61 | | - - show_team_icon = participation && (participation[:team] || participation[:mine]) |
62 | | - - if show_team_icon |
63 | | - - icon_classes = ["topic-icon", "activity-team"] |
64 | | - - icon_classes << "is-mine" if participation[:mine] |
65 | | - - aliases = participation[:aliases] || [] |
66 | | - div class=icon_classes.join(" ") data-controller="hover-popover" data-hover-popover-delay-value="200" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide" |
67 | | - i.fa-solid.fa-user-group |
68 | | - - if aliases.size > 1 |
69 | | - span.topic-icon-badge = aliases.size |
70 | | - - if aliases.any? |
71 | | - .topic-icon-hover data-hover-popover-target="popover" data-action="mouseenter->hover-popover#show mouseleave->hover-popover#scheduleHide" |
72 | | - - aliases.each do |alias_record| |
73 | | - - participant_stub = { alias: alias_record } |
74 | | - = render partial: "participant_row", locals: { participant: participant_stub, avatar_size: 32, tooltip: alias_record.name } |
| 25 | + = render partial: "topics/participation_icon", locals: { topic: topic, participation: {} } |
0 commit comments