Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/assets/stylesheets/components/topics.css
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ a.topic-icon {
gap: var(--spacing-2);
}

.topic-title-icons {
min-width: 0;
}

.topic-icon {
padding: 2px;
margin-right: 0;
Expand Down Expand Up @@ -303,6 +307,14 @@ a.topic-icon {
}
}

.topic-row.topic-reading.has-new-replies {
background: var(--color-bg-unread);

&:hover {
background: var(--color-bg-unread-hover);
}
}

.topic-row.topic-read {
color: var(--color-text-muted);
background: var(--color-bg-read);
Expand All @@ -320,6 +332,8 @@ a.topic-icon {
padding: var(--spacing-2) var(--spacing-4) var(--spacing-2) var(--spacing-2);
align-self: stretch;
height: 100%;
min-width: var(--topic-title-icons-width, 190px);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't look strange?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would this look strange? Did you pull and look at it?

flex-shrink: 0;
}

.status-border.has-new-replies::before {
Expand All @@ -329,7 +343,7 @@ a.topic-icon {
top: 0;
bottom: 0;
width: var(--topic-new-replies-strip-width, 260px);
background: var(--color-bg-unread);
background: var(--color-bg-read);
clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
z-index: 0;
}
Expand Down
10 changes: 9 additions & 1 deletion app/views/topics/_topic_row_user.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
- participation = participation || {}
- team_readers = team_readers || []
- star_data = star_data || {}
- status = state[:status] || "new"
- reading_unread_count = nil
- if status.to_s == "reading"
- read_count = state[:read_count].to_i
- total_count = topic.message_count
- reading_unread_count = [total_count - read_count, 0].max
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the exact count? If the status is reading, we have at least one unread messages, and that's all we need here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because without we can show "has-new-replies" even when there are no unread messages? The envelope icon also only appears when reading_unread_count is positive, which is why we used the count to gate the has-new-replies or what am I missing?

- row_class = ["topic-row", "topic-#{status}"]
- row_class << "has-new-replies" if status.to_s == "reading" && reading_unread_count.to_i.positive?
- topic_participants_map ||= @topic_participants_map || {}
- tp_data = topic_participants_map[topic.id] || {}
- top_participants = tp_data[:top] || []
- contributor_participants = tp_data[:contributors] || []

tr id=dom_id(topic) class="topic-row topic-#{state[:status] || 'new'}" data-topic-id=topic.id data-last-message-id=topic.last_message_id
tr id=dom_id(topic) class=row_class.join(" ") data-topic-id=topic.id data-last-message-id=topic.last_message_id
= render partial: "topics/status_cell", locals: { topic: topic, state: state, note_count: note_count, team_readers: team_readers, star_data: star_data }
td.topic-activity data-label="Activity"
- replies_count = [topic.message_count - 1, 0].max
Expand Down