feat: show source-qualified author names

This commit is contained in:
2026-07-19 13:35:20 +08:00
parent 3a20defcc3
commit d512443d00
4 changed files with 37 additions and 1 deletions
+15
View File
@@ -0,0 +1,15 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { postAuthorLabel } from "../lib/display";
test("formats Memos authors as name at source hostname", () => {
assert.equal(postAuthorLabel({ origin: "memos", username: "hub-user", name: "codex", remote_display_name: "codex", source_base_url: "https://memos.fishking.studio/path" }), "@codex@memos.fishking.studio");
});
test("formats Hub posts linked to Memos with the same source identity", () => {
assert.equal(postAuthorLabel({ origin: "hub", username: "codex", name: "codex", remote_display_name: "codex", source_base_url: "https://memos.fishking.studio" }), "@codex@memos.fishking.studio");
});
test("keeps the existing label for non-Memos posts", () => {
assert.equal(postAuthorLabel({ origin: "hub", username: "codex", name: "Hub", source_base_url: null }), "@Hub · Hub");
});