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

18 lines
448 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
fromVersion: change.fromV
toVersion: change.toV
2014-03-11 08:13:46 -04:00
}
model.users = []
for user in change.meta.users or []
model.users.push User.findOrBuild(user.id, user)
if model.users.length == 0
model.users.push User.getAnonymousUser()
2014-03-11 08:13:46 -04:00
return model