|
@@ -4,7 +4,7 @@ import { NavigationEnd, Router, RouterLink } from '@angular/router';
|
|
|
import { effect, untracked } from '@angular/core';
|
|
import { effect, untracked } from '@angular/core';
|
|
|
import { UiAvatar, UiButton, UiEmpty, UiInput, UiModal, UiSkeleton, UiSwitch, UiTooltip } from '../../../ui';
|
|
import { UiAvatar, UiButton, UiEmpty, UiInput, UiModal, UiSkeleton, UiSwitch, UiTooltip } from '../../../ui';
|
|
|
import { navItemActive } from '../../../desktop/shell/dk-top-nav/dk-top-nav';
|
|
import { navItemActive } from '../../../desktop/shell/dk-top-nav/dk-top-nav';
|
|
|
-import { ChatSession, groupOf } from '../../../core/chat-session';
|
|
|
|
|
|
|
+import { ChatSession, groupOf, sortSessions } from '../../../core/chat-session';
|
|
|
import { ChatSessionService } from '../../../core/chat-session.service';
|
|
import { ChatSessionService } from '../../../core/chat-session.service';
|
|
|
import { TaskPulseService } from '../../../core/task-pulse.service';
|
|
import { TaskPulseService } from '../../../core/task-pulse.service';
|
|
|
import { Workspace, WorkspaceService } from '../../../core/workspace.service';
|
|
import { Workspace, WorkspaceService } from '../../../core/workspace.service';
|
|
@@ -2197,7 +2197,9 @@ export class SessionTreeComponent implements OnDestroy {
|
|
|
*/
|
|
*/
|
|
|
/** 群会话(2026-11-05) */
|
|
/** 群会话(2026-11-05) */
|
|
|
protected readonly groupSessions = computed(() =>
|
|
protected readonly groupSessions = computed(() =>
|
|
|
- this.filter(this.sessionsSvc.all().filter((s) => s.kind === 'group' && !s.archived)),
|
|
|
|
|
|
|
+ this.filter(
|
|
|
|
|
+ sortSessions(this.sessionsSvc.all().filter((s) => s.kind === 'group' && !s.archived)),
|
|
|
|
|
+ ),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
/** 日常对话:非群聊、无项目归属 */
|
|
/** 日常对话:非群聊、无项目归属 */
|
|
@@ -2242,14 +2244,18 @@ export class SessionTreeComponent implements OnDestroy {
|
|
|
|
|
|
|
|
protected readonly dailyArchived = computed(() =>
|
|
protected readonly dailyArchived = computed(() =>
|
|
|
this.filter(
|
|
this.filter(
|
|
|
- this.sessionsSvc.all().filter((s) => s.archived && groupOf(s).kind === 'daily'),
|
|
|
|
|
|
|
+ sortSessions(
|
|
|
|
|
+ this.sessionsSvc.all().filter((s) => s.archived && groupOf(s).kind === 'daily'),
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
/** 群聊的已归档(2026-11-08:归档回到群聊分组,不再掉进「日常对话」) */
|
|
/** 群聊的已归档(2026-11-08:归档回到群聊分组,不再掉进「日常对话」) */
|
|
|
protected readonly groupArchived = computed(() =>
|
|
protected readonly groupArchived = computed(() =>
|
|
|
this.filter(
|
|
this.filter(
|
|
|
- this.sessionsSvc.all().filter((s) => s.archived && groupOf(s).kind === 'group'),
|
|
|
|
|
|
|
+ sortSessions(
|
|
|
|
|
+ this.sessionsSvc.all().filter((s) => s.archived && groupOf(s).kind === 'group'),
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -2553,7 +2559,23 @@ export class SessionTreeComponent implements OnDestroy {
|
|
|
|
|
|
|
|
/** 某归属下的活跃会话(按更新时间倒序由 service 保证) */
|
|
/** 某归属下的活跃会话(按更新时间倒序由 service 保证) */
|
|
|
private activeList(owner: string | null): ChatSession[] {
|
|
private activeList(owner: string | null): ChatSession[] {
|
|
|
- return this.sessionsSvc.all().filter((s) => !s.archived && this.ownerOf(s) === owner);
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 必须在这里排序(2026-11-28 修「桌面端左侧最新会话看不到」)
|
|
|
|
|
+ *
|
|
|
|
|
+ * 原因:这里用的是 sessionsSvc.all(),它返回的是存储原数组。
|
|
|
|
|
+ * 虽然大部分写入路径都会 sortSessions,但只要有一条路径没排
|
|
|
|
|
+ * (比如云端合并、本地缓存回灌),桌面端左侧顺序就会乱,
|
|
|
|
|
+ * 表现为「最新会话看不到 / 排到了很下面」。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 移动端走的是 listFor() → sessionsOf() → sortSessions(),
|
|
|
|
|
+ * 自带排序,所以两端表现不一致。用户明确要求双端重叠功能一起改,
|
|
|
|
|
+ * 这里补上,让它跟移动端同源同序。
|
|
|
|
|
+ *
|
|
|
|
|
+ * filter 之后排序是安全的:只影响展示,不改存储。
|
|
|
|
|
+ */
|
|
|
|
|
+ return sortSessions(
|
|
|
|
|
+ this.sessionsSvc.all().filter((s) => !s.archived && this.ownerOf(s) === owner),
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|