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