Commit 82392cde authored by Neil Drumm's avatar Neil Drumm 👋
Browse files

Issue #3259876: Link to diffs individually for each merge request, when there...

Issue #3259876: Link to diffs individually for each merge request, when there is more than one for the same branch
parent 80f5e93f
Loading
Loading
Loading
Loading
+34 −32
Original line number Diff line number Diff line
@@ -470,12 +470,7 @@ class DrupalorgIssueFork extends Entity {
        'link' => [
          '#markup' => '<strong><a class="link" title="' . t('View branch in GitLab') . '">' . $branch_name_sanitized . '</a></strong> ',
        ],
        'compare' => [
          '#prefix' => '<a class="compare" title="Compare branches in the issue fork">',
          '#markup' => $compare_image . t('compare'),
          '#suffix' => '</a> ',
        ],
        'mr' => [],
        'operations' => [],
        'help' => [
          '#type' => 'textfield',
          '#title' => t('Check out this branch'),
@@ -489,23 +484,20 @@ class DrupalorgIssueFork extends Entity {
      ];
      // Merge requests for the branch.
      if (empty($row->merge_requests)) {
        $branch_output['operations']['compare'] = [
          '#prefix' => '<a class="compare" title="Compare branches in the issue fork">',
          '#markup' => $compare_image . t('compare'),
          '#suffix' => '</a> ',
        ];
        if ($is_member && !is_null($this->getDevRelease())) {
          $branch_output['mr'] = drupal_get_form('drupalorg_issue_fork_open_merge_request_form', $this, $row->branch);
        }
          $branch_output['operations']['mr'] = drupal_get_form('drupalorg_issue_fork_open_merge_request_form', $this, $row->branch);
        }
      else {
        $branch_output['mr']['#markup'] = '';
      }
      foreach ($row->merge_requests as $iid => $info) {
        $merge_request_url = $this->mergeRequestUrl($iid);
        $branch_output['mr']['#markup'] .= ' ' . l(t('<strong><abbr title="Merge Request">MR</abbr> !@iid</strong>', [
          '@iid' => $iid,
        ]), $merge_request_url, [
          'attributes' => ['class' => ['merge-request']],
          'html' => TRUE,
          'external' => TRUE,
        ]);
        $branch_output['compare'] = [
        $branch_output['operations'][] = [
          '#prefix' => !empty($branch_output['operations']) ? ' / ' : '',
          'compare' => [
            '#markup' => l($compare_image . t('changes'), $merge_request_url . '/diffs', [
              'attributes' => [
                'class' => ['compare'],
@@ -520,6 +512,16 @@ class DrupalorgIssueFork extends Entity {
              'html' => TRUE,
              'external' => TRUE,
            ]) . ' ',
          ],
          'mr' => [
            '#markup' => l(t('<strong><abbr title="Merge Request">MR</abbr> !@iid</strong>', [
              '@iid' => $iid,
            ]), $merge_request_url, [
              'attributes' => ['class' => ['merge-request']],
              'html' => TRUE,
              'external' => TRUE,
            ]),
          ],
        ];
      }
      $output['branches'][$row->status][] = $branch_output;