Add fediLink buttons with circle-nodes icon

This commit is contained in:
smitten 2023-07-25 21:33:40 -04:00
parent af97dd7484
commit 2cd1cd422c
4 changed files with 43 additions and 7 deletions

3
.gitignore vendored
View file

@ -9,4 +9,5 @@ selenium-debug.log
config/local.json config/local.json
config/local.*.json config/local.*.json
docs/site/ docs/site/
.vscode/ .vscode/
.yarn/

View file

@ -9,7 +9,8 @@ import {
faShareAlt, faShareAlt,
faExternalLinkAlt, faExternalLinkAlt,
faHistory, faHistory,
faFilePen faFilePen,
faCircleNodes
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
import { import {
faBookmark as faBookmarkReg, faBookmark as faBookmarkReg,
@ -25,6 +26,7 @@ library.add(
faThumbtack, faThumbtack,
faShareAlt, faShareAlt,
faExternalLinkAlt, faExternalLinkAlt,
faCircleNodes,
faFlag, faFlag,
faHistory, faHistory,
faFilePen faFilePen
@ -95,6 +97,11 @@ const ExtraButtons = {
.then(() => this.$emit('onSuccess')) .then(() => this.$emit('onSuccess'))
.catch(err => this.$emit('onError', err.error.error)) .catch(err => this.$emit('onError', err.error.error))
}, },
copyFediLink () {
navigator.clipboard.writeText(this.fediLink)
.then(() => this.$emit('onSuccess'))
.catch(err => this.$emit('onError', err.error.error))
},
bookmarkStatus () { bookmarkStatus () {
this.$store.dispatch('bookmark', { id: this.status.id }) this.$store.dispatch('bookmark', { id: this.status.id })
.then(() => this.$emit('onSuccess')) .then(() => this.$emit('onSuccess'))
@ -170,7 +177,7 @@ const ExtraButtons = {
canPin () { canPin () {
return this.ownStatus && (this.status.visibility === 'public' || this.status.visibility === 'unlisted') return this.ownStatus && (this.status.visibility === 'public' || this.status.visibility === 'unlisted')
}, },
canMute () { canAuthAction () {
return !!this.currentUser return !!this.currentUser
}, },
canTranslate () { canTranslate () {
@ -186,6 +193,9 @@ const ExtraButtons = {
return this.status.external_url return this.status.external_url
} }
}, },
fediLink () {
return this.statusLink.replace(/^https/, 'web+ap')
},
shouldConfirmDelete () { shouldConfirmDelete () {
return this.$store.getters.mergedConfig.modalOnDelete return this.$store.getters.mergedConfig.modalOnDelete
}, },

View file

@ -10,7 +10,7 @@
<template v-slot:content="{close}"> <template v-slot:content="{close}">
<div class="dropdown-menu"> <div class="dropdown-menu">
<button <button
v-if="canMute && !status.thread_muted" v-if="canAuthAction && !status.thread_muted"
class="button-default dropdown-item dropdown-item-icon" class="button-default dropdown-item dropdown-item-icon"
@click.prevent="muteConversation" @click.prevent="muteConversation"
> >
@ -20,7 +20,7 @@
/><span>{{ $t("status.mute_conversation") }}</span> /><span>{{ $t("status.mute_conversation") }}</span>
</button> </button>
<button <button
v-if="canMute && status.thread_muted" v-if="canAuthAction && status.thread_muted"
class="button-default dropdown-item dropdown-item-icon" class="button-default dropdown-item dropdown-item-icon"
@click.prevent="unmuteConversation" @click.prevent="unmuteConversation"
> >
@ -52,7 +52,7 @@
/><span>{{ $t("status.unpin") }}</span> /><span>{{ $t("status.unpin") }}</span>
</button> </button>
<button <button
v-if="!status.bookmarked" v-if="canAuthAction && !status.bookmarked"
class="button-default dropdown-item dropdown-item-icon" class="button-default dropdown-item dropdown-item-icon"
@click.prevent="bookmarkStatus" @click.prevent="bookmarkStatus"
@click="close" @click="close"
@ -63,7 +63,7 @@
/><span>{{ $t("status.bookmark") }}</span> /><span>{{ $t("status.bookmark") }}</span>
</button> </button>
<button <button
v-if="status.bookmarked" v-if="canAuthAction && status.bookmarked"
class="button-default dropdown-item dropdown-item-icon" class="button-default dropdown-item dropdown-item-icon"
@click.prevent="unbookmarkStatus" @click.prevent="unbookmarkStatus"
@click="close" @click="close"
@ -127,6 +127,17 @@
icon="share-alt" icon="share-alt"
/><span>{{ $t("status.copy_link") }}</span> /><span>{{ $t("status.copy_link") }}</span>
</button> </button>
<button
v-if="canAuthAction"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="copyFediLink"
@click="close"
>
<FAIcon
fixed-width
icon="circle-nodes"
/><span>{{ $t("status.copy_fedi_link") }}</span>
</button>
<a <a
v-if="!status.is_local" v-if="!status.is_local"
class="button-default dropdown-item dropdown-item-icon" class="button-default dropdown-item dropdown-item-icon"
@ -139,6 +150,18 @@
icon="external-link-alt" icon="external-link-alt"
/><span>{{ $t("status.external_source") }}</span> /><span>{{ $t("status.external_source") }}</span>
</a> </a>
<a
v-if="!canAuthAction"
class="button-default dropdown-item dropdown-item-icon"
title="Source"
:href="fediLink"
target="_blank"
>
<FAIcon
fixed-width
icon="circle-nodes"
/><span>{{ $t("status.open_fedi_link") }}</span>
</a>
<button <button
class="button-default dropdown-item dropdown-item-icon" class="button-default dropdown-item dropdown-item-icon"
@click.prevent="reportStatus" @click.prevent="reportStatus"

View file

@ -961,6 +961,7 @@
"bookmark": "Bookmark", "bookmark": "Bookmark",
"collapse_attachments": "Collapse attachments", "collapse_attachments": "Collapse attachments",
"copy_link": "Copy link to post", "copy_link": "Copy link to post",
"copy_fedi_link": "Copy fedi link",
"delete": "Delete post", "delete": "Delete post",
"delete_confirm": "Do you really want to delete this post?", "delete_confirm": "Do you really want to delete this post?",
"delete_confirm_accept_button": "Yes, delete it", "delete_confirm_accept_button": "Yes, delete it",
@ -972,6 +973,7 @@
"edited_at": "Edited {time}", "edited_at": "Edited {time}",
"expand": "Expand", "expand": "Expand",
"external_source": "External source", "external_source": "External source",
"open_fedi_link": "Open fedi link",
"favorites": "Favorites", "favorites": "Favorites",
"hide_attachment": "Hide attachment", "hide_attachment": "Hide attachment",
"hide_content": "Hide content", "hide_content": "Hide content",