* Add: #36 アカウント詳細画面の「フォローされています」を隠すオプション * Fix lint
This commit is contained in:
parent
eee13b3f5f
commit
53c2aa797b
10 changed files with 23 additions and 7 deletions
|
@ -24,7 +24,7 @@ import { Icon } from 'mastodon/components/icon';
|
|||
import { IconButton } from 'mastodon/components/icon_button';
|
||||
import { ShortNumber } from 'mastodon/components/short_number';
|
||||
import DropdownMenuContainer from 'mastodon/containers/dropdown_menu_container';
|
||||
import { autoPlayGif, me, domain } from 'mastodon/initial_state';
|
||||
import { autoPlayGif, me, domain, isShowItem } from 'mastodon/initial_state';
|
||||
import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions';
|
||||
import { WithRouterPropTypes } from 'mastodon/utils/react_router';
|
||||
|
||||
|
@ -89,9 +89,9 @@ const titleFromAccount = account => {
|
|||
const messageForFollowButton = relationship => {
|
||||
if(!relationship) return messages.follow;
|
||||
|
||||
if (relationship.get('following') && relationship.get('followed_by')) {
|
||||
if (relationship.get('following') && relationship.get('followed_by') && isShowItem('relationships')) {
|
||||
return messages.mutual;
|
||||
} else if (!relationship.get('following') && relationship.get('followed_by')) {
|
||||
} else if (!relationship.get('following') && relationship.get('followed_by') && isShowItem('relationships')) {
|
||||
return messages.followBack;
|
||||
} else if (relationship.get('following')) {
|
||||
return messages.unfollow;
|
||||
|
|
|
@ -10,6 +10,7 @@ import { debounce } from 'lodash';
|
|||
|
||||
import { TimelineHint } from 'mastodon/components/timeline_hint';
|
||||
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
|
||||
import { isHideItem, me } from 'mastodon/initial_state';
|
||||
import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
|
||||
import { getAccountHidden } from 'mastodon/selectors';
|
||||
|
||||
|
@ -130,7 +131,8 @@ class Followers extends ImmutablePureComponent {
|
|||
|
||||
let emptyMessage;
|
||||
|
||||
const forceEmptyState = blockedBy || suspended || hidden;
|
||||
const isHideRelationships = isHideItem('relationships') && accountId === me;
|
||||
const forceEmptyState = blockedBy || suspended || hidden || isHideRelationships;
|
||||
|
||||
if (suspended) {
|
||||
emptyMessage = <FormattedMessage id='empty_column.account_suspended' defaultMessage='Account suspended' />;
|
||||
|
@ -142,6 +144,8 @@ class Followers extends ImmutablePureComponent {
|
|||
emptyMessage = <FormattedMessage id='empty_column.account_hides_collections' defaultMessage='This user has chosen to not make this information available' />;
|
||||
} else if (remote && accountIds.isEmpty()) {
|
||||
emptyMessage = <RemoteHint url={remoteUrl} />;
|
||||
} else if (isHideRelationships) {
|
||||
emptyMessage = <FormattedMessage id='account.followers.hidden_from_me' defaultMessage='This information is hidden by your setting.' />;
|
||||
} else {
|
||||
emptyMessage = <FormattedMessage id='account.followers.empty' defaultMessage='No one follows this user yet.' />;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import { debounce } from 'lodash';
|
|||
|
||||
import { TimelineHint } from 'mastodon/components/timeline_hint';
|
||||
import BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';
|
||||
import { isHideItem, me } from 'mastodon/initial_state';
|
||||
import { normalizeForLookup } from 'mastodon/reducers/accounts_map';
|
||||
import { getAccountHidden } from 'mastodon/selectors';
|
||||
|
||||
|
@ -131,6 +132,7 @@ class Following extends ImmutablePureComponent {
|
|||
let emptyMessage;
|
||||
|
||||
const forceEmptyState = blockedBy || suspended || hidden;
|
||||
const normalizedAccountIds = isHideItem('relationships') ? accountIds.filter((id) => id !== me) : accountIds;
|
||||
|
||||
if (suspended) {
|
||||
emptyMessage = <FormattedMessage id='empty_column.account_suspended' defaultMessage='Account suspended' />;
|
||||
|
@ -138,9 +140,9 @@ class Following extends ImmutablePureComponent {
|
|||
emptyMessage = <LimitedAccountHint accountId={accountId} />;
|
||||
} else if (blockedBy) {
|
||||
emptyMessage = <FormattedMessage id='empty_column.account_unavailable' defaultMessage='Profile unavailable' />;
|
||||
} else if (hideCollections && accountIds.isEmpty()) {
|
||||
} else if (hideCollections && normalizedAccountIds.isEmpty()) {
|
||||
emptyMessage = <FormattedMessage id='empty_column.account_hides_collections' defaultMessage='This user has chosen to not make this information available' />;
|
||||
} else if (remote && accountIds.isEmpty()) {
|
||||
} else if (remote && normalizedAccountIds.isEmpty()) {
|
||||
emptyMessage = <RemoteHint url={remoteUrl} />;
|
||||
} else {
|
||||
emptyMessage = <FormattedMessage id='account.follows.empty' defaultMessage="This user doesn't follow anyone yet." />;
|
||||
|
@ -163,7 +165,7 @@ class Following extends ImmutablePureComponent {
|
|||
emptyMessage={emptyMessage}
|
||||
bindToDocument={!multiColumn}
|
||||
>
|
||||
{forceEmptyState ? [] : accountIds.map(id =>
|
||||
{forceEmptyState ? [] : normalizedAccountIds.map(id =>
|
||||
<AccountContainer key={id} id={id} withNote={false} />,
|
||||
)}
|
||||
</ScrollableList>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue