* 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>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* | 'quote_in_home'
|
||||
* | 'quote_in_public'
|
||||
* | 'recent_emojis'
|
||||
* | 'relationships'
|
||||
* } HideItemsDefinition
|
||||
*/
|
||||
|
||||
|
|
|
@ -119,6 +119,10 @@ module User::HasSettings
|
|||
settings['web.hide_blocking_quote']
|
||||
end
|
||||
|
||||
def setting_show_relationships
|
||||
settings['web.show_relationships']
|
||||
end
|
||||
|
||||
def setting_allow_quote
|
||||
settings['allow_quote']
|
||||
end
|
||||
|
|
|
@ -72,6 +72,7 @@ class UserSettings
|
|||
setting :simple_timeline_menu, default: false
|
||||
setting :show_quote_in_home, default: true
|
||||
setting :show_quote_in_public, default: false
|
||||
setting :show_relationships, default: true
|
||||
setting :hide_blocking_quote, default: true
|
||||
setting :hide_emoji_reaction_unavailable_server, default: false
|
||||
setting :hide_favourite_menu, default: false
|
||||
|
|
|
@ -46,6 +46,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
object_account_user.setting_show_emoji_reaction_on_timeline ? nil : 'emoji_reaction_on_timeline',
|
||||
object_account_user.setting_show_quote_in_home ? nil : 'quote_in_home',
|
||||
object_account_user.setting_show_quote_in_public ? nil : 'quote_in_public',
|
||||
object_account_user.setting_show_relationships ? nil : 'relationships',
|
||||
].compact
|
||||
else
|
||||
store[:auto_play_gif] = Setting.auto_play_gif
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
|
||||
.fields-group
|
||||
= ff.input :'web.trends', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_trends')
|
||||
= ff.input :'web.show_relationships', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_relationships')
|
||||
|
||||
%h4= t 'appearance.confirmation_dialogs'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue