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
docs/site/
.vscode/
.vscode/
.yarn/

View file

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

View file

@ -10,7 +10,7 @@
<template v-slot:content="{close}">
<div class="dropdown-menu">
<button
v-if="canMute && !status.thread_muted"
v-if="canAuthAction && !status.thread_muted"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="muteConversation"
>
@ -20,7 +20,7 @@
/><span>{{ $t("status.mute_conversation") }}</span>
</button>
<button
v-if="canMute && status.thread_muted"
v-if="canAuthAction && status.thread_muted"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="unmuteConversation"
>
@ -52,7 +52,7 @@
/><span>{{ $t("status.unpin") }}</span>
</button>
<button
v-if="!status.bookmarked"
v-if="canAuthAction && !status.bookmarked"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="bookmarkStatus"
@click="close"
@ -63,7 +63,7 @@
/><span>{{ $t("status.bookmark") }}</span>
</button>
<button
v-if="status.bookmarked"
v-if="canAuthAction && status.bookmarked"
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="unbookmarkStatus"
@click="close"
@ -127,6 +127,17 @@
icon="share-alt"
/><span>{{ $t("status.copy_link") }}</span>
</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
v-if="!status.is_local"
class="button-default dropdown-item dropdown-item-icon"
@ -139,6 +150,18 @@
icon="external-link-alt"
/><span>{{ $t("status.external_source") }}</span>
</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
class="button-default dropdown-item dropdown-item-icon"
@click.prevent="reportStatus"

View file

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