mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -04:00
Addressing #2173, part 1. It should now be possible to submit changes for non-versioned documents like Campaigns and Achievements.
This commit is contained in:
parent
f7403a6b77
commit
eafecaf492
2 changed files with 11 additions and 3 deletions
|
@ -141,6 +141,7 @@ module.exports = class I18NEditModelView extends RootView
|
|||
)
|
||||
|
||||
commitMessage = "Diplomat submission for lang #{@selectedLanguage}: #{flattened.length} change(s)."
|
||||
save = false if @savedBefore
|
||||
|
||||
if save
|
||||
modelToSave = @model.cloneNewMinorVersion()
|
||||
|
@ -161,8 +162,15 @@ module.exports = class I18NEditModelView extends RootView
|
|||
button = $(e.target)
|
||||
button.attr('disabled', 'disabled')
|
||||
return button.text('Failed to Submit Changes') if errors
|
||||
res = modelToSave.save(null, {type: 'POST'}) # Override PUT so we can trigger postNewVersion logic
|
||||
type = 'PUT'
|
||||
if @modelClass.schema.properties.version or (not save)
|
||||
# Override PUT so we can trigger postNewVersion logic
|
||||
# or you're POSTing a Patch
|
||||
type = 'POST'
|
||||
res = modelToSave.save(null, {type: type})
|
||||
return button.text('Failed to Submit Changes') unless res
|
||||
button.text('Submitting...')
|
||||
res.error => button.text('Error Submitting Changes')
|
||||
res.success => button.text('Submit Changes')
|
||||
res.success =>
|
||||
@savedBefore = true
|
||||
button.text('Submit Changes')
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = class Handler
|
|||
hasAccessToDocument: (req, document, method=null) ->
|
||||
return true if req.user?.isAdmin()
|
||||
|
||||
if @modelClass.schema.uses_coco_translation_coverage and (method or req.method).toLowerCase() is 'post'
|
||||
if @modelClass.schema.uses_coco_translation_coverage and (method or req.method).toLowerCase() in ['post', 'put']
|
||||
return true if @isJustFillingTranslations(req, document)
|
||||
|
||||
if @modelClass.schema.uses_coco_permissions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue