This commit is contained in:
Scott Erickson 2015-02-05 10:56:52 -08:00
parent b92a029a04
commit f7403a6b77
2 changed files with 5 additions and 4 deletions

View file

@ -1,6 +1,6 @@
c = require './../schemas'
patchables = ['level', 'thang_type', 'level_system', 'level_component', 'article']
patchables = ['level', 'thang_type', 'level_system', 'level_component', 'article', 'achievement']
PatchSchema = c.object({title: 'Patch', required: ['target', 'delta', 'commitMessage']}, {
delta: {title: 'Delta', type: ['array', 'object']}

View file

@ -140,9 +140,13 @@ module.exports = class I18NEditModelView extends RootView
return _.isArray(delta.o) and delta.o.length is 1 and 'i18n' in delta.dataPath
)
commitMessage = "Diplomat submission for lang #{@selectedLanguage}: #{flattened.length} change(s)."
if save
modelToSave = @model.cloneNewMinorVersion()
modelToSave.updateI18NCoverage() if modelToSave.get('i18nCoverage')
if @modelClass.schema.properties.commitMessage
modelToSave.set 'commitMessage', commitMessage
else
modelToSave = new Patch()
@ -151,9 +155,6 @@ module.exports = class I18NEditModelView extends RootView
'collection': _.string.underscored @model.constructor.className
'id': @model.id
}
if @modelClass.schema.properties.commitMessage
commitMessage = "Diplomat submission for lang #{@selectedLanguage}: #{flattened.length} change(s)."
modelToSave.set 'commitMessage', commitMessage
errors = modelToSave.validate()