chore: scope session sorting to tui
This commit is contained in:
@@ -944,8 +944,6 @@ export function createServerSession(
|
||||
}
|
||||
|
||||
const info = data.info[sessionID]
|
||||
if (event.type === "session.input.admitted" && info)
|
||||
remember({ ...info, time: { ...info.time, updated: event.created } })
|
||||
if (event.type === "session.renamed" && info)
|
||||
remember({ ...info, title: event.data.title, time: { ...info.time, updated: event.created } })
|
||||
if (event.type === "session.moved" && info)
|
||||
|
||||
@@ -153,31 +153,6 @@ describe("layout workspace helpers", () => {
|
||||
expect(result?.id).toBe("workspace")
|
||||
})
|
||||
|
||||
test("finds the most recently updated session while sessions are active", () => {
|
||||
const result = latestRootSession(
|
||||
[
|
||||
{
|
||||
path: { directory: "/workspace" },
|
||||
session: [
|
||||
session({
|
||||
id: "a",
|
||||
directory: "/workspace",
|
||||
time: { created: 110_000, updated: 100_000, archived: undefined },
|
||||
}),
|
||||
session({
|
||||
id: "z",
|
||||
directory: "/workspace",
|
||||
time: { created: 90_000, updated: 110_000, archived: undefined },
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
120_000,
|
||||
)
|
||||
|
||||
expect(result?.id).toBe("z")
|
||||
})
|
||||
|
||||
test("detects project permissions with a filter", () => {
|
||||
const result = hasProjectPermissions(
|
||||
{
|
||||
|
||||
@@ -16,8 +16,7 @@ function sortSessions(now: number) {
|
||||
const bUpdated = b.time.updated ?? b.time.created
|
||||
const aRecent = aUpdated > oneMinuteAgo
|
||||
const bRecent = bUpdated > oneMinuteAgo
|
||||
if (aRecent && bRecent)
|
||||
return bUpdated - aUpdated || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)
|
||||
if (aRecent && bRecent) return a.id < b.id ? -1 : a.id > b.id ? 1 : 0
|
||||
if (aRecent && !bRecent) return -1
|
||||
if (!aRecent && bRecent) return 1
|
||||
return bUpdated - aUpdated
|
||||
|
||||
Reference in New Issue
Block a user