File tree Expand file tree Collapse file tree 3 files changed +4
-18
lines changed Expand file tree Collapse file tree 3 files changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ Closes the moderation case and updates the status based on the actions logged on
6161
6262 mc.resolved = clock.now ().toUtc ();
6363
64- final hasModeratedAction = mc.getActionLog ().hasModeratedAction () ;
64+ final hasModeratedAction = mc.getActionLog ().isNotEmpty ;
6565
6666 if (status == null ) {
6767 if (mc.kind == ModerationKind .notification) {
@@ -73,7 +73,7 @@ Closes the moderation case and updates the status based on the actions logged on
7373 .emptyKey
7474 .append (ModerationCase , id: mc.appealedCaseId! ));
7575 final appealHadModeratedAction =
76- appealedCase.getActionLog ().hasModeratedAction () ;
76+ appealedCase.getActionLog ().isNotEmpty ;
7777 if (appealHadModeratedAction) {
7878 status = hasModeratedAction
7979 ? ModerationStatus .moderationReverted
Original file line number Diff line number Diff line change @@ -442,21 +442,7 @@ class ModerationActionLog {
442442
443443 Map <String , Object ?> toJson () => _$ModerationActionLogToJson (this );
444444
445- /// Returns true if the final state of the actions has at least one moderation.
446- bool hasModeratedAction () {
447- final subjects = < String > {};
448- for (final entry in entries) {
449- switch (entry.moderationAction) {
450- case ModerationAction .apply:
451- subjects.add (entry.subject);
452- break ;
453- case ModerationAction .revert:
454- subjects.remove (entry.subject);
455- break ;
456- }
457- }
458- return subjects.isNotEmpty;
459- }
445+ bool get isNotEmpty => entries.isNotEmpty;
460446}
461447
462448enum ModerationAction {
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ void main() {
115115 reason: 'The package violated our policy.' ,
116116 );
117117
118- final mc = await _prepare (apply: true , appealCaseId: mc1.caseId);
118+ final mc = await _prepare (apply: false , appealCaseId: mc1.caseId);
119119 expect (await _close (mc.caseId), 'moderation-reverted' );
120120 });
121121
You can’t perform that action at this time.
0 commit comments