Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use AND operator when searching for multiple labels #957

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Nov 26, 2024

Toward https://github.com/snapshot-labs/workflow/issues/254

This PR will change how proposal's labels are searched for.

Currently, labels_in operates with the OR operator, and when searching for [1, 2], will return proposals with either 1 or 2.

This PR will change the operator to AND (to be consistent with all other existing _in filters), so that when searching for [1, 2], will return results for proposals that have both 1 and 2

@wa0x6e wa0x6e marked this pull request as ready for review November 26, 2024 07:09
@wa0x6e wa0x6e requested a review from ChaituVR November 26, 2024 07:09
@wa0x6e wa0x6e changed the title fix: use AND operators when searching for multiple labels fix: use AND operators when searching for multiple labels Nov 26, 2024
@wa0x6e wa0x6e changed the title fix: use AND operators when searching for multiple labels fix: use AND operator when searching for multiple labels Nov 26, 2024
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tAck

@@ -73,7 +73,7 @@ export default async function (parent, args) {
}

if (where?.labels_in?.length) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should rename to labels_contains like in https://github.com/snapshot-labs/workflow/issues/254#issuecomment-2500056076 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask why?

labels_in is consistent with all the other *_in filters, using AND operator

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to keep it the same as SX, else I don't have any problems with _in

Refer https://github.com/snapshot-labs/workflow/issues/254#issuecomment-2500056076

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But i already approved PR, in case we want to proceed 😅 no problem in using _in

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to keep _in filter, we dont want to have both _in and _contains and we don't want to change things in snapshot.org or the new UI. We will merge all to the same syntax once we have a single API.

Copy link
Member

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@wa0x6e wa0x6e merged commit 7a1fddc into master Nov 27, 2024
2 checks passed
@wa0x6e wa0x6e deleted the fix-use-and-operator-for-labels_in branch November 27, 2024 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants