Skip to content

Commit f0c3b8d

Browse files
authored
Fix: 相手からのフォローを隠す設定を有効にしているとき、新UIで相手からのフォロー状況が表示されていた問題 (#1047)
* Fix: 相手からのフォローを隠す設定を有効にしているとき、新UIで相手からのフォロー状況が表示されていた問題 * Fix lint * Add Japanese translation
1 parent 1ce5623 commit f0c3b8d

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

app/javascript/mastodon/components/hover_card_account.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { FollowButton } from 'mastodon/components/follow_button';
1919
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
2020
import { ShortNumber } from 'mastodon/components/short_number';
2121
import { useFetchFamiliarFollowers } from 'mastodon/features/account_timeline/hooks/familiar_followers';
22-
import { domain } from 'mastodon/initial_state';
22+
import { domain, isHideItem } from 'mastodon/initial_state';
2323
import { getAccountHidden } from 'mastodon/selectors/accounts';
2424
import { useAppSelector, useAppDispatch } from 'mastodon/store';
2525

@@ -54,8 +54,10 @@ export const HoverCardAccount = forwardRef<
5454
const relationship = useAppSelector((state) =>
5555
accountId ? state.relationships.get(accountId) : undefined,
5656
);
57-
const isMutual = relationship?.followed_by && relationship.following;
58-
const isFollower = relationship?.followed_by;
57+
const isHideRelationships = isHideItem('relationships');
58+
const isMutual =
59+
!isHideRelationships && relationship?.followed_by && relationship.following;
60+
const isFollower = !isHideRelationships && relationship?.followed_by;
5961
const hasRelationshipLoaded = !!relationship;
6062

6163
const shouldDisplayFamiliarFollowers =

app/javascript/mastodon/features/account_timeline/components/account_header.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ import { DomainPill } from 'mastodon/features/account/components/domain_pill';
5151
import FollowRequestNoteContainer from 'mastodon/features/account/containers/follow_request_note_container';
5252
import { useLinks } from 'mastodon/hooks/useLinks';
5353
import { useIdentity } from 'mastodon/identity_context';
54-
import { autoPlayGif, me, domain as localDomain } from 'mastodon/initial_state';
54+
import {
55+
autoPlayGif,
56+
me,
57+
domain as localDomain,
58+
isHideItem,
59+
} from 'mastodon/initial_state';
5560
import type { Account } from 'mastodon/models/account';
5661
import type { MenuItem } from 'mastodon/models/dropdown_menu';
5762
import {
@@ -221,6 +226,8 @@ export const AccountHeader: React.FC<{
221226
const hidden = useAppSelector((state) => getAccountHidden(state, accountId));
222227
const handleLinkClick = useLinks();
223228

229+
const isHideRelationships = isHideItem('relationships');
230+
224231
const handleBlock = useCallback(() => {
225232
if (!account) {
226233
return;
@@ -549,15 +556,15 @@ export const AccountHeader: React.FC<{
549556
text: intl.formatMessage(messages.add_or_remove_from_exclude_antenna),
550557
action: handleAddToExcludeAntenna,
551558
});
552-
if (relationship?.followed_by) {
559+
if (!isHideRelationships && relationship?.followed_by) {
553560
arr.push({
554561
text: intl.formatMessage(messages.add_or_remove_from_circle),
555562
action: handleAddToCircle,
556563
});
557564
}
558565
arr.push(null);
559566

560-
if (relationship?.followed_by) {
567+
if (!isHideRelationships && relationship?.followed_by) {
561568
const handleRemoveFromFollowers = () => {
562569
dispatch(
563570
openModal({
@@ -710,6 +717,7 @@ export const AccountHeader: React.FC<{
710717
handleReblogToggle,
711718
handleReport,
712719
handleUnblockDomain,
720+
isHideRelationships,
713721
]);
714722

715723
if (!account) {
@@ -725,6 +733,7 @@ export const AccountHeader: React.FC<{
725733

726734
if (me !== account.id && relationship) {
727735
if (
736+
!isHideRelationships &&
728737
relationship.followed_by &&
729738
(relationship.following || relationship.requested)
730739
) {
@@ -736,7 +745,7 @@ export const AccountHeader: React.FC<{
736745
/>
737746
</span>,
738747
);
739-
} else if (relationship.followed_by) {
748+
} else if (!isHideRelationships && relationship.followed_by) {
740749
info.push(
741750
<span key='followed_by' className='relationship-tag'>
742751
<FormattedMessage
@@ -745,7 +754,7 @@ export const AccountHeader: React.FC<{
745754
/>
746755
</span>,
747756
);
748-
} else if (relationship.requested_by) {
757+
} else if (!relationship.followed_by && relationship.requested_by) {
749758
info.push(
750759
<span key='requested_by' className='relationship-tag'>
751760
<FormattedMessage

app/javascript/mastodon/locales/ja.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"account.followers": "フォロワー",
5656
"account.followers.empty": "まだ誰もフォローしていません。",
5757
"account.followers_counter": "{count, plural, other {{counter} フォロワー}}",
58+
"account.followers.hidden_from_me": "この情報はあなた自身の設定によって隠されています。",
5859
"account.followers_you_know_counter": "あなたと知り合いの{counter}人",
5960
"account.following": "フォロー中",
6061
"account.following_counter": "{count, plural, other {{counter} フォロー}}",

0 commit comments

Comments
 (0)