Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Change #11723

Category None
Changed by Jo-Philipp Wich <joohnoyoudont@mein.io>
Changed at Tue 04 Aug 2020 16:55:21
Repository https://git.openwrt.org/project/luci.git
Branch master
Revision bd5e2edb465e60be152e6276f282282e4960ca7f

Comments

luci-base: uci.js: fix option deletion quirks
Since option deletions are sent first, followed by ubus set commands,
a call sequence like:

    uci.set('config', 'section', 'option', ['foo', 'bar'])
    uci.set('config', 'section', 'option', ['foo'])
    uci.unset('config', 'section', 'option')

... would result in the option retainining `foo` as value, instead of it
getting removed as one would expect.

Fix this issue by reverting the internal change state of the option before
storing the deletion.

While we're at it, also rework the internal tracking of deleted options to
not result in duplicate removal requests when the same option is unset
several times.

Finally change all `undefined` returns to `null` in order to comply with
the function documentation.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>

Changed files