fix: support archived thread search on android homepage
This commit is contained in:
@@ -44,6 +44,7 @@ export interface ConversationItem {
|
||||
folderLabel: string;
|
||||
folderKey?: string;
|
||||
threadCount?: number;
|
||||
searchAliases?: string[];
|
||||
preview: string;
|
||||
lastMessagePreview: string;
|
||||
activityIconCount: number;
|
||||
@@ -467,6 +468,19 @@ function sortConversationItems(items: ConversationItem[]) {
|
||||
});
|
||||
}
|
||||
|
||||
function buildFolderSearchAliases(items: ConversationItem[]) {
|
||||
const aliases: string[] = [];
|
||||
const seen = new Set<string>();
|
||||
for (const item of items) {
|
||||
const alias = (item.threadTitle?.trim() || item.projectTitle?.trim() || "").trim();
|
||||
if (!alias || seen.has(alias)) continue;
|
||||
aliases.push(alias);
|
||||
seen.add(alias);
|
||||
if (aliases.length >= 4) break;
|
||||
}
|
||||
return aliases.length > 0 ? aliases : undefined;
|
||||
}
|
||||
|
||||
export function getConversationItems(state: BossState): ConversationItem[] {
|
||||
const conversations = state.projects.map((project) => buildConversationItem(state, project));
|
||||
|
||||
@@ -541,6 +555,7 @@ export function getConversationHomeItems(state: BossState): ConversationItem[] {
|
||||
folderLabel: recentThreadLabel ? `${items.length} 个线程 · 最近:${recentThreadLabel}` : `${items.length} 个线程`,
|
||||
folderKey,
|
||||
threadCount: items.length,
|
||||
searchAliases: buildFolderSearchAliases(items),
|
||||
preview:
|
||||
latestItem.preview || `包含 ${items.length} 个线程,最近活跃:《${latestItem.threadTitle}》`,
|
||||
lastMessagePreview:
|
||||
|
||||
Reference in New Issue
Block a user