function onShowChangePolyGerrit()

in src/main/resources/static/find-owners.js [699:731]


  function onShowChangePolyGerrit(change, revision) {
    if (lastChangeInfo) {
      // If previous request was too slow, user can have enough time for
      // switching to another view. Cancel previos request.
      lastChangeInfo.cancelled = true;
    }
    const changeInfo = {
      change,
      cancelled: false,
    }
    lastChangeInfo = changeInfo;
    var changeActions = self.changeActions();
    // Hide previous 'Find Owners' button under 'MORE'.
    changeActions.setActionHidden('revision', 'find-owners~find-owners', true);
    if (!!actionKey) {
      changeActions.removeTapListener(actionKey);
      changeActions.remove(actionKey);
    }
    getIsCodeOwnerPluginEnabledForChange(change).then((codeOwnersEnabled) => {
      changeInfo.ownerPlugin = codeOwnersEnabled ? 'code-owners' : 'find-owners';
      if (changeInfo.cancelled || changeInfo.ownerPlugin === 'code-owners') {
        return;
      }
      actionKey = changeActions.add('revision', '[FIND OWNERS]');
      changeActions.setIcon(actionKey, 'robot');
      changeActions.setTitle(actionKey, 'Find owners of changed files');
      changeActions.addTapListener(actionKey, (e) => {
        if (e) e.stopPropagation();

        popupFindOwnersPage(null, change, revision, false);
      });
    });
  }