Add UI support for displaying quotes of other people's posts (#36301)
This commit is contained in:
1 parent
5af40ff960
commit
d51723bb57
3 files changed
+44
-2
No files matched your search
@@ -12,6 +12,8 @@ import { ColumnHeader } from 'mastodon/components/column_header';
|
||||
import { Icon } from 'mastodon/components/icon';
|
||||
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
|
||||
import StatusList from 'mastodon/components/status_list';
|
||||
import { useIdentity } from 'mastodon/identity_context';
|
||||
import { domain } from 'mastodon/initial_state';
|
||||
import { useAppDispatch, useAppSelector } from 'mastodon/store';
|
||||
|
||||
import Column from '../ui/components/column';
|
||||
@@ -31,9 +33,18 @@ export const Quotes: React.FC<{
|
||||
|
||||
const statusId = params?.statusId;
|
||||
|
||||
const { accountId: me } = useIdentity();
|
||||
|
||||
const isCorrectStatusId: boolean = useAppSelector(
|
||||
(state) => state.status_lists.getIn(['quotes', 'statusId']) === statusId,
|
||||
);
|
||||
const quotedAccountId = useAppSelector(
|
||||
(state) =>
|
||||
state.statuses.getIn([statusId, 'account']) as string | undefined,
|
||||
);
|
||||
const quotedAccount = useAppSelector((state) =>
|
||||
quotedAccountId ? state.accounts.get(quotedAccountId) : undefined,
|
||||
);
|
||||
const statusIds = useAppSelector((state) =>
|
||||
state.status_lists.getIn(['quotes', 'items'], emptyList),
|
||||
);
|
||||
@@ -74,6 +85,32 @@ export const Quotes: React.FC<{
|
||||
/>
|
||||
);
|
||||
|
||||
let prependMessage;
|
||||
|
||||
if (me === quotedAccountId) {
|
||||
prependMessage = null;
|
||||
} else if (quotedAccount?.username === quotedAccount?.acct) {
|
||||
// Local account, we know this to be exhaustive
|
||||
prependMessage = (
|
||||
<div className='follow_requests-unlocked_explanation'>
|
||||
<FormattedMessage
|
||||
id='status.quotes.local_other_disclaimer'
|
||||
defaultMessage='Quotes rejected by the author will not be shown.'
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
prependMessage = (
|
||||
<div className='follow_requests-unlocked_explanation'>
|
||||
<FormattedMessage
|
||||
id='status.quotes.remote_other_disclaimer'
|
||||
defaultMessage='Only quotes from {domain} are guaranteed to be shown here. Quotes rejected by the author will not be shown.'
|
||||
values={{ domain: <strong>{domain}</strong> }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Column bindToDocument={!multiColumn}>
|
||||
<ColumnHeader
|
||||
@@ -100,6 +137,7 @@ export const Quotes: React.FC<{
|
||||
isLoading={isLoading}
|
||||
emptyMessage={emptyMessage}
|
||||
bindToDocument={!multiColumn}
|
||||
prepend={prependMessage}
|
||||
/>
|
||||
|
||||
<Helmet>
|
||||
|
||||
Reference in new issue
Block a user