overleaf/services/web/public/coffee/track-changes/models/Change.coffee

16 lines
373 B
CoffeeScript
Raw Normal View History

define [
2014-03-07 06:24:11 -05:00
"models/User"
"libs/backbone"
2014-03-07 06:24:11 -05:00
], (User)->
Change = Backbone.Model.extend
parse: (change) ->
2014-03-11 08:13:46 -04:00
model = {
start_ts: change.meta.start_ts
end_ts: change.meta.end_ts
2014-03-06 09:08:12 -05:00
version: change.v
2014-03-11 08:13:46 -04:00
}
if change.meta.user?
model.user = User.findOrBuild(change.meta.user.id, change.meta.user)
else
model.user = User.getAnonymousUser()
return model