Remove staff lock field when removing staff lock

This commit is contained in:
Ben McMorran
2014-08-05 09:01:31 -04:00
committed by cahrens
parent 3c0612a8b8
commit 9b6c9fead9
2 changed files with 5 additions and 3 deletions

View File

@@ -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');

View File

@@ -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);