refactor(federation): Make references always have domains
Some checks failed
CodeQL Scan / Analyze (push) Failing after 0s
Deploy Docs to GitHub Pages / build (push) Failing after 0s
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Nix Build / check (push) Failing after 0s
Test Publish / build (client) (push) Failing after 0s
Test Publish / build (sdk) (push) Failing after 0s
Build Docker Images / lint (push) Has been cancelled
Build Docker Images / check (push) Has been cancelled
Build Docker Images / tests (push) Has been cancelled
Build Docker Images / detect-circular (push) Has been cancelled
Mirror to Codeberg / Mirror (push) Has been cancelled
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been cancelled
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been cancelled

This commit is contained in:
Jesse Wierzbinski 2026-04-03 13:34:19 +02:00
parent df2a5ce260
commit 709e1c6087
No known key found for this signature in database
22 changed files with 688 additions and 477 deletions

View file

@ -26,7 +26,9 @@ import type { User } from "./user.ts";
type ReactionType = InferSelectModel<typeof Reactions> & {
emoji: typeof Emoji.$type | null;
author: InferSelectModel<typeof Users>;
author: InferSelectModel<typeof Users> & {
instance: InferSelectModel<typeof Instances> | null;
};
note: InferSelectModel<typeof Notes> & {
author: InferSelectModel<typeof Users> & {
instance: InferSelectModel<typeof Instances> | null;
@ -72,7 +74,11 @@ export class Reaction extends BaseInterface<typeof Reactions, ReactionType> {
media: true,
},
},
author: true,
author: {
with: {
instance: true,
},
},
note: {
with: {
author: {
@ -112,7 +118,11 @@ export class Reaction extends BaseInterface<typeof Reactions, ReactionType> {
media: true,
},
},
author: true,
author: {
with: {
instance: true,
},
},
note: {
with: {
author: {
@ -245,37 +255,43 @@ export class Reaction extends BaseInterface<typeof Reactions, ReactionType> {
noteReference = `${this.data.note.author.instance.domain}:${this.data.note.remoteId}`;
}
return new VersiaEntities.Reaction({
type: "pub.versia:reactions/Reaction",
author: this.data.author.id,
created_at: this.data.createdAt.toISOString(),
id: this.id,
object: noteReference,
content: this.hasCustomEmoji()
? `:${this.data.emoji?.shortcode}:`
: this.data.emojiText || "",
extensions: this.hasCustomEmoji()
? {
"pub.versia:custom_emojis": {
emojis: [
new Emoji(
this.data.emoji as typeof Emoji.$type,
).toVersia(),
],
},
}
: undefined,
});
return new VersiaEntities.Reaction(
{
type: "pub.versia:reactions/Reaction",
author: this.data.author.id,
created_at: this.data.createdAt.toISOString(),
id: this.id,
object: noteReference,
content: this.hasCustomEmoji()
? `:${this.data.emoji?.shortcode}:`
: this.data.emojiText || "",
extensions: this.hasCustomEmoji()
? {
"pub.versia:custom_emojis": {
emojis: [
new Emoji(
this.data.emoji as typeof Emoji.$type,
).toVersia(),
],
},
}
: undefined,
},
this.data.author.instance?.domain ?? config.http.base_url.hostname,
);
}
public toVersiaUnreact(): VersiaEntities.Delete {
return new VersiaEntities.Delete({
type: "Delete",
created_at: new Date().toISOString(),
author: this.data.authorId,
deleted_type: "pub.versia:reactions/Reaction",
deleted: this.id,
});
return new VersiaEntities.Delete(
{
type: "Delete",
created_at: new Date().toISOString(),
author: this.data.authorId,
deleted_type: "pub.versia:reactions/Reaction",
deleted: this.id,
},
this.data.author.instance?.domain ?? config.http.base_url.hostname,
);
}
public static async fromVersia(