mirror of https://github.com/Chocobozzz/PeerTube
Fix registering unamed settings
parent
6d12f018cd
commit
c5de5ef1d0
|
@ -19,6 +19,16 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
|
|||
]
|
||||
})
|
||||
|
||||
registerSetting({
|
||||
label: 'Unnamed 1',
|
||||
type: 'input'
|
||||
})
|
||||
|
||||
registerSetting({
|
||||
label: 'Unnamed 2',
|
||||
type: 'input'
|
||||
})
|
||||
|
||||
const actionHooks = [
|
||||
'action:application.listening',
|
||||
'action:notifier.notification.created',
|
||||
|
|
|
@ -31,7 +31,8 @@ describe('Test plugin settings', function () {
|
|||
npmName: 'peertube-plugin-test'
|
||||
})
|
||||
|
||||
expect(registeredSettings.length).to.equal(1)
|
||||
expect(registeredSettings.length).to.equal(3)
|
||||
expect(registeredSettings.map(r => r.label)).to.have.members([ 'Unique setting', 'Unnamed 1', 'Unnamed 2' ])
|
||||
})
|
||||
|
||||
it('Should return the latest registered settings', async function () {
|
||||
|
|
|
@ -204,7 +204,8 @@ export class RegisterHelpers {
|
|||
private buildRegisterSetting () {
|
||||
return (options: RegisterServerSettingOptions) => {
|
||||
this.settings = [
|
||||
...this.settings.filter((s) => s.name !== options.name),
|
||||
...this.settings.filter(s => !s.name || s.name !== options.name),
|
||||
|
||||
options
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue