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

Filter Bounties By Paid and Unpaid #1629

Closed
wants to merge 3 commits into from

Conversation

tsmith123
Copy link
Contributor

@tsmith123 tsmith123 commented Nov 21, 2024

Description

This PR adds a sub filter to the recent/bounties page so that paid and unpaid bounties can be shown.

When the user selects the sub filter, it appends a query string value to the url and passes this value to the item resolver. If the user selects "all" from the filter then the query string value will be removed.

DRAFT
This is a draft PR because the SQL queries don't yet work. I'm not sure how to know whether a bounty has been paid which is why the code is commented out in the PR. I've tried to use Item.bountyPaidTo but it results in an error.

Screenshots

Screenshot 2024-11-21 at 06 41 11
Screenshot 2024-11-21 at 06 41 21

Additional Context

My test environment doesn't have any posts with bounties and therefore my local testing has been limited. I don't know how to add sats to my test account so I can't create bounty posts.

Is it possible to preload my test account with sats to help with testing?

Comment on lines 302 to 307
// if (subType === 'paid') {
// return ['"Item".bounty IS NOT NULL', '"Item".bountyPaidTo IS NOT NULL', '"Item"."parentId" IS NULL']
// } else if (subType === 'unpaid') {
// return ['"Item".bounty IS NOT NULL', '"Item".bountyPaidTo IS NULL', '"Item"."parentId" IS NULL']
// }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@huumn Is bountyPaidTo a field because I tried the above but it returns an error. Is this "the way" to know whether a bounty has been paid?

Copy link
Member

@ekzyis ekzyis Nov 21, 2024

Choose a reason for hiding this comment

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

You need to use quotation marks for case-sensitive SQL fields (see surrounding code) or #1589

Copy link

gitguardian bot commented Nov 21, 2024

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14568109 Triggered Generic Private Key b5851ae docker/cln/client-key.pem View secret
14568110 Triggered Generic Private Key b5851ae docker/cln/server-key.pem View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@ekzyis
Copy link
Member

ekzyis commented Nov 21, 2024

This filter has already been added in #1589

@tsmith123
Copy link
Contributor Author

Oh bugger. No one had assigned it. Mine does work slightly differently however as it makes a new request to fetch unpaid and paid rather than filtering the ones on screen already. Maybe some of it is usable.

@aegroto
Copy link
Contributor

aegroto commented Nov 21, 2024

@tsmith123 Just to clarify, my PR updates the data by updating the query filter returned by typeClause, therefore it does not just filter elements present in the screen.

@tsmith123
Copy link
Contributor Author

Ok, only looked very quickly. If you refresh the page does it preserve the filter?

@aegroto
Copy link
Contributor

aegroto commented Nov 21, 2024

I admit I have not tried, but should it? You are actually refreshing the "bounties" page so it may make sense to reset the filter on every hard refresh.

@ekzyis
Copy link
Member

ekzyis commented Nov 21, 2024

I am sorry for your unnecessary work. Next time please check if there was a PR linked. The link also mentioned it will close the issue:

2024-11-21-154301_854x86_scrot

I have already reviewed #1589 and it contains 99% of what we need.

@ekzyis ekzyis closed this Nov 21, 2024
@tsmith123
Copy link
Contributor Author

The only other thing is you can't show just paid and just unpaid with a checkbox as well as all but that isn't a big deal. Anyway, my bad as I was bit late to this ticket. 😂 good luck

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