_loadRepo()

in submit-rules/gr-simple-submit-rules-repo-config.js [117:154]


  _loadRepo() {
    this.repoConfig = {};
    if (!this.repoName) {
      return;
    }
    const promises = [];

    promises.push(
        this._pluginRestApi()
            .getLoggedIn()
            .then(loggedIn => {
              this._loggedIn = loggedIn;
              if (loggedIn) {
                this._getRepoAccess(this.repoName).then(access => {
                  if (!access) {
                    return;
                  }
                  // If the user is not an owner, is_owner is not a property.
                  this._readOnly = !access[this.repoName].is_owner;
                });
              }
            })
    );

    promises.push(
        this._pluginRestApi()
            .get(this._endpointUrl())
            .then(config => {
              if (!config) {
                return;
              }
              this.set('_repoConfig', config);
              this._loading = false;
            })
    );

    return Promise.all(promises);
  }