Skip to content

Commit 749dd04

Browse files
committed
Make moderation lenient wrt. moderationcase status
1 parent ae6893f commit 749dd04

File tree

5 files changed

+6
-23
lines changed

5 files changed

+6
-23
lines changed

app/lib/admin/actions/moderate_package.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ Note: the action may take a longer time to complete as the public archive bucket
5252
final note = options['note'];
5353

5454
final refCase =
55-
await adminBackend.loadAndVerifyModerationCaseForAdminAction(
56-
caseId,
57-
status: ModerationStatus.pending,
58-
);
55+
await adminBackend.loadAndVerifyModerationCaseForAdminAction(caseId);
5956

6057
final p = await packageBackend.lookupPackage(package!);
6158
if (p == null) {

app/lib/admin/actions/moderate_package_versions.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ Set the moderated flag on a package version (updating the flag and the timestamp
6262
final note = options['note'];
6363

6464
final refCase =
65-
await adminBackend.loadAndVerifyModerationCaseForAdminAction(
66-
caseId,
67-
status: ModerationStatus.pending,
68-
);
65+
await adminBackend.loadAndVerifyModerationCaseForAdminAction(caseId);
6966

7067
final p = await packageBackend.lookupPackage(package!);
7168
if (p == null) {

app/lib/admin/actions/moderate_publisher.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ can't be updated, administrators must not be able to update publisher options.
5454
final note = options['note'];
5555

5656
final refCase =
57-
await adminBackend.loadAndVerifyModerationCaseForAdminAction(
58-
caseId,
59-
status: ModerationStatus.pending,
60-
);
57+
await adminBackend.loadAndVerifyModerationCaseForAdminAction(caseId);
6158

6259
Publisher? publisher2;
6360
if (valueToSet != null) {

app/lib/admin/actions/moderate_user.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ The active web sessions of the user will be expired.
4949
final note = options['note'];
5050

5151
final refCase =
52-
await adminBackend.loadAndVerifyModerationCaseForAdminAction(
53-
caseId,
54-
status: null,
55-
);
52+
await adminBackend.loadAndVerifyModerationCaseForAdminAction(caseId);
5653

5754
User? user;
5855
if (looksLikeUserId(userIdOrEmail!)) {

app/lib/admin/backend.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,8 @@ class AdminBackend {
754754
///
755755
/// Throws exceptions otherwise.
756756
Future<ModerationCase?> loadAndVerifyModerationCaseForAdminAction(
757-
String? caseId, {
758-
required String? status,
759-
}) async {
757+
String? caseId,
758+
) async {
760759
InvalidInputException.check(
761760
caseId != null && caseId.isNotEmpty,
762761
'case must be given',
@@ -769,10 +768,6 @@ class AdminBackend {
769768
if (refCase == null) {
770769
throw NotFoundException.resource(caseId);
771770
}
772-
if (status != null && refCase.status != status) {
773-
throw InvalidInputException(
774-
'ModerationCase.status ("${refCase.status}") != "$status".');
775-
}
776771
return refCase;
777772
}
778773

0 commit comments

Comments
 (0)