refactor: 🔥 Remove _misskey_content and _misskey_quote
Should improve federation performance by removing duplicate content BREAKING: Breaks MFM content and quote compatibility with Misskey before v12/v11(?)
This commit is contained in:
parent
c119abc36c
commit
a67fb5dc7a
4 changed files with 2 additions and 12 deletions
|
@ -247,7 +247,7 @@ export async function createNote(
|
||||||
// Quote
|
// Quote
|
||||||
let quote: Note | undefined | null;
|
let quote: Note | undefined | null;
|
||||||
|
|
||||||
if (note._misskey_quote || note.quoteUrl || note.quoteUri) {
|
if (note.quoteUrl || note.quoteUri) {
|
||||||
const tryResolveNote = async (
|
const tryResolveNote = async (
|
||||||
uri: string,
|
uri: string,
|
||||||
): Promise<
|
): Promise<
|
||||||
|
@ -284,7 +284,7 @@ export async function createNote(
|
||||||
};
|
};
|
||||||
|
|
||||||
const uris = unique(
|
const uris = unique(
|
||||||
[note._misskey_quote, note.quoteUrl, note.quoteUri].filter(
|
[note.quoteUrl, note.quoteUri].filter(
|
||||||
(x): x is string => typeof x === "string",
|
(x): x is string => typeof x === "string",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -310,8 +310,6 @@ export async function createNote(
|
||||||
typeof note.source?.content === "string"
|
typeof note.source?.content === "string"
|
||||||
) {
|
) {
|
||||||
text = note.source.content;
|
text = note.source.content;
|
||||||
} else if (typeof note._misskey_content !== "undefined") {
|
|
||||||
text = note._misskey_content;
|
|
||||||
} else if (typeof note.content === "string") {
|
} else if (typeof note.content === "string") {
|
||||||
text = htmlToMfm(note.content, note.tag);
|
text = htmlToMfm(note.content, note.tag);
|
||||||
}
|
}
|
||||||
|
@ -572,8 +570,6 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
||||||
typeof post.source?.content === "string"
|
typeof post.source?.content === "string"
|
||||||
) {
|
) {
|
||||||
text = post.source.content;
|
text = post.source.content;
|
||||||
} else if (typeof post._misskey_content !== "undefined") {
|
|
||||||
text = post._misskey_content;
|
|
||||||
} else if (typeof post.content === "string") {
|
} else if (typeof post.content === "string") {
|
||||||
text = htmlToMfm(post.content, post.tag);
|
text = htmlToMfm(post.content, post.tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,6 @@ export const renderActivity = (x: any): IActivity | null => {
|
||||||
value: "schema:value",
|
value: "schema:value",
|
||||||
// Misskey
|
// Misskey
|
||||||
misskey: "https://misskey-hub.net/ns#",
|
misskey: "https://misskey-hub.net/ns#",
|
||||||
_misskey_content: "misskey:_misskey_content",
|
|
||||||
_misskey_quote: "misskey:_misskey_quote",
|
|
||||||
_misskey_reaction: "misskey:_misskey_reaction",
|
_misskey_reaction: "misskey:_misskey_reaction",
|
||||||
_misskey_votes: "misskey:_misskey_votes",
|
_misskey_votes: "misskey:_misskey_votes",
|
||||||
_misskey_talk: "misskey:_misskey_talk",
|
_misskey_talk: "misskey:_misskey_talk",
|
||||||
|
|
|
@ -152,12 +152,10 @@ export default async function renderNote(
|
||||||
attributedTo,
|
attributedTo,
|
||||||
summary,
|
summary,
|
||||||
content,
|
content,
|
||||||
_misskey_content: text,
|
|
||||||
source: {
|
source: {
|
||||||
content: text,
|
content: text,
|
||||||
mediaType: "text/x.misskeymarkdown",
|
mediaType: "text/x.misskeymarkdown",
|
||||||
},
|
},
|
||||||
_misskey_quote: quote,
|
|
||||||
quoteUri: quote,
|
quoteUri: quote,
|
||||||
quoteUrl: quote,
|
quoteUrl: quote,
|
||||||
published: note.createdAt.toISOString(),
|
published: note.createdAt.toISOString(),
|
||||||
|
|
|
@ -134,7 +134,6 @@ export interface IPost extends IObject {
|
||||||
content: string;
|
content: string;
|
||||||
mediaType: string;
|
mediaType: string;
|
||||||
};
|
};
|
||||||
_misskey_quote?: string;
|
|
||||||
quoteUrl?: string;
|
quoteUrl?: string;
|
||||||
quoteUri?: string;
|
quoteUri?: string;
|
||||||
_misskey_talk: boolean;
|
_misskey_talk: boolean;
|
||||||
|
@ -146,7 +145,6 @@ export interface IQuestion extends IObject {
|
||||||
content: string;
|
content: string;
|
||||||
mediaType: string;
|
mediaType: string;
|
||||||
};
|
};
|
||||||
_misskey_quote?: string;
|
|
||||||
quoteUrl?: string;
|
quoteUrl?: string;
|
||||||
oneOf?: IQuestionChoice[];
|
oneOf?: IQuestionChoice[];
|
||||||
anyOf?: IQuestionChoice[];
|
anyOf?: IQuestionChoice[];
|
||||||
|
|
Loading…
Reference in a new issue