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 () { canMute () {
return !!this.currentUser return !!this.currentUser
}, },
canBookmark () {
return !!this.currentUser
},
statusLink () { statusLink () {
return `${this.$store.state.instance.server}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}` 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" icon="thumbtack"
/><span>{{ $t("status.unpin") }}</span> /><span>{{ $t("status.unpin") }}</span>
</button> </button>
<button <template v-if="canBookmark">
v-if="!status.bookmarked" <button
class="button-default dropdown-item dropdown-item-icon" v-if="!status.bookmarked"
@click.prevent="bookmarkStatus" class="button-default dropdown-item dropdown-item-icon"
@click="close" @click.prevent="bookmarkStatus"
> @click="close"
<FAIcon >
fixed-width <FAIcon
:icon="['far', 'bookmark']" fixed-width
/><span>{{ $t("status.bookmark") }}</span> :icon="['far', 'bookmark']"
</button> /><span>{{ $t("status.bookmark") }}</span>
<button </button>
v-if="status.bookmarked" <button
class="button-default dropdown-item dropdown-item-icon" v-if="status.bookmarked"
@click.prevent="unbookmarkStatus" class="button-default dropdown-item dropdown-item-icon"
@click="close" @click.prevent="unbookmarkStatus"
> @click="close"
<FAIcon >
fixed-width <FAIcon
icon="bookmark" fixed-width
/><span>{{ $t("status.unbookmark") }}</span> icon="bookmark"
</button> /><span>{{ $t("status.unbookmark") }}</span>
</button>
</template>
<button <button
v-if="canDelete" v-if="canDelete"
class="button-default dropdown-item dropdown-item-icon" class="button-default dropdown-item dropdown-item-icon"

View file

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

View file

@ -356,7 +356,6 @@ describe('RichContent', () => {
p( p(
'<span class="MentionsLine">', '<span class="MentionsLine">',
'<span class="MentionLink mention-link">', '<span class="MentionLink mention-link">',
'<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">', '<a href="lol" class="original" target="_blank">',
'<span>', '<span>',
'https://</span>', 'https://</span>',
@ -365,10 +364,7 @@ describe('RichContent', () => {
'<span>', '<span>',
'</span>', '</span>',
'</a>', '</a>',
'<!-- eslint-enable vue/no-v-html -->',
'<!---->', // vue placeholder
'</span>', '</span>',
'<!--v-if-->', // vue placeholder, mentionsline's extra mentions and stuff
'</span>' '</span>'
), ),
p( 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', () => { it('rich contents of nested mentions are handled properly', () => {
@ -419,7 +415,6 @@ describe('RichContent', () => {
'<span class="poast-style">', '<span class="poast-style">',
'<span class="MentionsLine">', '<span class="MentionsLine">',
'<span class="MentionLink mention-link">', '<span class="MentionLink mention-link">',
'<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">', '<a href="lol" class="original" target="_blank">',
'<span>', '<span>',
'https://</span>', 'https://</span>',
@ -428,11 +423,8 @@ describe('RichContent', () => {
'<span>', '<span>',
'</span>', '</span>',
'</a>', '</a>',
'<!-- eslint-enable vue/no-v-html -->',
'<!---->', // vue placeholder, mentionlink's "new" (i.e. rich) display
'</span>', '</span>',
'<span class="MentionLink mention-link">', '<span class="MentionLink mention-link">',
'<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">', '<a href="lol" class="original" target="_blank">',
'<span>', '<span>',
'https://</span>', 'https://</span>',
@ -441,10 +433,7 @@ describe('RichContent', () => {
'<span>', '<span>',
'</span>', '</span>',
'</a>', '</a>',
'<!-- eslint-enable vue/no-v-html -->',
'<!---->', // vue placeholder, mentionlink's "new" (i.e. rich) display
'</span>', '</span>',
'<!--v-if-->', // vue placeholder, mentionsline's extra mentions and stuff
'</span>', '</span>',
' ', ' ',
'</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', () => { it('rich contents of a link are handled properly', () => {