Merge commit 'dee744c793
' into kbtopic-remove-quote
This commit is contained in:
commit
a88d202c6b
146 changed files with 1092 additions and 385 deletions
|
@ -1,6 +1,9 @@
|
|||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { useParams } from 'react-router';
|
||||
|
||||
import { LimitedAccountHint } from 'mastodon/features/account_timeline/components/limited_account_hint';
|
||||
import { me } from 'mastodon/initial_state';
|
||||
|
||||
interface EmptyMessageProps {
|
||||
suspended: boolean;
|
||||
|
@ -15,13 +18,21 @@ export const EmptyMessage: React.FC<EmptyMessageProps> = ({
|
|||
hidden,
|
||||
blockedBy,
|
||||
}) => {
|
||||
const { acct } = useParams<{ acct?: string }>();
|
||||
if (!accountId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let message: React.ReactNode = null;
|
||||
|
||||
if (suspended) {
|
||||
if (me === accountId) {
|
||||
message = (
|
||||
<FormattedMessage
|
||||
id='empty_column.account_featured.me'
|
||||
defaultMessage='You have not featured anything yet. Did you know that you can feature your posts, hashtags you use the most, and even your friend’s accounts on your profile?'
|
||||
/>
|
||||
);
|
||||
} else if (suspended) {
|
||||
message = (
|
||||
<FormattedMessage
|
||||
id='empty_column.account_suspended'
|
||||
|
@ -37,11 +48,19 @@ export const EmptyMessage: React.FC<EmptyMessageProps> = ({
|
|||
defaultMessage='Profile unavailable'
|
||||
/>
|
||||
);
|
||||
} else if (acct) {
|
||||
message = (
|
||||
<FormattedMessage
|
||||
id='empty_column.account_featured.other'
|
||||
defaultMessage='{acct} has not featured anything yet. Did you know that you can feature your posts, hashtags you use the most, and even your friend’s accounts on your profile?'
|
||||
values={{ acct }}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
message = (
|
||||
<FormattedMessage
|
||||
id='empty_column.account_featured'
|
||||
defaultMessage='This list is empty'
|
||||
id='empty_column.account_featured_other.unknown'
|
||||
defaultMessage='This account has not featured anything yet.'
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ export const FeaturedTag: React.FC<FeaturedTagProps> = ({ tag, account }) => {
|
|||
date: intl.formatDate(tag.get('last_status_at') ?? '', {
|
||||
month: 'short',
|
||||
day: '2-digit',
|
||||
year: 'numeric',
|
||||
}),
|
||||
})
|
||||
: intl.formatMessage(messages.empty)
|
||||
|
|
|
@ -25,6 +25,7 @@ import {
|
|||
unmuteAccount,
|
||||
pinAccount,
|
||||
unpinAccount,
|
||||
removeAccountFromFollowers,
|
||||
} from 'mastodon/actions/accounts';
|
||||
import { initBlockModal } from 'mastodon/actions/blocks';
|
||||
import { mentionCompose, directCompose } from 'mastodon/actions/compose';
|
||||
|
@ -70,18 +71,6 @@ import { MemorialNote } from './memorial_note';
|
|||
import { MovedNote } from './moved_note';
|
||||
|
||||
const messages = defineMessages({
|
||||
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
|
||||
follow: { id: 'account.follow', defaultMessage: 'Follow' },
|
||||
followBack: { id: 'account.follow_back', defaultMessage: 'Follow back' },
|
||||
mutual: { id: 'account.mutual', defaultMessage: 'Mutual' },
|
||||
cancel_follow_request: {
|
||||
id: 'account.cancel_follow_request',
|
||||
defaultMessage: 'Withdraw follow request',
|
||||
},
|
||||
requested: {
|
||||
id: 'account.requested',
|
||||
defaultMessage: 'Awaiting approval. Click to cancel follow request',
|
||||
},
|
||||
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
|
||||
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
|
||||
linkVerifiedOn: {
|
||||
|
@ -184,6 +173,23 @@ const messages = defineMessages({
|
|||
id: 'account.open_original_page',
|
||||
defaultMessage: 'Open original page',
|
||||
},
|
||||
removeFromFollowers: {
|
||||
id: 'account.remove_from_followers',
|
||||
defaultMessage: 'Remove {name} from followers',
|
||||
},
|
||||
confirmRemoveFromFollowersTitle: {
|
||||
id: 'confirmations.remove_from_followers.title',
|
||||
defaultMessage: 'Remove follower?',
|
||||
},
|
||||
confirmRemoveFromFollowersMessage: {
|
||||
id: 'confirmations.remove_from_followers.message',
|
||||
defaultMessage:
|
||||
'{name} will stop following you. Are you sure you want to proceed?',
|
||||
},
|
||||
confirmRemoveFromFollowersButton: {
|
||||
id: 'confirmations.remove_from_followers.confirm',
|
||||
defaultMessage: 'Remove follower',
|
||||
},
|
||||
});
|
||||
|
||||
const titleFromAccount = (account: Account) => {
|
||||
|
@ -592,6 +598,39 @@ export const AccountHeader: React.FC<{
|
|||
}
|
||||
arr.push(null);
|
||||
|
||||
if (relationship?.followed_by) {
|
||||
const handleRemoveFromFollowers = () => {
|
||||
dispatch(
|
||||
openModal({
|
||||
modalType: 'CONFIRM',
|
||||
modalProps: {
|
||||
title: intl.formatMessage(
|
||||
messages.confirmRemoveFromFollowersTitle,
|
||||
),
|
||||
message: intl.formatMessage(
|
||||
messages.confirmRemoveFromFollowersMessage,
|
||||
{ name: <strong>{account.acct}</strong> },
|
||||
),
|
||||
confirm: intl.formatMessage(
|
||||
messages.confirmRemoveFromFollowersButton,
|
||||
),
|
||||
onConfirm: () => {
|
||||
void dispatch(removeAccountFromFollowers({ accountId }));
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
arr.push({
|
||||
text: intl.formatMessage(messages.removeFromFollowers, {
|
||||
name: account.username,
|
||||
}),
|
||||
action: handleRemoveFromFollowers,
|
||||
dangerous: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (relationship?.muting) {
|
||||
arr.push({
|
||||
text: intl.formatMessage(messages.unmute, {
|
||||
|
@ -690,6 +729,8 @@ export const AccountHeader: React.FC<{
|
|||
|
||||
return arr;
|
||||
}, [
|
||||
dispatch,
|
||||
accountId,
|
||||
account,
|
||||
relationship,
|
||||
permissions,
|
||||
|
@ -724,29 +765,65 @@ export const AccountHeader: React.FC<{
|
|||
|
||||
const info: React.ReactNode[] = [];
|
||||
|
||||
if (me !== account.id && relationship?.blocking) {
|
||||
info.push(
|
||||
<span key='blocked' className='relationship-tag'>
|
||||
<FormattedMessage id='account.blocked' defaultMessage='Blocked' />
|
||||
</span>,
|
||||
);
|
||||
}
|
||||
if (me !== account.id && relationship) {
|
||||
if (
|
||||
relationship.followed_by &&
|
||||
(relationship.following || relationship.requested)
|
||||
) {
|
||||
info.push(
|
||||
<span key='mutual' className='relationship-tag'>
|
||||
<FormattedMessage
|
||||
id='account.mutual'
|
||||
defaultMessage='You follow each other'
|
||||
/>
|
||||
</span>,
|
||||
);
|
||||
} else if (relationship.followed_by) {
|
||||
info.push(
|
||||
<span key='followed_by' className='relationship-tag'>
|
||||
<FormattedMessage
|
||||
id='account.follows_you'
|
||||
defaultMessage='Follows you'
|
||||
/>
|
||||
</span>,
|
||||
);
|
||||
} else if (relationship.requested_by) {
|
||||
info.push(
|
||||
<span key='requested_by' className='relationship-tag'>
|
||||
<FormattedMessage
|
||||
id='account.requests_to_follow_you'
|
||||
defaultMessage='Requests to follow you'
|
||||
/>
|
||||
</span>,
|
||||
);
|
||||
}
|
||||
|
||||
if (me !== account.id && relationship?.muting) {
|
||||
info.push(
|
||||
<span key='muted' className='relationship-tag'>
|
||||
<FormattedMessage id='account.muted' defaultMessage='Muted' />
|
||||
</span>,
|
||||
);
|
||||
} else if (me !== account.id && relationship?.domain_blocking) {
|
||||
info.push(
|
||||
<span key='domain_blocked' className='relationship-tag'>
|
||||
<FormattedMessage
|
||||
id='account.domain_blocked'
|
||||
defaultMessage='Domain blocked'
|
||||
/>
|
||||
</span>,
|
||||
);
|
||||
if (relationship.blocking) {
|
||||
info.push(
|
||||
<span key='blocking' className='relationship-tag'>
|
||||
<FormattedMessage id='account.blocking' defaultMessage='Blocking' />
|
||||
</span>,
|
||||
);
|
||||
}
|
||||
|
||||
if (relationship.muting) {
|
||||
info.push(
|
||||
<span key='muting' className='relationship-tag'>
|
||||
<FormattedMessage id='account.muting' defaultMessage='Muting' />
|
||||
</span>,
|
||||
);
|
||||
}
|
||||
|
||||
if (relationship.domain_blocking) {
|
||||
info.push(
|
||||
<span key='domain_blocking' className='relationship-tag'>
|
||||
<FormattedMessage
|
||||
id='account.domain_blocking'
|
||||
defaultMessage='Blocking domain'
|
||||
/>
|
||||
</span>,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (relationship?.requested || relationship?.following) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue