Do not show duplicate url-preview (#3259)
This commit is contained in:
parent
39285fc2d0
commit
d2385a0e52
|
@ -1,5 +1,5 @@
|
||||||
import parse from '../../../../mfm/parse';
|
import parse from '../../../../mfm/parse';
|
||||||
import { sum } from '../../../../prelude/array';
|
import { sum, unique } from '../../../../prelude/array';
|
||||||
import shouldMuteNote from './should-mute-note';
|
import shouldMuteNote from './should-mute-note';
|
||||||
import MkNoteMenu from '../views/components/note-menu.vue';
|
import MkNoteMenu from '../views/components/note-menu.vue';
|
||||||
import MkReactionPicker from '../views/components/reaction-picker.vue';
|
import MkReactionPicker from '../views/components/reaction-picker.vue';
|
||||||
|
@ -78,9 +78,9 @@ export default (opts: Opts = {}) => ({
|
||||||
urls(): string[] {
|
urls(): string[] {
|
||||||
if (this.appearNote.text) {
|
if (this.appearNote.text) {
|
||||||
const ast = parse(this.appearNote.text);
|
const ast = parse(this.appearNote.text);
|
||||||
return ast
|
return unique(ast
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => t.url);
|
.map(t => t.url));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import i18n from '../../../i18n';
|
import i18n from '../../../i18n';
|
||||||
import parse from '../../../../../mfm/parse';
|
import parse from '../../../../../mfm/parse';
|
||||||
|
import { unique } from '../../../../../prelude/array';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
i18n: i18n('common/views/components/messaging-room.message.vue'),
|
i18n: i18n('common/views/components/messaging-room.message.vue'),
|
||||||
|
@ -49,9 +50,9 @@ export default Vue.extend({
|
||||||
urls(): string[] {
|
urls(): string[] {
|
||||||
if (this.message.text) {
|
if (this.message.text) {
|
||||||
const ast = parse(this.message.text);
|
const ast = parse(this.message.text);
|
||||||
return ast
|
return unique(ast
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => t.url);
|
.map(t => t.url));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ import MkRenoteFormWindow from './renote-form-window.vue';
|
||||||
import MkNoteMenu from '../../../common/views/components/note-menu.vue';
|
import MkNoteMenu from '../../../common/views/components/note-menu.vue';
|
||||||
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
||||||
import XSub from './note.sub.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';
|
import noteSubscriber from '../../../common/scripts/note-subscriber';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -149,9 +149,9 @@ export default Vue.extend({
|
||||||
urls(): string[] {
|
urls(): string[] {
|
||||||
if (this.p.text) {
|
if (this.p.text) {
|
||||||
const ast = parse(this.p.text);
|
const ast = parse(this.p.text);
|
||||||
return ast
|
return unique(ast
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => t.url);
|
.map(t => t.url));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ import parse from '../../../../../mfm/parse';
|
||||||
import MkNoteMenu from '../../../common/views/components/note-menu.vue';
|
import MkNoteMenu from '../../../common/views/components/note-menu.vue';
|
||||||
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
||||||
import XSub from './note.sub.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';
|
import noteSubscriber from '../../../common/scripts/note-subscriber';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -143,9 +143,9 @@ export default Vue.extend({
|
||||||
urls(): string[] {
|
urls(): string[] {
|
||||||
if (this.p.text) {
|
if (this.p.text) {
|
||||||
const ast = parse(this.p.text);
|
const ast = parse(this.p.text);
|
||||||
return ast
|
return unique(ast
|
||||||
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
.filter(t => (t.type == 'url' || t.type == 'link') && !t.silent)
|
||||||
.map(t => t.url);
|
.map(t => t.url));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue