Commit 68f37b30 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'assign-alerts-permissions-hotfix' into 'master'

Restrict user search to current project

See merge request gitlab-org/gitlab!34649
parents 52eff031 a998728b
...@@ -57,6 +57,10 @@ export default { ...@@ -57,6 +57,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
projectId: {
type: String,
required: true,
},
projectPath: { projectPath: {
type: String, type: String,
required: true, required: true,
...@@ -327,6 +331,7 @@ export default { ...@@ -327,6 +331,7 @@ export default {
</gl-tabs> </gl-tabs>
<alert-sidebar <alert-sidebar
:project-path="projectPath" :project-path="projectPath"
:project-id="projectId"
:alert="alert" :alert="alert"
:sidebar-collapsed="sidebarCollapsed" :sidebar-collapsed="sidebarCollapsed"
@alert-refresh="alertRefresh" @alert-refresh="alertRefresh"
......
...@@ -16,6 +16,10 @@ export default { ...@@ -16,6 +16,10 @@ export default {
type: Boolean, type: Boolean,
required: true, required: true,
}, },
projectId: {
type: String,
required: true,
},
projectPath: { projectPath: {
type: String, type: String,
required: true, required: true,
...@@ -49,6 +53,7 @@ export default { ...@@ -49,6 +53,7 @@ export default {
/> />
<sidebar-assignees <sidebar-assignees
:project-path="projectPath" :project-path="projectPath"
:project-id="projectId"
:alert="alert" :alert="alert"
:sidebar-collapsed="sidebarCollapsed" :sidebar-collapsed="sidebarCollapsed"
@alert-refresh="$emit('alert-refresh')" @alert-refresh="$emit('alert-refresh')"
......
...@@ -38,6 +38,10 @@ export default { ...@@ -38,6 +38,10 @@ export default {
SidebarAssignee, SidebarAssignee,
}, },
props: { props: {
projectId: {
type: String,
required: true,
},
projectPath: { projectPath: {
type: String, type: String,
required: true, required: true,
...@@ -128,7 +132,7 @@ export default { ...@@ -128,7 +132,7 @@ export default {
per_page: 20, per_page: 20,
active: true, active: true,
current_user: true, current_user: true,
project_id: gon?.current_project_id, project_id: this.projectId,
}, },
}) })
.then(({ data }) => { .then(({ data }) => {
......
...@@ -8,7 +8,7 @@ Vue.use(VueApollo); ...@@ -8,7 +8,7 @@ Vue.use(VueApollo);
export default selector => { export default selector => {
const domEl = document.querySelector(selector); const domEl = document.querySelector(selector);
const { alertId, projectPath, projectIssuesPath } = domEl.dataset; const { alertId, projectPath, projectIssuesPath, projectId } = domEl.dataset;
const apolloProvider = new VueApollo({ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient( defaultClient: createDefaultClient(
...@@ -39,6 +39,7 @@ export default selector => { ...@@ -39,6 +39,7 @@ export default selector => {
props: { props: {
alertId, alertId,
projectPath, projectPath,
projectId,
projectIssuesPath, projectIssuesPath,
}, },
}); });
......
...@@ -15,6 +15,7 @@ module Projects::AlertManagementHelper ...@@ -15,6 +15,7 @@ module Projects::AlertManagementHelper
{ {
'alert-id' => alert_id, 'alert-id' => alert_id,
'project-path' => project.full_path, 'project-path' => project.full_path,
'project-id' => project.id,
'project-issues-path' => project_issues_path(project) 'project-issues-path' => project_issues_path(project)
} }
end end
......
---
title: Restrict alert assignee user search to current project in alert management details
merge_request: 34649
author:
type: fixed
...@@ -19,6 +19,7 @@ describe('AlertDetails', () => { ...@@ -19,6 +19,7 @@ describe('AlertDetails', () => {
let mock; let mock;
const projectPath = 'root/alerts'; const projectPath = 'root/alerts';
const projectIssuesPath = 'root/alerts/-/issues'; const projectIssuesPath = 'root/alerts/-/issues';
const projectId = '1';
const findDetailsTable = () => wrapper.find(GlTable); const findDetailsTable = () => wrapper.find(GlTable);
...@@ -28,6 +29,7 @@ describe('AlertDetails', () => { ...@@ -28,6 +29,7 @@ describe('AlertDetails', () => {
alertId: 'alertId', alertId: 'alertId',
projectPath, projectPath,
projectIssuesPath, projectIssuesPath,
projectId,
}, },
data() { data() {
return { alert: { ...mockAlert }, ...data }; return { alert: { ...mockAlert }, ...data };
......
...@@ -33,6 +33,7 @@ describe('Alert Details Sidebar Assignees', () => { ...@@ -33,6 +33,7 @@ describe('Alert Details Sidebar Assignees', () => {
...data, ...data,
sidebarCollapsed, sidebarCollapsed,
projectPath: 'projectPath', projectPath: 'projectPath',
projectId: '1',
}, },
mocks: { mocks: {
$apollo: { $apollo: {
......
...@@ -22,6 +22,7 @@ describe('Alert Details Sidebar', () => { ...@@ -22,6 +22,7 @@ describe('Alert Details Sidebar', () => {
alert, alert,
sidebarCollapsed, sidebarCollapsed,
projectPath: 'projectPath', projectPath: 'projectPath',
projectId: '1',
}, },
stubs, stubs,
}); });
......
...@@ -7,7 +7,8 @@ describe Projects::AlertManagementHelper do ...@@ -7,7 +7,8 @@ describe Projects::AlertManagementHelper do
let_it_be(:project, reload: true) { create(:project) } let_it_be(:project, reload: true) { create(:project) }
let_it_be(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
let_it_be(:project_path) { project.full_path } let(:project_path) { project.full_path }
let(:project_id) { project.id }
describe '#alert_management_data' do describe '#alert_management_data' do
let(:user_can_enable_alert_management) { true } let(:user_can_enable_alert_management) { true }
...@@ -75,6 +76,7 @@ describe Projects::AlertManagementHelper do ...@@ -75,6 +76,7 @@ describe Projects::AlertManagementHelper do
expect(helper.alert_management_detail_data(project, alert_id)).to eq( expect(helper.alert_management_detail_data(project, alert_id)).to eq(
'alert-id' => alert_id, 'alert-id' => alert_id,
'project-path' => project_path, 'project-path' => project_path,
'project-id' => project_id,
'project-issues-path' => issues_path 'project-issues-path' => issues_path
) )
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