mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-08 22:23:08 +02:00
parent
331305e6c7
commit
356225af14
7 changed files with 33 additions and 8 deletions
15
migration/1585772678853-ap-url.ts
Normal file
15
migration/1585772678853-ap-url.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* tslint:disable:quotemark class-name indent */
|
||||
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||
|
||||
export class apUrl1585772678853 implements MigrationInterface {
|
||||
name = 'apUrl1585772678853'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE "note" ADD "url" character varying(512)`, undefined);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<any> {
|
||||
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "url"`, undefined);
|
||||
}
|
||||
|
||||
}
|
|
@ -517,11 +517,11 @@ export default Vue.extend({
|
|||
icon: faLink,
|
||||
text: this.$t('copyLink'),
|
||||
action: this.copyLink
|
||||
}, this.appearNote.uri ? {
|
||||
}, (this.appearNote.url || this.appearNote.uri) ? {
|
||||
icon: faExternalLinkSquareAlt,
|
||||
text: this.$t('showOnRemote'),
|
||||
action: () => {
|
||||
window.open(this.appearNote.uri, '_blank');
|
||||
window.open(this.appearNote.url || this.appearNote.uri, '_blank');
|
||||
}
|
||||
} : undefined,
|
||||
null,
|
||||
|
@ -585,11 +585,11 @@ export default Vue.extend({
|
|||
icon: faLink,
|
||||
text: this.$t('copyLink'),
|
||||
action: this.copyLink
|
||||
}, this.appearNote.uri ? {
|
||||
}, (this.appearNote.url || this.appearNote.uri) ? {
|
||||
icon: faExternalLinkSquareAlt,
|
||||
text: this.$t('showOnRemote'),
|
||||
action: () => {
|
||||
window.open(this.appearNote.uri, '_blank');
|
||||
window.open(this.appearNote.url || this.appearNote.uri, '_blank');
|
||||
}
|
||||
} : undefined]
|
||||
.filter(x => x !== undefined);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<x-notes v-if="showNext" ref="next" :pagination="next"/>
|
||||
<hr v-if="showNext"/>
|
||||
|
||||
<mk-remote-caution v-if="note.user.host != null" :href="note.uri" style="margin-bottom: var(--margin)"/>
|
||||
<mk-remote-caution v-if="note.user.host != null" :href="note.url || note.uri" style="margin-bottom: var(--margin)"/>
|
||||
<x-note :note="note" :key="note.id" :detail="true"/>
|
||||
<div v-if="error">
|
||||
<mk-error @retry="fetch()"/>
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -280,7 +280,8 @@ export async function createNote(value: string | IObject, resolver?: Resolver, s
|
|||
apHashtags,
|
||||
apEmojis,
|
||||
poll,
|
||||
uri: note.id
|
||||
uri: note.id,
|
||||
url: note.url,
|
||||
}, silent);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ type Option = {
|
|||
apHashtags?: string[] | null;
|
||||
apEmojis?: string[] | null;
|
||||
uri?: string | null;
|
||||
url?: string | null;
|
||||
app?: App | null;
|
||||
};
|
||||
|
||||
|
@ -407,6 +408,7 @@ async function insertNote(user: User, data: Option, tags: string[], emojis: stri
|
|||
});
|
||||
|
||||
if (data.uri != null) insert.uri = data.uri;
|
||||
if (data.url != null) insert.url = data.url;
|
||||
|
||||
// Append mentions data
|
||||
if (mentionedUsers.length > 0) {
|
||||
|
|
Loading…
Reference in a new issue