_getTasks()

in gr-task-plugin/gr-task-plugin.js [98:119]


  _getTasks() {
    if (!this.change) {
      return;
    }

    const endpoint =
        `/changes/?q=change:${this.change._number}&--task--applicable`;

    return this.plugin.restApi().get(endpoint).then(response => {
      if (response && response.length === 1) {
        const cinfo = response[0];
        if (cinfo.plugins) {
          const taskPluginInfo = cinfo.plugins.find(
              pluginInfo => pluginInfo.name === 'task');

          if (taskPluginInfo) {
            this._tasks = this._addTasks(taskPluginInfo.roots);
          }
        }
      }
    });
  }