Commit 1fcb5e50 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '355564-remove-finder-from-vue-issues-list' into 'master'

Remove finder from issues helper when vue_issues_list enabled

See merge request gitlab-org/gitlab!82710
parents 33e25162 6213b445
...@@ -72,9 +72,12 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -72,9 +72,12 @@ class Projects::IssuesController < Projects::ApplicationController
attr_accessor :vulnerability_id attr_accessor :vulnerability_id
def index def index
set_issuables_index if !html_request? || Feature.disabled?(:vue_issues_list, project&.group, default_enabled: :yaml) if html_request? && Feature.enabled?(:vue_issues_list, project&.group, default_enabled: :yaml)
set_sort_order
@issues = @issuables else
set_issuables_index
@issues = @issuables
end
respond_to do |format| respond_to do |format|
format.html format.html
......
...@@ -209,7 +209,7 @@ module IssuesHelper ...@@ -209,7 +209,7 @@ module IssuesHelper
} }
end end
def project_issues_list_data(project, current_user, finder) def project_issues_list_data(project, current_user)
common_issues_list_data(project, current_user).merge( common_issues_list_data(project, current_user).merge(
can_bulk_update: can?(current_user, :admin_issue, project).to_s, can_bulk_update: can?(current_user, :admin_issue, project).to_s,
can_edit: can?(current_user, :admin_project, project).to_s, can_edit: can?(current_user, :admin_project, project).to_s,
...@@ -223,7 +223,7 @@ module IssuesHelper ...@@ -223,7 +223,7 @@ module IssuesHelper
is_project: true.to_s, is_project: true.to_s,
markdown_help_path: help_page_path('user/markdown'), markdown_help_path: help_page_path('user/markdown'),
max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes),
new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.try(:id) }), new_issue_path: new_project_issue_path(project),
project_import_jira_path: project_import_jira_path(project), project_import_jira_path: project_import_jira_path(project),
quick_actions_help_path: help_page_path('user/project/quick_actions'), quick_actions_help_path: help_page_path('user/project/quick_actions'),
releases_path: project_releases_path(project, format: :json), releases_path: project_releases_path(project, format: :json),
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
project_path: @project.full_path } } project_path: @project.full_path } }
- if Feature.enabled?(:vue_issues_list, @project&.group, default_enabled: :yaml) - if Feature.enabled?(:vue_issues_list, @project&.group, default_enabled: :yaml)
.js-issues-list{ data: project_issues_list_data(@project, current_user, finder) } .js-issues-list{ data: project_issues_list_data(@project, current_user) }
- if @can_bulk_update - if @can_bulk_update
= render 'shared/issuable/bulk_update_sidebar', type: :issues = render 'shared/issuable/bulk_update_sidebar', type: :issues
- elsif project_issues(@project).exists? - elsif project_issues(@project).exists?
......
...@@ -54,7 +54,7 @@ module EE ...@@ -54,7 +54,7 @@ module EE
end end
override :project_issues_list_data override :project_issues_list_data
def project_issues_list_data(project, current_user, finder) def project_issues_list_data(project, current_user)
super.tap do |data| super.tap do |data|
if project.feature_available?(:epics) && project.group if project.feature_available?(:epics) && project.group
data[:group_path] = project.group.full_path data[:group_path] = project.group.full_path
......
...@@ -126,7 +126,6 @@ RSpec.describe EE::IssuesHelper do ...@@ -126,7 +126,6 @@ RSpec.describe EE::IssuesHelper do
describe '#project_issues_list_data' do describe '#project_issues_list_data' do
let(:current_user) { double.as_null_object } let(:current_user) { double.as_null_object }
let(:finder) { double.as_null_object }
before do before do
allow(helper).to receive(:current_user).and_return(current_user) allow(helper).to receive(:current_user).and_return(current_user)
...@@ -150,14 +149,14 @@ RSpec.describe EE::IssuesHelper do ...@@ -150,14 +149,14 @@ RSpec.describe EE::IssuesHelper do
group_path: project.group.full_path group_path: project.group.full_path
} }
expect(helper.project_issues_list_data(project, current_user, finder)).to include(expected) expect(helper.project_issues_list_data(project, current_user)).to include(expected)
end end
context 'when project does not have group' do context 'when project does not have group' do
let(:project_with_no_group) { create :project } let(:project_with_no_group) { create :project }
it 'does not return group_path' do it 'does not return group_path' do
expect(helper.project_issues_list_data(project_with_no_group, current_user, finder)).not_to include(:group_path) expect(helper.project_issues_list_data(project_with_no_group, current_user)).not_to include(:group_path)
end end
end end
end end
...@@ -176,7 +175,7 @@ RSpec.describe EE::IssuesHelper do ...@@ -176,7 +175,7 @@ RSpec.describe EE::IssuesHelper do
has_multiple_issue_assignees_feature: 'false' has_multiple_issue_assignees_feature: 'false'
} }
result = helper.project_issues_list_data(project, current_user, finder) result = helper.project_issues_list_data(project, current_user)
expect(result).to include(expected) expect(result).to include(expected)
expect(result).not_to include(:group_path) expect(result).not_to include(:group_path)
......
...@@ -277,9 +277,7 @@ RSpec.describe IssuesHelper do ...@@ -277,9 +277,7 @@ RSpec.describe IssuesHelper do
shared_examples 'issues list data' do shared_examples 'issues list data' do
it 'returns expected result' do it 'returns expected result' do
finder = double.as_null_object
allow(helper).to receive(:current_user).and_return(current_user) allow(helper).to receive(:current_user).and_return(current_user)
allow(helper).to receive(:finder).and_return(finder)
allow(helper).to receive(:can?).and_return(true) allow(helper).to receive(:can?).and_return(true)
allow(helper).to receive(:image_path).and_return('#') allow(helper).to receive(:image_path).and_return('#')
allow(helper).to receive(:import_csv_namespace_project_issues_path).and_return('#') allow(helper).to receive(:import_csv_namespace_project_issues_path).and_return('#')
...@@ -308,7 +306,7 @@ RSpec.describe IssuesHelper do ...@@ -308,7 +306,7 @@ RSpec.describe IssuesHelper do
jira_integration_path: help_page_url('integration/jira/issues', anchor: 'view-jira-issues'), jira_integration_path: help_page_url('integration/jira/issues', anchor: 'view-jira-issues'),
markdown_help_path: help_page_path('user/markdown'), markdown_help_path: help_page_path('user/markdown'),
max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes),
new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.id }), new_issue_path: new_project_issue_path(project),
project_import_jira_path: project_import_jira_path(project), project_import_jira_path: project_import_jira_path(project),
quick_actions_help_path: help_page_path('user/project/quick_actions'), quick_actions_help_path: help_page_path('user/project/quick_actions'),
releases_path: project_releases_path(project, format: :json), releases_path: project_releases_path(project, format: :json),
...@@ -318,7 +316,7 @@ RSpec.describe IssuesHelper do ...@@ -318,7 +316,7 @@ RSpec.describe IssuesHelper do
sign_in_path: new_user_session_path sign_in_path: new_user_session_path
} }
expect(helper.project_issues_list_data(project, current_user, finder)).to include(expected) expect(helper.project_issues_list_data(project, current_user)).to include(expected)
end end
end end
......
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