-
Notifications
You must be signed in to change notification settings - Fork 35
Disable mutiny plus profiles instead of delete #1173
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2098,6 +2098,8 @@ impl<S: MutinyStorage> MutinyWallet<S> { | |
| self.ensure_mutiny_nwc_profile(subscription_client, autopay) | ||
| .await?; | ||
|
|
||
| // FIXME: switch the subscription from disabled to enabled if it was disabled | ||
|
|
||
| self.check_blind_tokens(); | ||
|
|
||
| Ok(()) | ||
|
|
@@ -2117,47 +2119,39 @@ impl<S: MutinyStorage> MutinyWallet<S> { | |
| .iter() | ||
| .find(|profile| profile.index == reserved_profile_index); | ||
|
|
||
| match profile_opt { | ||
| None => { | ||
| // profile with the reserved index does not exist, create a new one | ||
| let nwc = if autopay { | ||
| self.nostr | ||
| .create_new_nwc_profile( | ||
| ProfileType::Reserved(ReservedProfile::MutinySubscription), | ||
| SpendingConditions::Budget(BudgetedSpendingConditions { | ||
| budget: 21_000, | ||
| single_max: None, | ||
| payments: vec![], | ||
| period: BudgetPeriod::Month, | ||
| }), | ||
| NwcProfileTag::Subscription, | ||
| vec![Method::PayInvoice], // subscription only needs pay invoice | ||
| ) | ||
| .await? | ||
| .nwc_uri | ||
| } else { | ||
| self.nostr | ||
| .create_new_nwc_profile( | ||
| ProfileType::Reserved(ReservedProfile::MutinySubscription), | ||
| SpendingConditions::RequireApproval, | ||
| NwcProfileTag::Subscription, | ||
| vec![Method::PayInvoice], // subscription only needs pay invoice | ||
| ) | ||
| .await? | ||
| .nwc_uri | ||
| }; | ||
| if profile_opt.is_none() { | ||
| log_debug!(self.logger, "Did not find a mutiny+ nwc profile"); | ||
| // profile with the reserved index does not exist, create a new one | ||
| let nwc = if autopay { | ||
| self.nostr | ||
| .create_new_nwc_profile( | ||
| ProfileType::Reserved(ReservedProfile::MutinySubscription), | ||
| SpendingConditions::Budget(BudgetedSpendingConditions { | ||
| budget: 21_000, | ||
| single_max: None, | ||
| payments: vec![], | ||
| period: BudgetPeriod::Month, | ||
| }), | ||
| NwcProfileTag::Subscription, | ||
| vec![Method::PayInvoice], // subscription only needs pay invoice | ||
| ) | ||
| .await? | ||
| .nwc_uri | ||
| } else { | ||
| self.nostr | ||
| .create_new_nwc_profile( | ||
| ProfileType::Reserved(ReservedProfile::MutinySubscription), | ||
| SpendingConditions::RequireApproval, | ||
| NwcProfileTag::Subscription, | ||
| vec![Method::PayInvoice], // subscription only needs pay invoice | ||
| ) | ||
| .await? | ||
| .nwc_uri | ||
| }; | ||
|
|
||
| if let Some(nwc) = nwc { | ||
| // only should have to submit the NWC if never created locally before | ||
| subscription_client.submit_nwc(nwc).await?; | ||
| } | ||
| } | ||
| Some(profile) => { | ||
| if profile.tag != NwcProfileTag::Subscription { | ||
| let mut nwc = profile.clone(); | ||
| nwc.tag = NwcProfileTag::Subscription; | ||
| self.nostr.edit_nwc_profile(nwc)?; | ||
| } | ||
| if let Some(nwc) = nwc { | ||
| // only should have to submit the NWC if never created locally before | ||
| subscription_client.submit_nwc(nwc).await?; | ||
| } | ||
| } | ||
|
Comment on lines
2155
to
2162
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why delete this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it's not needed. Why keep it?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use this in the front end to mark it as a subscription so we know to not display the nwc connection string
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should already be marked correctly and that's not how the frontend handles it. https://github.com/MutinyWallet/mutiny-web/blob/a4981cb8cf0d8afe6f7e5d540fac0cc6b9c858d4/src/routes/settings/Connections.tsx#L110-L118
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, its for the open in client buttons
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
ah okay, this was for fixing old profiles, that's fine then |
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.