Merge pull request #68 from sharelatex/bg-fix-settings-save-for-root-doc-id

handle null values when saving rootDoc_id
This commit is contained in:
Brian Gough 2017-10-18 14:39:32 +01:00 committed by GitHub
commit fbaea831c2

View file

@ -55,7 +55,11 @@ define [
$scope.$watch "project.rootDoc_id", (rootDoc_id, oldRootDoc_id) => $scope.$watch "project.rootDoc_id", (rootDoc_id, oldRootDoc_id) =>
return if @ignoreUpdates return if @ignoreUpdates
if oldRootDoc_id? and rootDoc_id != oldRootDoc_id # don't save on initialisation, Angular passes oldRootDoc_id as
# undefined in this case.
return if typeof oldRootDoc_id is "undefined"
# otherwise only save changes, null values are allowed
if (rootDoc_id != oldRootDoc_id)
settings.saveProjectSettings({rootDocId: rootDoc_id}) settings.saveProjectSettings({rootDocId: rootDoc_id})