Do not show duplicate url-preview (#3259)

This commit is contained in:
MeiMei 2018-11-16 16:35:13 +09:00 committed by syuilo
parent 39285fc2d0
commit d2385a0e52
4 changed files with 12 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import parse from '../../../../mfm/parse';
import { sum } from '../../../../prelude/array';
import { sum, unique } from '../../../../prelude/array';
import shouldMuteNote from './should-mute-note';
import MkNoteMenu from '../views/components/note-menu.vue';
import MkReactionPicker from '../views/components/reaction-picker.vue';
@ -78,9 +78,9 @@ export default (opts: Opts = {}) => ({
urls(): string[] {
if (this.appearNote.text) {
const ast = parse(this.appearNote.text);
return ast
return unique(ast
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.map(t => t.url);
.map(t => t.url));
} else {
return null;
}

View File

@ -34,6 +34,7 @@
import Vue from 'vue';
import i18n from '../../../i18n';
import parse from '../../../../../mfm/parse';
import { unique } from '../../../../../prelude/array';
export default Vue.extend({
i18n: i18n('common/views/components/messaging-room.message.vue'),
@ -49,9 +50,9 @@ export default Vue.extend({
urls(): string[] {
if (this.message.text) {
const ast = parse(this.message.text);
return ast
return unique(ast
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.map(t => t.url);
.map(t => t.url));
} else {
return null;
}

View File

@ -94,7 +94,7 @@ import MkRenoteFormWindow from './renote-form-window.vue';
import MkNoteMenu from '../../../common/views/components/note-menu.vue';
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
import XSub from './note.sub.vue';
import { sum } from '../../../../../prelude/array';
import { sum, unique } from '../../../../../prelude/array';
import noteSubscriber from '../../../common/scripts/note-subscriber';
export default Vue.extend({
@ -149,9 +149,9 @@ export default Vue.extend({
urls(): string[] {
if (this.p.text) {
const ast = parse(this.p.text);
return ast
return unique(ast
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.map(t => t.url);
.map(t => t.url));
} else {
return null;
}

View File

@ -92,7 +92,7 @@ import parse from '../../../../../mfm/parse';
import MkNoteMenu from '../../../common/views/components/note-menu.vue';
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
import XSub from './note.sub.vue';
import { sum } from '../../../../../prelude/array';
import { sum, unique } from '../../../../../prelude/array';
import noteSubscriber from '../../../common/scripts/note-subscriber';
export default Vue.extend({
@ -143,9 +143,9 @@ export default Vue.extend({
urls(): string[] {
if (this.p.text) {
const ast = parse(this.p.text);
return ast
return unique(ast
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
.map(t => t.url);
.map(t => t.url));
} else {
return null;
}