overleaf/services/web/public/coffee/track-changes/models/Change.coffee
2014-03-11 12:14:52 +00:00

16 lines
No EOL
373 B
CoffeeScript

define [
"models/User"
"libs/backbone"
], (User)->
Change = Backbone.Model.extend
parse: (change) ->
model = {
start_ts: change.meta.start_ts
end_ts: change.meta.end_ts
version: change.v
}
if change.meta.user?
model.user = User.findOrBuild(change.meta.user.id, change.meta.user)
else
model.user = User.getAnonymousUser()
return model