Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
fix: If the user has all actions set to hidden, then assume they want…
Browse files Browse the repository at this point in the history
… all un-identified actions also set to hidden
  • Loading branch information
LisoUseInAIKyrios committed Oct 18, 2024
1 parent ec482c9 commit 65ac8ac
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,16 @@ public ShortsFilter() {
);
}

private boolean isEverySuggestedActionFilterEnabled() {
for (ByteArrayFilterGroup group : suggestedActionsGroupList) {
if (!group.isEnabled()) {
return false;
}
}

return true;
}

@Override
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
Expand Down Expand Up @@ -270,7 +280,13 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
}

if (matchedGroup == suggestedAction) {
// Suggested actions can be at the start or in the middle of a path.
// Skip searching the buffer if all suggested actions are set to hidden.
// This has a secondary effect of hiding all new un-identified actions
// under the assumption that the user wants all actions hidden.
if (isEverySuggestedActionFilterEnabled()) {
return super.isFiltered(path, identifier, protobufBufferArray, matchedGroup, contentType, contentIndex);
}

if (suggestedActionsGroupList.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(
identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex
Expand Down

0 comments on commit 65ac8ac

Please sign in to comment.