mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-18 00:01:55 +03:00
Add 'Mute conversation' menu item
This commit is contained in:
parent
6fcbff73bd
commit
60cfeea89f
1 changed files with 40 additions and 3 deletions
|
@ -175,10 +175,12 @@ function Status({
|
||||||
const createdAtDate = new Date(createdAt);
|
const createdAtDate = new Date(createdAt);
|
||||||
const editedAtDate = new Date(editedAt);
|
const editedAtDate = new Date(editedAt);
|
||||||
|
|
||||||
|
const currentAccount = useMemo(() => {
|
||||||
|
return store.session.get('currentAccount');
|
||||||
|
}, []);
|
||||||
const isSelf = useMemo(() => {
|
const isSelf = useMemo(() => {
|
||||||
const currentAccount = store.session.get('currentAccount');
|
|
||||||
return currentAccount && currentAccount === accountId;
|
return currentAccount && currentAccount === accountId;
|
||||||
}, [accountId]);
|
}, [accountId, currentAccount]);
|
||||||
|
|
||||||
let inReplyToAccountRef = mentions?.find(
|
let inReplyToAccountRef = mentions?.find(
|
||||||
(mention) => mention.id === inReplyToAccountId,
|
(mention) => mention.id === inReplyToAccountId,
|
||||||
|
@ -200,6 +202,9 @@ function Status({
|
||||||
.catch((e) => {});
|
.catch((e) => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const mentionSelf =
|
||||||
|
inReplyToAccountId === currentAccount ||
|
||||||
|
mentions?.find((mention) => mention.id === currentAccount);
|
||||||
|
|
||||||
const showSpoiler = !!snapStates.spoilers[id] || false;
|
const showSpoiler = !!snapStates.spoilers[id] || false;
|
||||||
|
|
||||||
|
@ -570,9 +575,41 @@ function Status({
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
{(isSelf || mentionSelf) && <MenuDivider />}
|
||||||
|
{(isSelf || mentionSelf) && (
|
||||||
|
<MenuItem
|
||||||
|
onClick={async () => {
|
||||||
|
try {
|
||||||
|
const newStatus = await masto.v1.statuses[
|
||||||
|
muted ? 'unmute' : 'mute'
|
||||||
|
](id);
|
||||||
|
saveStatus(newStatus, instance);
|
||||||
|
showToast(muted ? 'Conversation unmuted' : 'Conversation muted');
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
showToast(
|
||||||
|
muted
|
||||||
|
? 'Unable to unmute conversation'
|
||||||
|
: 'Unable to mute conversation',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{muted ? (
|
||||||
|
<>
|
||||||
|
<Icon icon="unmute" />
|
||||||
|
<span>Unmute conversation</span>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Icon icon="mute" />
|
||||||
|
<span>Mute conversation</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</MenuItem>
|
||||||
|
)}
|
||||||
{isSelf && (
|
{isSelf && (
|
||||||
<>
|
<>
|
||||||
<MenuDivider />
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
states.showCompose = {
|
states.showCompose = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue