Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ export default class AiConversationsSidebarManager extends Service {
const now = Date.now();
const fresh = [];

const todaySection = {
name: "today",
title: i18n("discourse_ai.ai_bot.conversations.today"),
links: new TrackedArray(),
};
fresh.push(todaySection);

this.topics.forEach((t) => {
const postedAtMs = new Date(t.last_posted_at || now).valueOf();
const diffDays = Math.floor((now - postedAtMs) / 86400000);
Expand All @@ -233,13 +240,16 @@ export default class AiConversationsSidebarManager extends Service {
dateGroup = key;
}

let sec = fresh.find((s) => s.name === dateGroup);
let sec;
if (dateGroup === "today") {
sec = todaySection;
} else {
sec = fresh.find((s) => s.name === dateGroup);
}

if (!sec) {
let title;
switch (dateGroup) {
case "today":
title = i18n("discourse_ai.ai_bot.conversations.today");
break;
case "last-7-days":
title = i18n("discourse_ai.ai_bot.conversations.last_7_days");
break;
Expand Down
5 changes: 5 additions & 0 deletions assets/stylesheets/modules/ai-bot-conversations/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ body.has-ai-conversations-sidebar {
}
}

// we always have the "today" section rendered at the top of the sidebar but hide it when empty
.sidebar-section[data-section-name="today"]:has(.ai-bot-sidebar-empty-state) {
display: none;
}

.sidebar-toggle-all-sections {
display: none;
}
Expand Down
Loading