Commit 9b6c9fea by Ben McMorran Committed by cahrens

Remove staff lock field when removing staff lock

parent 3c0612a8
......@@ -394,13 +394,13 @@ define(["jquery", "underscore", "underscore.string", "js/spec_helpers/create_sin
create_sinon.expectJsonRequest(requests, 'POST', '/xblock/locator-container', {
publish: 'republish',
metadata: { visible_to_staff_only: isStaffOnly }
metadata: { visible_to_staff_only: isStaffOnly ? true : null }
});
create_sinon.respondWithJson(requests, {
data: null,
id: "locator-container",
metadata: {
visible_to_staff_only: isStaffOnly
visible_to_staff_only: isStaffOnly ? true : null
}
});
create_sinon.expectJsonRequest(requests, 'GET', '/xblock/locator-container');
......
......@@ -174,9 +174,11 @@ define(["jquery", "underscore", "gettext", "js/views/baseview", "js/views/utils/
};
saveAndPublishStaffLock = function() {
// Setting staff lock to null when disabled will delete the field from this xblock,
// allowing it to use the inherited value instead of using false explicitly.
return xblockInfo.save({
publish: 'republish',
metadata: {visible_to_staff_only: enableStaffLock}},
metadata: {visible_to_staff_only: enableStaffLock ? true : null}},
{patch: true}
).always(function() {
xblockInfo.set("publish", null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment