@@ -101,24 +101,33 @@ export class UserFollowingService implements OnModuleInit {
101
101
this . queueService . deliver ( followee , content , follower . inbox , false ) ;
102
102
}
103
103
104
+ /**
105
+ * ThinUserでなくともユーザーの情報が最新でない場合はこちらを使うべき
106
+ */
104
107
@bindThis
105
- public async follow (
108
+ public async followByThinUser (
106
109
_follower : ThinUser ,
107
110
_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 ,
108
125
{ requestId, silent = false , withReplies } : {
109
126
requestId ?: string ,
110
127
silent ?: boolean ,
111
128
withReplies ?: boolean ,
112
129
} = { } ,
113
130
) : 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
-
122
131
if ( this . userEntityService . isRemoteUser ( follower ) && this . userEntityService . isRemoteUser ( followee ) ) {
123
132
// What?
124
133
throw new Error ( 'Remote user cannot follow remote user.' ) ;
0 commit comments