Commit fc277ecd authored by Mark Chao's avatar Mark Chao

Merge branch 'jejacks0n/experiment/repo-integrations-link-cleanup' into 'master'

Add configure integrations button to project view

See merge request gitlab-org/gitlab!67536
parents d16f720d c14589e7
......@@ -431,22 +431,10 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
private
def integrations_anchor_data
experiment(:repo_integrations_link, project: project) do |e|
e.exclude! unless can?(current_user, :admin_project, project)
e.use {} # nil control
e.try do
label = statistic_icon('settings') + _('Configure Integrations')
AnchorData.new(false, label, project_settings_integrations_path(project), nil, nil, nil, {
'track-event': 'click',
'track-experiment': e.name
})
end
e.run # call run so the return value will be the AnchorData (or nil)
return unless can?(current_user, :admin_project, project)
e.track(:view, value: project.id) # track an event for the view, with project id
end
label = statistic_icon('settings') + _('Configure Integrations')
AnchorData.new(false, label, project_settings_integrations_path(project), nil, nil, nil)
end
def cicd_missing?
......
---
name: repo_integrations_link
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54652/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/285154
milestone: '13.10'
type: experiment
group: group::adoption
default_enabled: false
......@@ -349,7 +349,7 @@ describe('Tracking', () => {
it('includes experiment data if linked to an experiment', () => {
const mockExperimentData = {
variant: 'candidate',
experiment: 'repo_integrations_link',
experiment: 'example',
key: '2bff73f6bb8cc11156c50a8ba66b9b8b',
};
getExperimentData.mockReturnValue(mockExperimentData);
......
......@@ -649,36 +649,18 @@ RSpec.describe ProjectPresenter do
end
end
describe 'experiment(:repo_integrations_link)' do
context 'when enabled' do
before do
stub_experiments(repo_integrations_link: :candidate)
end
it 'includes a button to configure integrations for maintainers' do
project.add_maintainer(user)
expect(empty_repo_statistics_buttons.map(&:label)).to include(
a_string_including('Configure Integration')
)
end
it 'does not include a button if not a maintainer' do
expect(empty_repo_statistics_buttons.map(&:label)).not_to include(
a_string_including('Configure Integration')
)
end
end
it 'includes a button to configure integrations for maintainers' do
project.add_maintainer(user)
context 'when disabled' do
it 'does not include a button' do
project.add_maintainer(user)
expect(empty_repo_statistics_buttons.map(&:label)).to include(
a_string_including('Configure Integration')
)
end
expect(empty_repo_statistics_buttons.map(&:label)).not_to include(
a_string_including('Configure Integration')
)
end
end
it 'does not include a button if not a maintainer' do
expect(empty_repo_statistics_buttons.map(&:label)).not_to include(
a_string_including('Configure Integration')
)
end
context 'for a developer' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment