mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -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
|
||||
super(attribute)
|
||||
|
||||
set: ->
|
||||
set: (attributes, options) ->
|
||||
delete @attributesWithDefaults
|
||||
inFlux = @loading or not @loaded
|
||||
@markToRevert() unless inFlux or @_revertAttributes
|
||||
res = super(arguments...)
|
||||
@markToRevert() unless inFlux or @_revertAttributes or @project or options?.silent
|
||||
res = super attributes, options
|
||||
@saveBackup() if @saveBackups and (not inFlux) and @hasLocalChanges()
|
||||
res
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
cachedModel = @getModelByURL(model.getURL())
|
||||
if cachedModel
|
||||
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"
|
||||
else
|
||||
@registerModel(model)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue