mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-30 16:03:37 -04:00
Fixed a bug with revertAttributes getting set during SuperModel duplicate model merging.
This commit is contained in:
parent
6eb23349d0
commit
681cc4656f
2 changed files with 4 additions and 4 deletions
app/models
|
@ -61,11 +61,11 @@ class CocoModel extends Backbone.Model
|
||||||
else
|
else
|
||||||
super(attribute)
|
super(attribute)
|
||||||
|
|
||||||
set: ->
|
set: (attributes, options) ->
|
||||||
delete @attributesWithDefaults
|
delete @attributesWithDefaults
|
||||||
inFlux = @loading or not @loaded
|
inFlux = @loading or not @loaded
|
||||||
@markToRevert() unless inFlux or @_revertAttributes
|
@markToRevert() unless inFlux or @_revertAttributes or @project or options?.silent
|
||||||
res = super(arguments...)
|
res = super attributes, options
|
||||||
@saveBackup() if @saveBackups and (not inFlux) and @hasLocalChanges()
|
@saveBackup() if @saveBackups and (not inFlux) and @hasLocalChanges()
|
||||||
res
|
res
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ module.exports = class SuperModel extends Backbone.Model
|
||||||
cachedModel = @getModelByURL(model.getURL())
|
cachedModel = @getModelByURL(model.getURL())
|
||||||
if cachedModel
|
if cachedModel
|
||||||
clone = $.extend true, {}, model.attributes
|
clone = $.extend true, {}, model.attributes
|
||||||
cachedModel.set(clone, {silent: true})
|
cachedModel.set(clone, {silent: true, fromMerge: true})
|
||||||
console.debug "Updated cached model <#{cachedModel.get('name') or cachedModel.getURL()}> with new data"
|
console.debug "Updated cached model <#{cachedModel.get('name') or cachedModel.getURL()}> with new data"
|
||||||
else
|
else
|
||||||
@registerModel(model)
|
@registerModel(model)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue