server: able to store remote thread IDs

This commit is contained in:
Johann150 2022-10-31 12:08:55 +01:00
parent 46629a9884
commit 1d653fdb0b
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
3 changed files with 19 additions and 2 deletions

View file

@ -0,0 +1,17 @@
import config from '../built/config/index.js';
export class remoteThreadIds1667212446191 {
name = 'remoteThreadIds1667212446191';
async up(queryRunner) {
await Promise.all([
queryRunner.query(`UPDATE "note" SET "threadId" = '${config.url}/notes/' + "threadId"`),
queryRunner.query(`UPDATE "note_thread_muting" SET "threadId" = '${config.url}/notes/' + "threadId"`),
]);
}
async down() {
// cannot be undone:
// after this migration other instances threadIds may be stored in the database
}
}

View file

@ -131,7 +131,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
return {
id: `${config.url}/notes/${note.id}`,
context: `${config.url}/notes/${note.threadId}`,
context: note.threadId,
type: 'Note',
attributedTo,
summary,

View file

@ -509,7 +509,7 @@ async function insertNote(user: { id: User['id']; host: User['host']; }, data: O
replyId: data.reply ? data.reply.id : null,
renoteId: data.renote ? data.renote.id : null,
channelId: data.channel ? data.channel.id : null,
threadId: data.reply?.threadId ?? id,
threadId: data.reply?.threadId ?? `${config.url}/notes/${id}`,
name: data.name,
text: data.text,
hasPoll: data.poll != null,