@@ -100,33 +100,24 @@ export class UserFollowingService implements OnModuleInit {
100
100
this . queueService . deliver ( followee , content , follower . inbox , false ) ;
101
101
}
102
102
103
- /**
104
- * ThinUserでなくともユーザーの情報が最新でない場合はこちらを使うべき
105
- */
106
103
@bindThis
107
- public async followByThinUser (
104
+ public async follow (
108
105
_follower : ThinUser ,
109
106
_followee : ThinUser ,
110
- options : Parameters < typeof this . follow > [ 2 ] = { } ,
111
- ) {
112
- const [ follower , followee ] = await Promise . all ( [
113
- this . usersRepository . findOneByOrFail ( { id : _follower . id } ) ,
114
- this . usersRepository . findOneByOrFail ( { id : _followee . id } ) ,
115
- ] ) as [ MiLocalUser | MiRemoteUser , MiLocalUser | MiRemoteUser ] ;
116
-
117
- await this . follow ( follower , followee , options ) ;
118
- }
119
-
120
- @bindThis
121
- public async follow (
122
- follower : MiLocalUser | MiRemoteUser ,
123
- followee : MiLocalUser | MiRemoteUser ,
124
107
{ requestId, silent = false , withReplies } : {
125
108
requestId ?: string ,
126
109
silent ?: boolean ,
127
110
withReplies ?: boolean ,
128
111
} = { } ,
129
112
) : Promise < void > {
113
+ /**
114
+ * 必ず最新のユーザー情報を取得する
115
+ */
116
+ const [ follower , followee ] = await Promise . all ( [
117
+ this . usersRepository . findOneByOrFail ( { id : _follower . id } ) ,
118
+ this . usersRepository . findOneByOrFail ( { id : _followee . id } ) ,
119
+ ] ) as [ MiLocalUser | MiRemoteUser , MiLocalUser | MiRemoteUser ] ;
120
+
130
121
if ( this . userEntityService . isRemoteUser ( follower ) && this . userEntityService . isRemoteUser ( followee ) ) {
131
122
// What?
132
123
throw new Error ( 'Remote user cannot follow remote user.' ) ;
0 commit comments