@@ -235,7 +235,7 @@ func (d *Dereferencer) isPermittedReply(
235
235
236
236
// Status doesn't claim to be approved.
237
237
// Check interaction policy of inReplyTo
238
- // to see if it doesn't require approval .
238
+ // to see what we need to do with it .
239
239
replyable , err := d .intFilter .StatusReplyable (ctx ,
240
240
reply .Account ,
241
241
inReplyTo ,
@@ -260,35 +260,52 @@ func (d *Dereferencer) isPermittedReply(
260
260
)
261
261
}
262
262
263
- // Reply is permitted according to the interaction
264
- // policy set on the replied-to status (if any).
265
-
266
- if ! replyable .MatchedOnCollection () {
267
- // If we didn't match on a collection,
268
- // then we don't require an acceptIRI,
269
- // and we don't need to send an Accept;
270
- // just permit the reply full stop.
263
+ if replyable .Permitted () &&
264
+ ! replyable .MatchedOnCollection () {
265
+ // Reply is permitted and match was *not* made
266
+ // based on inclusion in a followers/following
267
+ // collection. Just permit the reply full stop
268
+ // as no approval / accept URI is necessary.
271
269
return true , nil
272
270
}
273
271
274
- // Reply is permitted, but match was made based
275
- // on inclusion in a followers/following collection.
276
- //
277
- // If the status is ours, mark it as PreApproved
278
- // so the processor knows to create and send out
279
- // an Accept for it immediately.
280
- if inReplyTo .IsLocal () {
272
+ // Reply is either permitted based on inclusion in a
273
+ // followers/following collection, *or* is permitted
274
+ // pending approval, though we know at this point
275
+ // that the status did not include an approvedBy URI.
276
+
277
+ if ! inReplyTo .IsLocal () {
278
+ // If the replied-to status is remote, we should just
279
+ // drop this reply at this point, as we can't verify
280
+ // that the remote replied-to account approves it, and
281
+ // we can't verify the presence of a remote account
282
+ // in one of another remote account's collections.
283
+ //
284
+ // It's possible we'll get an Accept from the replied-
285
+ // to account later, and we can store this reply then.
286
+ return false , nil
287
+ }
288
+
289
+ // Replied-to status is ours, so the
290
+ // replied-to account is ours as well.
291
+
292
+ if replyable .MatchedOnCollection () {
293
+ // If permission was granted based on inclusion in
294
+ // a followers/following collection, pre-approve the
295
+ // reply, as we ourselves can validate presence of the
296
+ // replier in the appropriate collection. Pre-approval
297
+ // lets the processor know it should send out an Accept
298
+ // straight away on behalf of the replied-to account.
281
299
reply .PendingApproval = util .Ptr (true )
282
300
reply .PreApproved = true
283
301
return true , nil
284
302
}
285
303
286
- // For replies to remote statuses, which matched
287
- // on a followers/following collection, but did not
288
- // include an acceptIRI, we should just drop it.
289
- // It's possible we'll get an Accept for it later
290
- // and we can check everything again.
291
- return false , nil
304
+ // Reply just requires approval from the local account
305
+ // it replies to. Set PendingApproval so the processor
306
+ // knows to create a pending interaction request.
307
+ reply .PendingApproval = util .Ptr (true )
308
+ return true , nil
292
309
}
293
310
294
311
// unpermittedByParent marks the given reply as rejected
0 commit comments