Use web URLs for Gitlab support metadata (#10377)

main
Jérôme Tamarelle 2 years ago committed by GitHub
parent 54123e4093
commit f0060b7f56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -163,8 +163,12 @@ class GitLabDriver extends VcsDriver
if ($composer) {
// specials for gitlab (this data is only available if authentication is provided)
if (!isset($composer['support']['issues']) && isset($this->project['_links']['issues'])) {
$composer['support']['issues'] = $this->project['_links']['issues'];
if (!isset($composer['support']['source']) && isset($this->project['web_url'])) {
$label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier;
$composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label);
}
if (!isset($composer['support']['issues']) && !empty($this->project['issues_enabled']) && isset($this->project['web_url'])) {
$composer['support']['issues'] = sprintf('%s/-/issues', $this->project['web_url']);
}
if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
$composer['abandoned'] = true;

@ -95,6 +95,8 @@ class GitLabDriverTest extends TestCase
"id": 17,
"default_branch": "mymaster",
"visibility": "private",
"issues_enabled": true,
"archived": false,
"http_url_to_repo": "https://gitlab.com/mygroup/myproject.git",
"ssh_url_to_repo": "git@gitlab.com:mygroup/myproject.git",
"last_activity_at": "2014-12-01T09:17:51.000+01:00",

Loading…
Cancel
Save