Skip to content
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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.

## 0.0.9

### The People screen keeps a person's last sign-in when their sessions go away

`Last signed in` was `max(sessions.created_at)`, so it disappeared whenever the session rows behind
it did: on sign-out, on expiry, and when an administrator removed somebody. Restoring them did not
bring it back, and the person moved to the bottom of the list as somebody who had never signed in.
The moment of each sign-in is now recorded on the person, so the answer survives all three, and a
removed person's row shows when they were last here instead of leaving it out. Existing deployments
are backfilled from whatever sessions they still hold.

### A message can carry files

Pick them, drag them onto the composer or paste them in: up to eight files on one message, images up
Expand Down
3 changes: 2 additions & 1 deletion app/src/routes/_authed/admin/people.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ function describe(person: Person): string {
? `last signed in ${new Date(person.lastSignedInAt).toLocaleDateString()}`
: "never signed in";

if (person.revoked) return `Access removed · ${providers || "no provider"}`;
if (person.revoked)
return `Access removed · ${providers || "no provider"} · ${when}`;
if (person.configuredAdmin) {
return `Administrator by configuration · ${when}`;
}
Expand Down
1 change: 1 addition & 0 deletions server/drizzle/0034_last_signed_in_at.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "users" ADD COLUMN "last_signed_in_at" timestamp with time zone;
9 changes: 9 additions & 0 deletions server/drizzle/0035_backfill_last_signed_in_at.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
UPDATE "users" AS u
SET "last_signed_in_at" = s."last_created"
FROM (
SELECT "user_id", max("created_at") AS "last_created"
FROM "sessions"
GROUP BY "user_id"
) AS s
WHERE s."user_id" = u."id"
AND u."last_signed_in_at" IS NULL;
Loading