Use url if available (#6214)

* Fix #6213

* other link

* fix
This commit is contained in:
MeiMei
2020-04-02 21:59:14 +09:00
committed by GitHub
parent 331305e6c7
commit 356225af14
7 changed files with 33 additions and 8 deletions

View File

@ -112,6 +112,12 @@ export class Note {
})
public uri: string | null;
@Column('varchar', {
length: 512, nullable: true,
comment: 'The human readable url of a note. it will be null when the note is local.'
})
public url: string | null;
@Column('integer', {
default: 0, select: false
})

View File

@ -171,8 +171,8 @@ export class NoteRepository extends Repository<Note> {
let text = note.text;
if (note.name && note.uri) {
text = `${note.name}\n${(note.text || '').trim()}\n${note.uri}`;
if (note.name && (note.url || note.uri)) {
text = `${note.name}\n${(note.text || '').trim()}\n\n${note.url || note.uri}`;
}
const packed = await awaitAll({
@ -197,6 +197,7 @@ export class NoteRepository extends Repository<Note> {
renoteId: note.renoteId,
mentions: note.mentions.length > 0 ? note.mentions : undefined,
uri: note.uri || undefined,
url: note.url || undefined,
_featuredId_: (note as any)._featuredId_ || undefined,
_prId_: (note as any)._prId_ || undefined,