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

registerSetting adds multiple settings when called multiple times with same setting name #6356

Open
kontrollanten opened this issue Apr 26, 2024 · 0 comments · May be fixed by #6357
Open

registerSetting adds multiple settings when called multiple times with same setting name #6356

kontrollanten opened this issue Apr 26, 2024 · 0 comments · May be fixed by #6357

Comments

@kontrollanten
Copy link
Contributor

Describe the current behavior

When calling registerSetting with the same name property, the setting will be added multiple times.

registerSetting({
  name: SETTING_STRIPE_SUBSCRIPTION_PLAN_ID,
  label: 'Stripe plan used for subscription',
  type: 'select',
  options: stripePlans.map((plan) => ({
    value: plan.id,
    label: (plan.product as Stripe.Product)?.name ?? plan.id
  })),
  private: true
})

...

whenSomethingHasChanged.then(() => {
  // Update options values
  registerSetting({
    name: SETTING_STRIPE_SUBSCRIPTION_PLAN_ID,
    label: 'Stripe plan used for subscription',
    type: 'select',
    options: stripePlans.map((plan) => ({
      value: plan.id,
      label: (plan.product as Stripe.Product)?.name ?? plan.id
    })),
    private: true
  })
})

Steps to reproduce

  1. Run the code above.

Describe the expected behavior

Since the name property is unique it shouldn't be possible to have multiple settings with the same name, instead it should be updated.

Additional information

  • PeerTube instance:

    • URL:
    • Version: 6.0.3
    • NodeJS version:
    • Ffmpeg version:
  • Browser name, version and platforms on which you could reproduce the bug:

  • Link to browser console log if relevant:

  • Link to server log if relevant (journalctl or /var/www/peertube/storage/logs/):

kontrollanten added a commit to kontrollanten/PeerTube that referenced this issue Apr 26, 2024
Filter settings so that the name property is unique.

closes Chocobozzz#6356
kontrollanten added a commit to kontrollanten/PeerTube that referenced this issue Apr 26, 2024
Filter settings so that the name property is unique.

closes Chocobozzz#6356
@kontrollanten kontrollanten linked a pull request Apr 26, 2024 that will close this issue
4 tasks
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 a pull request may close this issue.

1 participant