feat: add flag to redactEvent with edits FM-732#2389
Conversation
af153c0 to
4097e9d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2389 +/- ##
==========================================
- Coverage 59.61% 59.56% -0.06%
==========================================
Files 161 162 +1
Lines 20308 20338 +30
==========================================
+ Hits 12107 12114 +7
- Misses 8201 8224 +23
Continue to review full report in Codecov by Harness.
|
4097e9d to
0964378
Compare
PR SummaryMedium Risk Overview When the flag is set, the client probes The MSC3912 extension is exported from Reviewed by Cursor Bugbot for commit 592f594. Bugbot is set up for automated code reviews on this repo. Configure here. |
0964378 to
e261e44
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Edit fetch ignores pagination tokens
- Manual edit redaction now paginates related m.replace events with from/nextBatch until all pages are processed.
- ✅ Fixed: Main redact lacks rate retry
- The primary event redaction now uses the same retryAfterMs rate-limit retry path as edit redactions.
Or push these changes by commenting:
@cursor push ed4d881c74
Preview (ed4d881c74)
diff --git a/lib/src/room.dart b/lib/src/room.dart
--- a/lib/src/room.dart
+++ b/lib/src/room.dart
@@ -2491,24 +2491,47 @@
);
}
- final edits = await client.getRelatingEventsWithRelType(
- id,
- eventId,
- RelationshipTypes.edit,
- );
- for (final edit in edits.chunk) {
- final txnid = client.generateUniqueTransactionId();
+ Future<String?> redactWithRateLimitRetry(
+ String redactionEventId,
+ String txid,
+ ) async {
try {
- await client.redactEvent(id, edit.eventId, txnid, reason: reason);
+ return await client.redactEvent(
+ id,
+ redactionEventId,
+ txid,
+ reason: reason,
+ );
} on MatrixException catch (e) {
final retryAfterMs = e.retryAfterMs;
if (retryAfterMs == null) rethrow;
await Future.delayed(Duration(milliseconds: retryAfterMs));
- await client.redactEvent(id, edit.eventId, txnid, reason: reason);
+ return await client.redactEvent(
+ id,
+ redactionEventId,
+ txid,
+ reason: reason,
+ );
}
}
- return await client.redactEvent(id, eventId, messageID, reason: reason);
+ String? nextBatch;
+ do {
+ final edits = await client.getRelatingEventsWithRelType(
+ id,
+ eventId,
+ RelationshipTypes.edit,
+ from: nextBatch,
+ limit: 50,
+ );
+ for (final edit in edits.chunk) {
+ final txnid = client.generateUniqueTransactionId();
+ await redactWithRateLimitRetry(edit.eventId, txnid);
+ }
+ nextBatch = edits.nextBatch;
+ } while (nextBatch != null);
+
+ return await redactWithRateLimitRetry(eventId, messageID);
}
/// This tells the server that the user is typing for the next N millisecondsYou can send follow-ups to the cloud agent here.
e261e44 to
e499dd5
Compare
e499dd5 to
46ef708
Compare
46ef708 to
592f594
Compare
|
@cursor review |
| String? reason, | ||
| String? txid, | ||
| bool redactAllEdits = false, | ||
| }) async => await room.redactEvent( |
There was a problem hiding this comment.
async => await you don't need async await with fat arrow
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 592f594. Configure here.

closes https://famedly.atlassian.net/browse/FM-732