@@ -27,6 +27,7 @@ import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
27
27
import { ShortNumber } from 'mastodon/components/short_number' ;
28
28
import { Skeleton } from 'mastodon/components/skeleton' ;
29
29
import { VerifiedBadge } from 'mastodon/components/verified_badge' ;
30
+ import { useIdentity } from 'mastodon/identity_context' ;
30
31
import { me } from 'mastodon/initial_state' ;
31
32
import type { MenuItem } from 'mastodon/models/dropdown_menu' ;
32
33
import { useAppSelector , useAppDispatch } from 'mastodon/store' ;
@@ -70,10 +71,12 @@ export const Account: React.FC<{
70
71
withBio ?: boolean ;
71
72
} > = ( { id, size = 46 , hidden, minimal, defaultAction, withBio } ) => {
72
73
const intl = useIntl ( ) ;
74
+ const { signedIn } = useIdentity ( ) ;
73
75
const account = useAppSelector ( ( state ) => state . accounts . get ( id ) ) ;
74
76
const relationship = useAppSelector ( ( state ) => state . relationships . get ( id ) ) ;
75
77
const dispatch = useAppDispatch ( ) ;
76
78
const accountUrl = account ?. url ;
79
+ const isRemote = account ?. acct !== account ?. username ;
77
80
78
81
const handleBlock = useCallback ( ( ) => {
79
82
if ( relationship ?. blocking ) {
@@ -116,66 +119,69 @@ export const Account: React.FC<{
116
119
} ,
117
120
] ;
118
121
} else if ( defaultAction !== 'block' ) {
119
- const handleAddToLists = ( ) => {
120
- const openAddToListModal = ( ) => {
121
- dispatch (
122
- openModal ( {
123
- modalType : 'LIST_ADDER' ,
124
- modalProps : {
125
- accountId : id ,
126
- } ,
127
- } ) ,
128
- ) ;
129
- } ;
130
- if ( relationship ?. following || relationship ?. requested || id === me ) {
131
- openAddToListModal ( ) ;
132
- } else {
133
- dispatch (
134
- openModal ( {
135
- modalType : 'CONFIRM_FOLLOW_TO_LIST' ,
136
- modalProps : {
137
- accountId : id ,
138
- onConfirm : ( ) => {
139
- apiFollowAccount ( id )
140
- . then ( ( relationship ) => {
141
- dispatch (
142
- followAccountSuccess ( {
143
- relationship,
144
- alreadyFollowing : false ,
145
- } ) ,
146
- ) ;
147
- openAddToListModal ( ) ;
148
- } )
149
- . catch ( ( err : unknown ) => {
150
- dispatch ( showAlertForError ( err ) ) ;
151
- } ) ;
152
- } ,
153
- } ,
154
- } ) ,
155
- ) ;
156
- }
157
- } ;
122
+ arr = [ ] ;
158
123
159
- arr = [
160
- {
161
- text : intl . formatMessage ( messages . addToLists ) ,
162
- action : handleAddToLists ,
163
- } ,
164
- ] ;
165
-
166
- if ( accountUrl ) {
167
- arr . unshift (
124
+ if ( isRemote && accountUrl ) {
125
+ arr . push (
168
126
{
169
127
text : intl . formatMessage ( messages . openOriginalPage ) ,
170
128
href : accountUrl ,
171
129
} ,
172
- null ,
130
+ ) ;
131
+ }
132
+
133
+ if ( signedIn ) {
134
+ const handleAddToLists = ( ) => {
135
+ const openAddToListModal = ( ) => {
136
+ dispatch (
137
+ openModal ( {
138
+ modalType : 'LIST_ADDER' ,
139
+ modalProps : {
140
+ accountId : id ,
141
+ } ,
142
+ } ) ,
143
+ ) ;
144
+ } ;
145
+ if ( relationship ?. following || relationship ?. requested || id === me ) {
146
+ openAddToListModal ( ) ;
147
+ } else {
148
+ dispatch (
149
+ openModal ( {
150
+ modalType : 'CONFIRM_FOLLOW_TO_LIST' ,
151
+ modalProps : {
152
+ accountId : id ,
153
+ onConfirm : ( ) => {
154
+ apiFollowAccount ( id )
155
+ . then ( ( relationship ) => {
156
+ dispatch (
157
+ followAccountSuccess ( {
158
+ relationship,
159
+ alreadyFollowing : false ,
160
+ } ) ,
161
+ ) ;
162
+ openAddToListModal ( ) ;
163
+ } )
164
+ . catch ( ( err : unknown ) => {
165
+ dispatch ( showAlertForError ( err ) ) ;
166
+ } ) ;
167
+ } ,
168
+ } ,
169
+ } ) ,
170
+ ) ;
171
+ }
172
+ } ;
173
+
174
+ arr . push (
175
+ {
176
+ text : intl . formatMessage ( messages . addToLists ) ,
177
+ action : handleAddToLists ,
178
+ } ,
173
179
) ;
174
180
}
175
181
}
176
182
177
183
return arr ;
178
- } , [ dispatch , intl , id , accountUrl , relationship , defaultAction ] ) ;
184
+ } , [ dispatch , intl , id , accountUrl , relationship , defaultAction , isRemote , signedIn ] ) ;
179
185
180
186
if ( hidden ) {
181
187
return (
0 commit comments