11- status = state[:status ] || " new"
2+ - reading_unread_count = nil
3+ - if status.to_s == " reading"
4+ - read_count = state[:read_count ].to_i
5+ - total_count = topic.message_count
6+ - reading_unread_count = [total_count - read_count, 0 ].max
27- status_class = " status-#{ status } "
8+ - status_class = " #{ status_class } has-new-replies" if status.to_s == " reading" && reading_unread_count.to_i.positive?
39- star_data = star_data || {}
410td .topic-title .status-border class =status_class id =dom_id(topic, "status_cell") data-label="Topic"
511 - creator = topic.creator_display_alias
612 - last_sender = topic.last_sender_person&.default_alias
713 .topic-title-main
8- - if status.to_s == " reading"
9- - read_count = state[:read_count ].to_i
10- - total_count = topic.message_count
11- - unread_count = [total_count - read_count, 0 ].max
12- - if unread_count.positive?
13- = link_to topic_path(topic, anchor: " first-unread" ), class : " topic-icon topic-icon-reading" , title: " Jump to first unread message (#{ unread_count } unread)" do
14- i .fa-solid .fa-envelope
15- span .topic-icon-badge .topic-icon-badge-sup = unread_count
16- - else
17- .topic-icon .topic-icon-reading title =" All messages read"
18- i .fa-solid .fa-envelope
19- = render partial: " topics/star_icon" , locals: { topic: topic, star_data: star_data }
20- = render partial: " topics/note_icon" , locals: { topic: topic, count: note_count.to_i }
21- = render partial: " topics/team_readers_icon" , locals: { topic: topic, readers: team_readers }
22- - commitfest_summary = @commitfest_summaries &.dig(topic.id)
23- - if commitfest_summary
24- = render partial: " topics/commitfest_icon" , locals: { summary: commitfest_summary }
25- - elsif topic.has_attachments?
26- .topic-icon title =" Attachments"
27- i .fa-solid .fa-paperclip
14+ .topic-title-icons
15+ - if status.to_s == " reading"
16+ - if reading_unread_count.to_i.positive?
17+ = link_to topic_path(topic, anchor: " first-unread" ), class : " topic-icon topic-icon-reading" , title: " Jump to first unread message (#{ reading_unread_count } unread)" do
18+ i .fa-solid .fa-envelope
19+ span .topic-icon-badge .topic-icon-badge-sup = reading_unread_count
20+ - else
21+ .topic-icon .topic-icon-reading title =" All messages read"
22+ i .fa-solid .fa-envelope
23+ = render partial: " topics/star_icon" , locals: { topic: topic, star_data: star_data }
24+ = render partial: " topics/note_icon" , locals: { topic: topic, count: note_count.to_i }
25+ = render partial: " topics/team_readers_icon" , locals: { topic: topic, readers: team_readers }
26+ - commitfest_summary = @commitfest_summaries &.dig(topic.id)
27+ - if commitfest_summary
28+ = render partial: " topics/commitfest_icon" , locals: { summary: commitfest_summary }
29+ - elsif topic.has_attachments?
30+ .topic-icon title =" Attachments"
31+ i .fa-solid .fa-paperclip
2832 = link_to topic.title, topic_path(topic), class : " topic-link"
2933 .topic-title-mobile
3034 = link_to topic.title, topic_path(topic), class : " topic-link"
@@ -41,26 +45,24 @@ td.topic-title.status-border class=status_class id=dom_id(topic, "status_cell")
4145 .topic-row-footer
4246 .topic-footer-icons
4347 .topic-icons
44- - if status.to_s == " reading"
45- - read_count = state[:read_count ].to_i
46- - total_count = topic.message_count
47- - unread_count = [total_count - read_count, 0 ].max
48- - if unread_count.positive?
49- = link_to topic_path(topic, anchor: " first-unread" ), class : " topic-icon topic-icon-reading" , title: " Jump to first unread message (#{ unread_count } unread)" do
50- i .fa-solid .fa-envelope
51- span .topic-icon-badge .topic-icon-badge-sup = unread_count
52- - else
53- .topic-icon .topic-icon-reading title =" All messages read"
54- i .fa-solid .fa-envelope
55- = render partial: " topics/star_icon" , locals: { topic: topic, star_data: star_data }
56- = render partial: " topics/note_icon" , locals: { topic: topic, count: note_count.to_i }
57- = render partial: " topics/team_readers_icon" , locals: { topic: topic, readers: team_readers }
58- - commitfest_summary = @commitfest_summaries &.dig(topic.id)
59- - if commitfest_summary
60- = render partial: " topics/commitfest_icon" , locals: { summary: commitfest_summary }
61- - elsif topic.has_attachments?
62- .topic-icon title =" Attachments"
63- i .fa-solid .fa-paperclip
48+ .topic-title-icons
49+ - if status.to_s == " reading"
50+ - if reading_unread_count.to_i.positive?
51+ = link_to topic_path(topic, anchor: " first-unread" ), class : " topic-icon topic-icon-reading" , title: " Jump to first unread message (#{ reading_unread_count } unread)" do
52+ i .fa-solid .fa-envelope
53+ span .topic-icon-badge .topic-icon-badge-sup = reading_unread_count
54+ - else
55+ .topic-icon .topic-icon-reading title =" All messages read"
56+ i .fa-solid .fa-envelope
57+ = render partial: " topics/star_icon" , locals: { topic: topic, star_data: star_data }
58+ = render partial: " topics/note_icon" , locals: { topic: topic, count: note_count.to_i }
59+ = render partial: " topics/team_readers_icon" , locals: { topic: topic, readers: team_readers }
60+ - commitfest_summary = @commitfest_summaries &.dig(topic.id)
61+ - if commitfest_summary
62+ = render partial: " topics/commitfest_icon" , locals: { summary: commitfest_summary }
63+ - elsif topic.has_attachments?
64+ .topic-icon title =" Attachments"
65+ i .fa-solid .fa-paperclip
6466 - replies_count = [topic.message_count - 1 , 0 ].max
6567 .topic-footer-replies = pluralize(replies_count, " reply" )
6668 .topic-footer-time title =absolute_time_display(topic.last_message_at) = smart_time_display(topic.last_message_at)
0 commit comments