Skip to content
代码片段 群组 项目
未验证 提交 76b4da0c 编辑于 作者: Marc Saleiko's avatar Marc Saleiko 提交者: GitLab
浏览文件

Adds tickets_confidential_by_default to controller and update sevrice

Adds processing of tickets_confidential_by_default
field to both ServiceDeskController and
ServiceDeskSettings::UpdateService and
pushes the feature flag service_desk_tickets_confidentiality
to the frontend on the project settings page.
上级 66601408
No related branches found
No related tags found
无相关合并请求
...@@ -35,6 +35,7 @@ def allowed_update_attributes ...@@ -35,6 +35,7 @@ def allowed_update_attributes
project_key project_key
reopen_issue_on_external_participant_note reopen_issue_on_external_participant_note
add_external_participants_from_cc add_external_participants_from_cc
tickets_confidential_by_default
] ]
end end
...@@ -49,7 +50,8 @@ def service_desk_attributes ...@@ -49,7 +50,8 @@ def service_desk_attributes
outgoing_name: service_desk_settings&.outgoing_name, outgoing_name: service_desk_settings&.outgoing_name,
project_key: service_desk_settings&.project_key, project_key: service_desk_settings&.project_key,
reopen_issue_on_external_participant_note: service_desk_settings&.reopen_issue_on_external_participant_note, reopen_issue_on_external_participant_note: service_desk_settings&.reopen_issue_on_external_participant_note,
add_external_participants_from_cc: service_desk_settings&.add_external_participants_from_cc add_external_participants_from_cc: service_desk_settings&.add_external_participants_from_cc,
tickets_confidential_by_default: service_desk_settings&.tickets_confidential_by_default
} }
end end
......
...@@ -41,6 +41,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -41,6 +41,7 @@ class ProjectsController < Projects::ApplicationController
push_frontend_feature_flag(:remove_monitor_metrics, @project) push_frontend_feature_flag(:remove_monitor_metrics, @project)
push_frontend_feature_flag(:explain_code_chat, current_user) push_frontend_feature_flag(:explain_code_chat, current_user)
push_frontend_feature_flag(:issue_email_participants, @project) push_frontend_feature_flag(:issue_email_participants, @project)
push_frontend_feature_flag(:service_desk_tickets_confidentiality, @project)
push_frontend_feature_flag(:edit_branch_rules, @project) push_frontend_feature_flag(:edit_branch_rules, @project)
# TODO: We need to remove the FF eventually when we rollout page_specific_styles # TODO: We need to remove the FF eventually when we rollout page_specific_styles
push_frontend_feature_flag(:page_specific_styles, current_user) push_frontend_feature_flag(:page_specific_styles, current_user)
......
...@@ -9,7 +9,14 @@ def execute ...@@ -9,7 +9,14 @@ def execute
params[:project_key] = nil if params[:project_key].blank? params[:project_key] = nil if params[:project_key].blank?
apply_feature_flag_restrictions! apply_feature_flag_restrictions!(
feature_flag: :issue_email_participants,
field: :add_external_participants_from_cc
)
apply_feature_flag_restrictions!(
feature_flag: :service_desk_tickets_confidentiality,
field: :tickets_confidential_by_default
)
# We want to know when custom email got enabled # We want to know when custom email got enabled
write_log_message = params[:custom_email_enabled].present? && !settings.custom_email_enabled? write_log_message = params[:custom_email_enabled].present? && !settings.custom_email_enabled?
...@@ -25,11 +32,11 @@ def execute ...@@ -25,11 +32,11 @@ def execute
private private
def apply_feature_flag_restrictions! def apply_feature_flag_restrictions!(feature_flag:, field:)
return if Feature.enabled?(:issue_email_participants, project) return if Feature.enabled?(feature_flag, project)
return unless params.include?(:add_external_participants_from_cc) return unless params.include?(field)
params.delete(:add_external_participants_from_cc) params.delete(field)
end end
end end
end end
...@@ -102,9 +102,10 @@ ...@@ -102,9 +102,10 @@
end end
end end
it 'pushes issue_email_participants feature flag to frontend' do it 'pushes feature flags to frontend' do
visit edit_project_path(project) visit edit_project_path(project)
expect(page).to have_pushed_frontend_feature_flags(issueEmailParticipants: true) expect(page).to have_pushed_frontend_feature_flags(issueEmailParticipants: true)
expect(page).to have_pushed_frontend_feature_flags(serviceDeskTicketsConfidentiality: true)
end end
end end
...@@ -82,7 +82,8 @@ ...@@ -82,7 +82,8 @@
put project_service_desk_path(project, format: :json), params: { put project_service_desk_path(project, format: :json), params: {
issue_template_key: 'service_desk', issue_template_key: 'service_desk',
reopen_issue_on_external_participant_note: true, reopen_issue_on_external_participant_note: true,
add_external_participants_from_cc: true add_external_participants_from_cc: true,
tickets_confidential_by_default: false
} }
settings = project.service_desk_setting settings = project.service_desk_setting
...@@ -90,12 +91,14 @@ ...@@ -90,12 +91,14 @@
expect(settings).to have_attributes( expect(settings).to have_attributes(
issue_template_key: 'service_desk', issue_template_key: 'service_desk',
reopen_issue_on_external_participant_note: true, reopen_issue_on_external_participant_note: true,
add_external_participants_from_cc: true add_external_participants_from_cc: true,
tickets_confidential_by_default: false
) )
expect(json_response).to include( expect(json_response).to include(
'issue_template_key' => 'service_desk', 'issue_template_key' => 'service_desk',
'reopen_issue_on_external_participant_note' => true, 'reopen_issue_on_external_participant_note' => true,
'add_external_participants_from_cc' => true 'add_external_participants_from_cc' => true,
'tickets_confidential_by_default' => false
) )
end end
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
outgoing_name: 'some name', outgoing_name: 'some name',
project_key: 'foo', project_key: 'foo',
reopen_issue_on_external_participant_note: true, reopen_issue_on_external_participant_note: true,
add_external_participants_from_cc: true add_external_participants_from_cc: true,
tickets_confidential_by_default: false
} }
end end
...@@ -30,7 +31,8 @@ ...@@ -30,7 +31,8 @@
outgoing_name: 'some name', outgoing_name: 'some name',
project_key: 'foo', project_key: 'foo',
reopen_issue_on_external_participant_note: true, reopen_issue_on_external_participant_note: true,
add_external_participants_from_cc: true add_external_participants_from_cc: true,
tickets_confidential_by_default: false
) )
end end
...@@ -68,6 +70,23 @@ ...@@ -68,6 +70,23 @@
) )
end end
end end
context 'when service_desk_tickets_confidentiality feature flag is disabled' do
before do
stub_feature_flags(service_desk_tickets_confidentiality: false)
end
it 'updates service desk setting but not tickets_confidential_by_default value' do
response = described_class.new(settings.project, user, params).execute
expect(response).to be_success
expect(settings.reset).to have_attributes(
outgoing_name: 'some name',
project_key: 'foo',
tickets_confidential_by_default: true
)
end
end
end end
context 'when project_key is an empty string' do context 'when project_key is an empty string' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册