mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Use _.defaults to simplify assigning default features
This commit is contained in:
parent
b7d226f434
commit
75d9912449
1 changed files with 9 additions and 24 deletions
|
@ -16,15 +16,6 @@ module.exports = ProjectEditorHandler =
|
||||||
deletedDocs: project.deletedDocs
|
deletedDocs: project.deletedDocs
|
||||||
members: []
|
members: []
|
||||||
|
|
||||||
result.features = # defaults
|
|
||||||
collaborators: -1 # Infinite
|
|
||||||
versioning: false
|
|
||||||
dropbox:false
|
|
||||||
compileTimeout: 60
|
|
||||||
compileGroup:"standard"
|
|
||||||
templates: false
|
|
||||||
references: false
|
|
||||||
|
|
||||||
owner = null
|
owner = null
|
||||||
for member in members
|
for member in members
|
||||||
if member.privilegeLevel == "owner"
|
if member.privilegeLevel == "owner"
|
||||||
|
@ -34,21 +25,15 @@ module.exports = ProjectEditorHandler =
|
||||||
if owner?
|
if owner?
|
||||||
result.owner = @buildUserModelView owner, "owner"
|
result.owner = @buildUserModelView owner, "owner"
|
||||||
|
|
||||||
if owner?.features?
|
result.features = _.defaults(owner?.features or {}, {
|
||||||
if owner.features.collaborators?
|
collaborators: -1 # Infinite
|
||||||
result.features.collaborators = owner.features.collaborators
|
versioning: false
|
||||||
if owner.features.versioning?
|
dropbox:false
|
||||||
result.features.versioning = owner.features.versioning
|
compileTimeout: 60
|
||||||
if owner.features.dropbox?
|
compileGroup:"standard"
|
||||||
result.features.dropbox = owner.features.dropbox
|
templates: false
|
||||||
if owner.features.compileTimeout?
|
references: false
|
||||||
result.features.compileTimeout = owner.features.compileTimeout
|
})
|
||||||
if owner.features.compileGroup?
|
|
||||||
result.features.compileGroup = owner.features.compileGroup
|
|
||||||
if owner.features.templates?
|
|
||||||
result.features.templates = owner.features.templates
|
|
||||||
if owner.features.references?
|
|
||||||
result.features.references = owner.features.references
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue