Skip to content
Snippets Groups Projects
Commit 350f0ffa authored by Alex Kalderimis's avatar Alex Kalderimis Committed by Brett Walker
Browse files

Handle parenting in connections

parent 0980d1d3
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !27536. Comments created here will be created in the context of that merge request.
......@@ -17,24 +17,25 @@ def initialize(node, connection)
@runner = node.node
end
# here parent is a Keyset::Connection
def edit_url(parent:)
runner_url(parent: parent, url_type: :edit_url)
runner_url(owner: parent.parent, url_type: :edit_url)
end
def web_url(parent:)
runner_url(parent: parent, url_type: :default)
runner_url(owner: parent.parent, url_type: :default)
end
private
def runner_url(parent:, url_type: :default)
def runner_url(owner:, url_type: :default)
# Only ::Group is supported at the moment, future iterations will include ::Project.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/16338
case parent
case owner
when ::Group
return Gitlab::Routing.url_helpers.edit_group_runner_url(parent, @runner) if url_type == :edit_url
return Gitlab::Routing.url_helpers.edit_group_runner_url(owner, @runner) if url_type == :edit_url
Gitlab::Routing.url_helpers.group_runner_url(parent, @runner)
Gitlab::Routing.url_helpers.group_runner_url(owner, @runner)
end
end
end
......
......@@ -14,6 +14,8 @@ module InteractsWithMergeRequest
end
def merge_request_interaction(parent:, id: nil)
# need the connection parent if called from a connection node:
parent = parent.parent if parent.try(:field)&.connection?
Users::MergeRequestInteraction.new(user: object, merge_request: parent)
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment