pl-fe: Reply instead of mention from notification hotkeys

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-03-02 17:48:54 +01:00
parent dcf165fbb5
commit 6b61ab37e7
2 changed files with 5 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
import { defineMessages, useIntl, FormattedList, FormattedMessage, IntlShape, MessageDescriptor } from 'react-intl';
import { Link, useHistory } from 'react-router-dom';
import { mentionCompose } from 'pl-fe/actions/compose';
import { mentionCompose, replyCompose } from 'pl-fe/actions/compose';
import { reblog, favourite, unreblog, unfavourite } from 'pl-fe/actions/interactions';
import HoverAccountWrapper from 'pl-fe/components/hover-account-wrapper';
import Icon from 'pl-fe/components/icon';
@ -246,7 +246,9 @@ const Notification: React.FC<INotification> = (props) => {
const handleMention = useCallback((e?: KeyboardEvent) => {
e?.preventDefault();
if (account && typeof account === 'object') {
if (status) {
dispatch(replyCompose(status, account));
} else {
dispatch(mentionCompose(account));
}
}, [account]);

View File

@ -182,10 +182,7 @@ const statusToTextMentions = (status: Pick<Status, 'account' | 'mentions'>, acco
const author = status.account.acct;
const mentions = status.mentions.map((m) => m.acct) || [];
return [...new Set([author, ...mentions]
.filter(acct => acct !== account.acct))]
.map(m => `@${m} `)
.join('');
return [...new Set([author, ...mentions].filter(acct => acct !== account.acct))].map(m => `@${m} `).join('');
};
const statusToMentionsArray = (status: Pick<Status, 'account' | 'mentions'>, account: Pick<Account, 'acct'>, rebloggedBy?: Pick<Account, 'acct'>) => {