feat: support muting conversations (#614)

This commit is contained in:
Daniel Roe 2022-12-28 22:44:23 +01:00 committed by GitHub
parent b6f0bd356a
commit f65f9c9a1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 37 additions and 2 deletions

View file

@ -16,6 +16,7 @@ const {
toggleFavourite, toggleFavourite,
togglePin, togglePin,
toggleReblog, toggleReblog,
toggleMute,
} = $(useStatusActions(props)) } = $(useStatusActions(props))
const clipboard = useClipboard() const clipboard = useClipboard()
@ -148,6 +149,15 @@ async function editStatus() {
@click="copyLink(status)" @click="copyLink(status)"
/> />
<CommonDropdownItem
v-if="currentUser && (status.account.id === currentUser.account.id || status.mentions.some(m => m.id === currentUser!.account.id))"
:text="status.muted ? $t('menu.unmute_conversation') : $t('menu.mute_conversation')"
:icon="status.muted ? 'i-ri:eye-line' : 'i-ri:eye-off-line'"
:command="command"
:disabled="isLoading.muted"
@click="toggleMute()"
/>
<NuxtLink :to="status.url" external target="_blank"> <NuxtLink :to="status.url" external target="_blank">
<CommonDropdownItem <CommonDropdownItem
v-if="status.url" v-if="status.url"

View file

@ -1,6 +1,6 @@
import type { Status } from 'masto' import type { Status } from 'masto'
type Action = 'reblogged' | 'favourited' | 'bookmarked' | 'pinned' type Action = 'reblogged' | 'favourited' | 'bookmarked' | 'pinned' | 'muted'
type CountField = 'reblogsCount' | 'favouritesCount' type CountField = 'reblogsCount' | 'favouritesCount'
export interface StatusActionsProps { export interface StatusActionsProps {
@ -24,6 +24,7 @@ export function useStatusActions(props: StatusActionsProps) {
bookmarked: false, bookmarked: false,
pinned: false, pinned: false,
translation: false, translation: false,
muted: false,
}) })
async function toggleStatusAction(action: Action, fetchNewStatus: () => Promise<Status>, countField?: CountField) { async function toggleStatusAction(action: Action, fetchNewStatus: () => Promise<Status>, countField?: CountField) {
@ -70,9 +71,15 @@ export function useStatusActions(props: StatusActionsProps) {
() => masto.statuses[status.pinned ? 'unpin' : 'pin'](status.id), () => masto.statuses[status.pinned ? 'unpin' : 'pin'](status.id),
) )
const toggleMute = async () => toggleStatusAction(
'muted',
() => masto.statuses[status.muted ? 'unmute' : 'mute'](status.id),
)
return { return {
status: $$(status), status: $$(status),
isLoading: $$(isLoading), isLoading: $$(isLoading),
toggleMute,
toggleReblog, toggleReblog,
toggleFavourite, toggleFavourite,
toggleBookmark, toggleBookmark,

View file

@ -99,6 +99,7 @@
"edit": "تعديل", "edit": "تعديل",
"mention_account": "أذكر {0}", "mention_account": "أذكر {0}",
"mute_account": "كتم {0}", "mute_account": "كتم {0}",
"mute_conversation": "تجاهل هذا المنصب",
"open_in_original_site": "فتح في الموقع الأصلي", "open_in_original_site": "فتح في الموقع الأصلي",
"pin_on_profile": "تثبيت على حسابك الشخصي", "pin_on_profile": "تثبيت على حسابك الشخصي",
"show_untranslated": "عرض بدون ترجمة", "show_untranslated": "عرض بدون ترجمة",
@ -110,6 +111,7 @@
"unblock_account": "رفع الحظر عن {0}", "unblock_account": "رفع الحظر عن {0}",
"unblock_domain": "رفع الحظر عن النطاق {0}", "unblock_domain": "رفع الحظر عن النطاق {0}",
"unmute_account": "إلغاء كتم الحساب {0}", "unmute_account": "إلغاء كتم الحساب {0}",
"unmute_conversation": "إعادة الصوت",
"unpin_on_profile": "إلغاء التثبيت من الملف الشخصي" "unpin_on_profile": "إلغاء التثبيت من الملف الشخصي"
}, },
"nav": { "nav": {

View file

@ -95,6 +95,7 @@
"edit": "Upravit", "edit": "Upravit",
"mention_account": "Zmínit {0}", "mention_account": "Zmínit {0}",
"mute_account": "Umlčet {0}", "mute_account": "Umlčet {0}",
"mute_conversation": "Umlčet příspěvek",
"open_in_original_site": "Otevřít na původní stránce", "open_in_original_site": "Otevřít na původní stránce",
"pin_on_profile": "Připíchnout na profil", "pin_on_profile": "Připíchnout na profil",
"show_untranslated": "Zobrazit nepřeložené", "show_untranslated": "Zobrazit nepřeložené",
@ -106,6 +107,7 @@
"unblock_account": "Odblokovat {0}", "unblock_account": "Odblokovat {0}",
"unblock_domain": "Odblokovat doménu {0}", "unblock_domain": "Odblokovat doménu {0}",
"unmute_account": "Odmlčet {0}", "unmute_account": "Odmlčet {0}",
"unmute_conversation": "Přestat ignorovat příspěvek",
"unpin_on_profile": "Odepnout z profilu" "unpin_on_profile": "Odepnout z profilu"
}, },
"nav": { "nav": {

View file

@ -95,6 +95,7 @@
"edit": "Bearbeiten", "edit": "Bearbeiten",
"mention_account": "Erwähne {0}", "mention_account": "Erwähne {0}",
"mute_account": "{0} stummschalten", "mute_account": "{0} stummschalten",
"mute_conversation": "Diesem Beitrag stummschalten",
"open_in_original_site": "Auf Originalseite öffnen", "open_in_original_site": "Auf Originalseite öffnen",
"pin_on_profile": "An Profil anpinnen", "pin_on_profile": "An Profil anpinnen",
"show_untranslated": "Übersetzung schliessen", "show_untranslated": "Übersetzung schliessen",
@ -106,6 +107,7 @@
"unblock_account": "Entsperre {0}", "unblock_account": "Entsperre {0}",
"unblock_domain": "Entsperren Domain {0}", "unblock_domain": "Entsperren Domain {0}",
"unmute_account": "Stummschaltung von {0} aufheben", "unmute_account": "Stummschaltung von {0} aufheben",
"unmute_conversation": "Stummschaltung aufheben",
"unpin_on_profile": "Von Profil lösen" "unpin_on_profile": "Von Profil lösen"
}, },
"nav": { "nav": {

View file

@ -118,6 +118,7 @@
"edit": "Edit", "edit": "Edit",
"mention_account": "Mention {0}", "mention_account": "Mention {0}",
"mute_account": "Mute {0}", "mute_account": "Mute {0}",
"mute_conversation": "Mute this post",
"open_in_original_site": "Open in original site", "open_in_original_site": "Open in original site",
"pin_on_profile": "Pin on profile", "pin_on_profile": "Pin on profile",
"show_untranslated": "Show untranslated", "show_untranslated": "Show untranslated",
@ -129,6 +130,7 @@
"unblock_account": "Unblock {0}", "unblock_account": "Unblock {0}",
"unblock_domain": "Unblock domain {0}", "unblock_domain": "Unblock domain {0}",
"unmute_account": "Unmute {0}", "unmute_account": "Unmute {0}",
"unmute_conversation": "Unmute this post",
"unpin_on_profile": "Unpin on profile" "unpin_on_profile": "Unpin on profile"
}, },
"nav": { "nav": {

View file

@ -118,6 +118,7 @@
"edit": "Edit", "edit": "Edit",
"mention_account": "Mention {0}", "mention_account": "Mention {0}",
"mute_account": "Mute {0}", "mute_account": "Mute {0}",
"mute_conversation": "Mute this post",
"open_in_original_site": "Open in original site", "open_in_original_site": "Open in original site",
"pin_on_profile": "Pin on profile", "pin_on_profile": "Pin on profile",
"show_untranslated": "Show untranslated", "show_untranslated": "Show untranslated",
@ -129,6 +130,7 @@
"unblock_account": "Unblock {0}", "unblock_account": "Unblock {0}",
"unblock_domain": "Unblock domain {0}", "unblock_domain": "Unblock domain {0}",
"unmute_account": "Unmute {0}", "unmute_account": "Unmute {0}",
"unmute_conversation": "Unmute this post",
"unpin_on_profile": "Unpin on profile" "unpin_on_profile": "Unpin on profile"
}, },
"nav": { "nav": {

View file

@ -114,6 +114,7 @@
"edit": "Editar", "edit": "Editar",
"mention_account": "Mencionar a {0}", "mention_account": "Mencionar a {0}",
"mute_account": "Silenciar a {0}", "mute_account": "Silenciar a {0}",
"mute_conversation": "Silenciar publicación",
"open_in_original_site": "Abrir página original", "open_in_original_site": "Abrir página original",
"pin_on_profile": "Fijar en tu perfil", "pin_on_profile": "Fijar en tu perfil",
"show_untranslated": "Mostrar original", "show_untranslated": "Mostrar original",
@ -125,6 +126,7 @@
"unblock_account": "Desbloquear a {0}", "unblock_account": "Desbloquear a {0}",
"unblock_domain": "Desbloquear dominio {0}", "unblock_domain": "Desbloquear dominio {0}",
"unmute_account": "Dejar de silenciar a {0}", "unmute_account": "Dejar de silenciar a {0}",
"unmute_conversation": "Dejar de silenciar la publicación",
"unpin_on_profile": "Desfijar del perfil" "unpin_on_profile": "Desfijar del perfil"
}, },
"nav": { "nav": {

View file

@ -113,6 +113,7 @@
"edit": "Éditer", "edit": "Éditer",
"mention_account": "Mentionner {0}", "mention_account": "Mentionner {0}",
"mute_account": "Mettre en sourdine {0}", "mute_account": "Mettre en sourdine {0}",
"mute_conversation": "Message muet",
"open_in_original_site": "Ouvrir sur le site d'origine", "open_in_original_site": "Ouvrir sur le site d'origine",
"pin_on_profile": "Épingler sur le profil", "pin_on_profile": "Épingler sur le profil",
"show_untranslated": "Montrer le message non-traduit", "show_untranslated": "Montrer le message non-traduit",
@ -124,6 +125,7 @@
"unblock_account": "Débloquer {0}", "unblock_account": "Débloquer {0}",
"unblock_domain": "Débloquer le domaine {0}", "unblock_domain": "Débloquer le domaine {0}",
"unmute_account": "Enlever la sourdine à {0}", "unmute_account": "Enlever la sourdine à {0}",
"unmute_conversation": "Réactiver le message",
"unpin_on_profile": "Désépingler du profil" "unpin_on_profile": "Désépingler du profil"
}, },
"nav": { "nav": {

View file

@ -37,10 +37,12 @@
"direct_message_account": "{0}さんにダイレクトメッセージ", "direct_message_account": "{0}さんにダイレクトメッセージ",
"mention_account": "{0}さんにメンション", "mention_account": "{0}さんにメンション",
"mute_account": "{0}さんをミュート", "mute_account": "{0}さんをミュート",
"mute_conversation": "ミュートポスト",
"open_in_original_site": "元のサイトで開く", "open_in_original_site": "元のサイトで開く",
"unblock_account": "{0}さんのブロックを解除", "unblock_account": "{0}さんのブロックを解除",
"unblock_domain": "{0}のドメインブロックを解除", "unblock_domain": "{0}のドメインブロックを解除",
"unmute_account": "{0}さんのミュートを解除" "unmute_account": "{0}さんのミュートを解除",
"unmute_conversation": "投稿のミュートを解除"
}, },
"nav": { "nav": {
"bookmarks": "ブックマーク", "bookmarks": "ブックマーク",

View file

@ -109,6 +109,7 @@
"edit": "编辑", "edit": "编辑",
"mention_account": "提及 {0}", "mention_account": "提及 {0}",
"mute_account": "屏蔽 {0}", "mute_account": "屏蔽 {0}",
"mute_conversation": "静音帖子",
"open_in_original_site": "从源站打开", "open_in_original_site": "从源站打开",
"pin_on_profile": "置顶在个人资料上", "pin_on_profile": "置顶在个人资料上",
"show_untranslated": "显示原文", "show_untranslated": "显示原文",
@ -120,6 +121,7 @@
"unblock_account": "解除拉黑 {0}", "unblock_account": "解除拉黑 {0}",
"unblock_domain": "解除拉黑域名 {0}", "unblock_domain": "解除拉黑域名 {0}",
"unmute_account": "解除屏蔽 {0}", "unmute_account": "解除屏蔽 {0}",
"unmute_conversation": "取消静音帖子",
"unpin_on_profile": "取消置顶" "unpin_on_profile": "取消置顶"
}, },
"nav": { "nav": {