   constructor: (json) ->
     # make the actionlogs observable
     json.action_logs = (new ActionLog(j) for j in json.action_logs) if json.action_logs
-    super json,
-      committer_email: null,
-      committer_name: null,
-      body: null,
-      subject: null
-      user: null
-      branch: null
-      start_time: null
-      why: null
+    super json, {}, ["build_num"]
 
 
     @url = @komp =>
-      "#{@project_path()}/#{@build_num()}"
+      "#{@project_path()}/#{@build_num}"
 
     @style = @komp =>
       klass = switch @status()

class Base

  constructor: (json, defaults = {}) ->
    for k,v of defaults
      @[k] = @observable(v)

    for k,v of json
      @[k] = @observable(v)

  observable: (obj) ->
    if $.isArray obj
      ko.observableArray obj
    else
      ko.observable obj

  komp: (args...) =>
    ko.computed args...


class HasUrl extends Base
  constructor: (json) ->
    super json

    @project_name = @komp =>
      @vcs_url().substring(19)


class User extends Base
  constructor: (json) ->
    super json, {admin: false, login: "", is_new: false, environment: "production", basic_email_prefs: "all"}, [], false

    @showEnvironment = @komp =>
      @admin || (@environment is "staging") || (@environment is "development")

    @environmentColor = @komp =>
      result = {}
      result["env-" + @environment] = true
      result

  save_preferences: () =>
