Skip to content

Commit

Permalink
Merge pull request #21 from artemeon/small-improvements
Browse files Browse the repository at this point in the history
Small improvements
  • Loading branch information
marcreichel authored Jun 15, 2022
2 parents 5ec7dad + 5fb8f0a commit 8cf5ec4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Dto/GithubIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ public function __construct(
#[Pure]
public static function fromMantisIssue(MantisIssue $issue): GithubIssue
{
$rows = [
'| Mantis Ticket |',
'|:-------------:|',
'| [MANTIS-' . $issue->getId() . '](' . $issue->getIssueUrl() . ') |',
];
$table = implode(PHP_EOL, $rows);
return new self(
title: $issue->getSummary(),
description: $issue->getIssueUrl() . PHP_EOL . PHP_EOL . $issue->getDescription(),
description: $issue->getDescription() . PHP_EOL . PHP_EOL . $table,
);
}

Expand Down
7 changes: 6 additions & 1 deletion src/Service/MantisConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public function readIssue(int $number): ?MantisIssue
return null;
}

$mantisBaseUrl = $this->config->getMantisUrl();
if (!str_ends_with($mantisBaseUrl, '/')) {
$mantisBaseUrl .= '/';
}

$issue = new MantisIssue(
id: $result['issues'][0]['id'],
summary: $result['issues'][0]['summary'],
Expand All @@ -43,7 +48,7 @@ public function readIssue(int $number): ?MantisIssue
status: $result['issues'][0]['status']['name'],
resolution: $result['issues'][0]['resolution']['name'],
assignee: $result['issues'][0]['handler']['real_name'] ?? $result['issues'][0]['handler']['name'] ?? null,
issueUrl: $this->config->getMantisUrl() . '/view.php?id=' . $result['issues'][0]['id'],
issueUrl: $mantisBaseUrl . 'view.php?id=' . $result['issues'][0]['id'],
);
$this->updateUpstreamFieldsIssue($result['issues'][0], $issue);

Expand Down

0 comments on commit 8cf5ec4

Please sign in to comment.