Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
drupalorg
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupalorg
Commits
8e40ce8e
Commit
8e40ce8e
authored
1 year ago
by
Neil Drumm
Committed by
Neil Drumm
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3395666
: Remove “Open merge request” button in favor of using GitLab directly
parent
b540c8af
No related branches found
No related tags found
3 merge requests
!312
Issue # 3494493: Documentation: Document Maintainer Widget
,
!299
Remove heroes from components field. Update CTA section and add variants.
,
!201
Issue #3395666: Remove “Open merge request” button in favor of using GitLab directly
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drupalorg/includes/DrupalorgIssueFork.php
+0
-75
0 additions, 75 deletions
drupalorg/includes/DrupalorgIssueFork.php
with
0 additions
and
75 deletions
drupalorg/includes/DrupalorgIssueFork.php
+
0
−
75
View file @
8e40ce8e
...
...
@@ -428,7 +428,6 @@ class DrupalorgIssueFork extends Entity {
$output
[
'#attached'
][
'js'
][
0
][
'data'
][
'drupalorgIssueBranch'
]
=
$issue_branch
;
}
$is_member
=
FALSE
;
if
(
user_is_logged_in
()
&&
(
versioncontrol_gitlab_get_user_id
(
$GLOBALS
[
'user'
])))
{
// Get push access form.
$output
[
'header'
][
'access'
]
=
drupal_get_form
(
'drupalorg_issue_fork_access_form'
,
$this
);
...
...
@@ -494,9 +493,6 @@ class DrupalorgIssueFork extends Entity {
'#markup'
=>
$compare_image
.
t
(
'compare'
),
'#suffix'
=>
'</a> '
,
];
if
(
$is_member
&&
!
is_null
(
$this
->
getDevRelease
()))
{
$branch_output
[
'operations'
][
'mr'
]
=
drupal_get_form
(
'drupalorg_issue_fork_open_merge_request_form'
,
$this
,
$row
->
branch
);
}
}
foreach
(
$row
->
merge_requests
as
$iid
=>
$info
)
{
$merge_request_url
=
$this
->
mergeRequestUrl
(
$iid
);
...
...
@@ -990,74 +986,3 @@ function drupalorg_issue_fork_access_form_ajax(array $form, array $form_state) {
return
$form
;
}
}
/**
* Form for opening a merge request.
*/
function
drupalorg_issue_fork_open_merge_request_form
(
array
$form
,
array
$form_state
,
\DrupalorgIssueFork
$issue_fork
,
$branch
)
{
$form
[
'#id'
]
=
drupal_html_id
(
'drupalorg-issue-fork-open-mr-form-'
.
$issue_fork
->
gitlab_project_id
.
'-'
.
$branch
);
$form
[
'actions'
]
=
[
'#type'
=>
'actions'
,
'open_merge_request'
=>
[
'#type'
=>
'submit'
,
'#value'
=>
t
(
'Open merge request'
),
'#ajax'
=>
[
'callback'
=>
'drupalorg_issue_fork_open_merge_request_form_ajax'
,
'progress'
=>
[
'type'
=>
'throbber'
],
'wrapper'
=>
$form
[
'#id'
],
],
],
];
return
$form
;
}
/**
* Form submit callback for drupalorg_issue_fork_open_merge_request_form().
*/
function
drupalorg_issue_fork_open_merge_request_form_submit
(
array
$form
,
array
&
$form_state
)
{
list
(
$issue_fork
,
$branch
)
=
$form_state
[
'build_info'
][
'args'
];
try
{
$issue_wrapper
=
$issue_fork
->
getIssueWrapper
();
$gitlab_api
=
versioncontrol_gitlab_get_client
(
$GLOBALS
[
'user'
]
->
git_username
)
->
api
(
'merge_requests'
);
$merge_request
=
$gitlab_api
->
create
(
$issue_fork
->
gitlab_project_id
,
NULL
,
NULL
,
NULL
,
[
'source_branch'
=>
$branch
,
'target_branch'
=>
$issue_fork
->
getDevRelease
()
->
field_release_vcs_label
[
LANGUAGE_NONE
][
0
][
'value'
],
'title'
=>
'Issue #'
.
$issue_wrapper
->
getIdentifier
()
.
': '
.
$issue_wrapper
->
label
(),
'target_project_id'
=>
versioncontrol_project_repository_load
(
$issue_wrapper
->
field_project
->
raw
())
->
gitlab_project_id
,
'squash'
=>
TRUE
,
]);
$form_state
[
'drupalorg_merge_request'
]
=
$merge_request
[
'iid'
];
}
catch
(
Exception
$e
)
{
$uri
=
$issue_fork
->
uri
();
watchdog
(
'drupalorg_issue_fork'
,
'Exception in opening merge request for !issue, branch @branch: %msg'
,
[
'!issue'
=>
l
(
$issue_fork
->
label
(),
$uri
[
'path'
],
$uri
[
'options'
]),
'@branch'
=>
$branch
,
'%msg'
=>
$e
->
getMessage
(),
],
WATCHDOG_ERROR
);
drupal_set_message
(
t
(
'Opening merge request failed!'
),
'error'
);
}
}
/**
* #ajax callback for drupalorg_issue_fork_open_merge_request_form().
*/
function
drupalorg_issue_fork_open_merge_request_form_ajax
(
array
$form
,
array
$form_state
)
{
if
(
isset
(
$form_state
[
'drupalorg_merge_request'
]))
{
list
(
$issue_fork
)
=
$form_state
[
'build_info'
][
'args'
];
return
l
(
t
(
'<strong><abbr title="Merge Request">MR</abbr> !@iid</strong>'
,
[
'@iid'
=>
$form_state
[
'drupalorg_merge_request'
],
]),
$issue_fork
->
mergeRequestUrl
(
$form_state
[
'drupalorg_merge_request'
]),
[
'attributes'
=>
[
'class'
=>
[
'merge-request'
]],
'html'
=>
TRUE
,
'external'
=>
TRUE
,
]);
}
else
{
// Let reattaching the form re-trigger behaviors, any errors will be shown.
return
$form
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment