forked from FoundKeyGang/FoundKey
server: able to store remote thread IDs
This commit is contained in:
parent
46629a9884
commit
1d653fdb0b
3 changed files with 19 additions and 2 deletions
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -131,7 +131,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: `${config.url}/notes/${note.id}`,
|
id: `${config.url}/notes/${note.id}`,
|
||||||
context: `${config.url}/notes/${note.threadId}`,
|
context: note.threadId,
|
||||||
type: 'Note',
|
type: 'Note',
|
||||||
attributedTo,
|
attributedTo,
|
||||||
summary,
|
summary,
|
||||||
|
|
|
@ -509,7 +509,7 @@ async function insertNote(user: { id: User['id']; host: User['host']; }, data: O
|
||||||
replyId: data.reply ? data.reply.id : null,
|
replyId: data.reply ? data.reply.id : null,
|
||||||
renoteId: data.renote ? data.renote.id : null,
|
renoteId: data.renote ? data.renote.id : null,
|
||||||
channelId: data.channel ? data.channel.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,
|
name: data.name,
|
||||||
text: data.text,
|
text: data.text,
|
||||||
hasPoll: data.poll != null,
|
hasPoll: data.poll != null,
|
||||||
|
|
Loading…
Reference in a new issue