refactor: stop pinning hardcoded main session in chat UI

This commit is contained in:
Peter Steinberger
2026-01-09 23:20:55 +01:00
parent 3b91148a0a
commit 870c9f0b99
2 changed files with 6 additions and 10 deletions

View File

@@ -58,6 +58,7 @@
- Cron: parse Telegram topic targets for isolated delivery. (#478) — thanks @nachoiacovino
- Cron: enqueue main-session system events under the resolved main session key. (#510)
- Mobile: centralize main session key normalization for iOS/Android runtime helpers. — thanks @steipete
- Chat UI: stop pinning hardcoded `main` session in the recent list; prefer active session if missing. — thanks @steipete
- Outbound: default Telegram account selection for config-only tokens; remove heartbeat-specific accountId handling. (follow-up #516) — thanks @YuriNachos
- Cron: allow Telegram delivery targets with topic/thread IDs (e.g. `-100…:topic:123`). (#474) — thanks @mitschabaude-bot
- Heartbeat: resolve Telegram account IDs from config-only tokens; cron tool accepts canonical `jobId` and legacy `id` for job actions. (#516) — thanks @YuriNachos

View File

@@ -112,24 +112,19 @@ public final class ClawdbotChatViewModel {
recent.append(entry)
}
let mainKey = "main"
var result: [ClawdbotChatSessionEntry] = []
var included = Set<String>()
if let main = sorted.first(where: { $0.key == mainKey }) {
result.append(main)
included.insert(mainKey)
} else if self.sessionKey == mainKey {
result.append(self.placeholderSession(key: mainKey))
included.insert(mainKey)
}
for entry in recent where !included.contains(entry.key) {
result.append(entry)
included.insert(entry.key)
}
if !included.contains(self.sessionKey) {
result.append(self.placeholderSession(key: self.sessionKey))
if let current = sorted.first(where: { $0.key == self.sessionKey }) {
result.append(current)
} else {
result.append(self.placeholderSession(key: self.sessionKey))
}
}
return result