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

feat: set allowance per provider #2776

Merged
merged 7 commits into from
Oct 3, 2023
Merged

feat: set allowance per provider #2776

merged 7 commits into from
Oct 3, 2023

Conversation

pavanjoshi914
Copy link
Contributor

@pavanjoshi914 pavanjoshi914 commented Sep 25, 2023

Describe the changes you have made in this PR

set allowance per provider

Link this PR to an issue [optional]

Fixes #2758

Type of change

(Remove other not matching type)

  • feat: New feature (non-breaking change which adds functionality)

Screenshots of the changes [optional]

2023-09-27.16-28-12.mp4

How has this been tested?

by enabling allowance per provider

Checklist

  • Self-review of changed code
  • Manual testing
  • Added automated tests where applicable
  • Update Docs & Guides
  • For UI-related changes
  • Darkmode
  • Responsive layout

@pavanjoshi914 pavanjoshi914 marked this pull request as draft September 25, 2023 10:27
@@ -806,6 +806,7 @@ export interface Blocklist extends DbBlocklist {}

export interface DbAllowance {
createdAt: string;
enabledFor?: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

what about providers? is there any downside of this name? I feel like it's more specific

Copy link
Contributor Author

Choose a reason for hiding this comment

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

allowance are set not just by provider. but also during the payments. for eg. while doing a lnurl-pay to the website, in future we might add some other entries there as well, isn't it good to keep it generalized. so that it can hold any kind of entries

Copy link
Contributor

Choose a reason for hiding this comment

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

@bumi @reneaaron do you have any thoughts here? currently we have enable screens for providers

@pavanjoshi914
Copy link
Contributor Author

@rolznz do you have idea about that one failing test. i am still unable to get why is that failing?

@rolznz
Copy link
Contributor

rolznz commented Sep 26, 2023

@rolznz do you have idea about that one failing test. i am still unable to get why is that failing?

@pavanjoshi914 it seems you defined the array wrong in the dexie schema: https://dexie.org/docs/MultiEntry-Index

(changing it to *enabledFor instead of &enabledFor fixed it for me)

cleanup prompt logic to set EnabledFor
use set to do logical operations and convert back to array to avoid tertiary operator
@pavanjoshi914 pavanjoshi914 marked this pull request as ready for review September 27, 2023 11:00
@rolznz
Copy link
Contributor

rolznz commented Sep 27, 2023

I've tested it and it seems to work well!

The allowance screen hasn't been changed, I think it would it be good to show which providers have been enabled there. Would it be good to do this as a follow up PR?

Copy link
Contributor

@rolznz rolznz left a comment

Choose a reason for hiding this comment

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

tACK, I think we need another PR to display the enabled providers in the allowance screen and on the connected sites page.

Best to get a review from @reneaaron or @bumi though before merging

@rolznz rolznz merged commit 182ae24 into master Oct 3, 2023
6 checks passed
@rolznz rolznz deleted the allowance-per-provider branch October 3, 2023 08:52
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.

[Feature] enable popups should only enable allowance for the current provider
2 participants