 
     super options, data
 
-    @linked  = {}
-    @fetched = {}
+    @supportedProviders = Object.keys @providers =
+      github: 'GitHub'
+      gitlab: 'GitLab'
 
-    @supportedProviders = ['gitlab', 'github']
-
+    @linked     = {}
     @switches   = {}
     @containers = {}
 

        cssClass: 'container hidden'

      @containers[provider].addSubView new kd.CustomHTMLView
        partial: "#{provider.capitalize()} Integration"

      @containers[provider].addSubView @switches[provider]


  handleForeignAuth: (provider) ->

    @whenOauthInfoFetched provider, =>
      kd.utils.defer -> new kd.NotificationView
        title: "Your #{provider.capitalize()} integration is now enabled."
      @linked[provider] = yes
      @switches[provider].setOn no


  whenOauthInfoFetched: (provider, callback) ->

    if @fetched[provider]
      do callback
    else
      @once "OauthInfoFetched.#{provider}", callback


  viewAppended: ->

    me = whoami()
    me.fetchOAuthInfo (err, foreignAuth) =>

  link: (provider) ->

    kd.singletons.oauthController.redirectToOauthUrl { provider }
    new kd.NotificationView
      title: "Redirecting to #{@providers[provider]}..."


  unlink: (provider) ->
