Merge branch 'disjointed-popovers' into shigusegubu-vue3

* disjointed-popovers:
  fix tests by just ignoring the html comments
  fix mentionsline extramentions lack of space
  don't show bookmark button for anon visitors
This commit is contained in:
Henry Jameson 2022-06-21 01:40:57 +03:00
commit 1ff33a78a7
4 changed files with 30 additions and 36 deletions

View file

@ -89,6 +89,9 @@ const ExtraButtons = {
canMute () {
return !!this.currentUser
},
canBookmark () {
return !!this.currentUser
},
statusLink () {
return `${this.$store.state.instance.server}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}`
}

View file

@ -51,28 +51,30 @@
icon="thumbtack"
/><span>{{ $t("status.unpin") }}</span>
</button>
<button
v-if="!status.bookmarked"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="bookmarkStatus"
@click="close"
>
<FAIcon
fixed-width
:icon="['far', 'bookmark']"
/><span>{{ $t("status.bookmark") }}</span>
</button>
<button
v-if="status.bookmarked"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="unbookmarkStatus"
@click="close"
>
<FAIcon
fixed-width
icon="bookmark"
/><span>{{ $t("status.unbookmark") }}</span>
</button>
<template v-if="canBookmark">
<button
v-if="!status.bookmarked"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="bookmarkStatus"
@click="close"
>
<FAIcon
fixed-width
:icon="['far', 'bookmark']"
/><span>{{ $t("status.bookmark") }}</span>
</button>
<button
v-if="status.bookmarked"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="unbookmarkStatus"
@click="close"
>
<FAIcon
fixed-width
icon="bookmark"
/><span>{{ $t("status.unbookmark") }}</span>
</button>
</template>
<button
v-if="canDelete"
class="button-default dropdown-item dropdown-item-icon"

View file

@ -6,7 +6,7 @@
class="mention-link"
:content="mention.content"
:url="mention.url"
/><span
/> <span
v-if="manyMentions"
class="extraMentions"
>

View file

@ -356,7 +356,6 @@ describe('RichContent', () => {
p(
'<span class="MentionsLine">',
'<span class="MentionLink mention-link">',
'<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">',
'<span>',
'https://</span>',
@ -365,10 +364,7 @@ describe('RichContent', () => {
'<span>',
'</span>',
'</a>',
'<!-- eslint-enable vue/no-v-html -->',
'<!---->', // vue placeholder
'</span>',
'<!--v-if-->', // vue placeholder, mentionsline's extra mentions and stuff
'</span>'
),
p(
@ -387,7 +383,7 @@ describe('RichContent', () => {
}
})
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
expect(wrapper.html().replace(/\n/g, '').replace(/<!--.*?-->/g, '')).to.eql(compwrap(expected))
})
it('rich contents of nested mentions are handled properly', () => {
@ -419,7 +415,6 @@ describe('RichContent', () => {
'<span class="poast-style">',
'<span class="MentionsLine">',
'<span class="MentionLink mention-link">',
'<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">',
'<span>',
'https://</span>',
@ -428,11 +423,8 @@ describe('RichContent', () => {
'<span>',
'</span>',
'</a>',
'<!-- eslint-enable vue/no-v-html -->',
'<!---->', // vue placeholder, mentionlink's "new" (i.e. rich) display
'</span>',
'<span class="MentionLink mention-link">',
'<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">',
'<span>',
'https://</span>',
@ -441,10 +433,7 @@ describe('RichContent', () => {
'<span>',
'</span>',
'</a>',
'<!-- eslint-enable vue/no-v-html -->',
'<!---->', // vue placeholder, mentionlink's "new" (i.e. rich) display
'</span>',
'<!--v-if-->', // vue placeholder, mentionsline's extra mentions and stuff
'</span>',
' ',
'</span>',
@ -462,7 +451,7 @@ describe('RichContent', () => {
}
})
expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
expect(wrapper.html().replace(/\n/g, '').replace(/<!--.*?-->/g, '')).to.eql(compwrap(expected))
})
it('rich contents of a link are handled properly', () => {