Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
38365cfa
Commit
38365cfa
authored
Sep 07, 2021
by
Tristan Read
Committed by
Peter Leitzen
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide incident option in issue edit form
* Update issue detail spec to match new permission restriction
parent
2809dd20
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
17 deletions
+79
-17
app/assets/javascripts/issue_show/components/fields/type.vue
app/assets/javascripts/issue_show/components/fields/type.vue
+16
-1
app/assets/javascripts/issue_show/incident.js
app/assets/javascripts/issue_show/incident.js
+4
-1
app/assets/javascripts/issue_show/issue.js
app/assets/javascripts/issue_show/issue.js
+6
-1
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+2
-1
spec/features/issues/issue_detail_spec.rb
spec/features/issues/issue_detail_spec.rb
+51
-13
No files found.
app/assets/javascripts/issue_show/components/fields/type.vue
View file @
38365cfa
...
...
@@ -2,7 +2,7 @@
import
{
GlFormGroup
,
GlDropdown
,
GlDropdownItem
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
capitalize
}
from
'
lodash
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
IssuableTypes
}
from
'
../../constants
'
;
import
{
IssuableTypes
,
IncidentType
}
from
'
../../constants
'
;
import
getIssueStateQuery
from
'
../../queries/get_issue_state.query.graphql
'
;
import
updateIssueStateMutation
from
'
../../queries/update_issue_state.mutation.graphql
'
;
...
...
@@ -19,6 +19,14 @@ export default {
GlDropdown
,
GlDropdownItem
,
},
inject
:
{
canCreateIncident
:
{
default
:
false
,
},
issueType
:
{
default
:
'
issue
'
,
},
},
data
()
{
return
{
issueState
:
{},
...
...
@@ -36,6 +44,9 @@ export default {
}
=
this
;
return
capitalize
(
issueType
);
},
shouldShowIncident
()
{
return
this
.
issueType
===
IncidentType
||
this
.
canCreateIncident
;
},
},
methods
:
{
updateIssueType
(
issueType
)
{
...
...
@@ -47,6 +58,9 @@ export default {
},
});
},
isShown
(
type
)
{
return
type
.
value
!==
IncidentType
||
this
.
shouldShowIncident
;
},
},
};
</
script
>
...
...
@@ -68,6 +82,7 @@ export default {
>
<gl-dropdown-item
v-for=
"type in $options.IssuableTypes"
v-show=
"isShown(type)"
:key=
"type.value"
:is-checked=
"issueState.issueType === type.value"
is-check-item
...
...
app/assets/javascripts/issue_show/incident.js
View file @
38365cfa
...
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
issuableApp
from
'
./components/app.vue
'
;
import
incidentTabs
from
'
./components/incidents/incident_tabs.vue
'
;
import
{
issueState
}
from
'
./constants
'
;
import
{
issueState
,
IncidentType
}
from
'
./constants
'
;
import
apolloProvider
from
'
./graphql
'
;
import
getIssueStateQuery
from
'
./queries/get_issue_state.query.graphql
'
;
...
...
@@ -21,6 +21,7 @@ export default function initIssuableApp(issuableData = {}) {
});
const
{
canCreateIncident
,
canUpdate
,
iid
,
projectNamespace
,
...
...
@@ -39,6 +40,8 @@ export default function initIssuableApp(issuableData = {}) {
issuableApp
,
},
provide
:
{
issueType
:
IncidentType
,
canCreateIncident
,
canUpdate
,
fullPath
,
iid
,
...
...
app/assets/javascripts/issue_show/issue.js
View file @
38365cfa
...
...
@@ -25,17 +25,22 @@ export function initIssuableApp(issuableData, store) {
bootstrapApollo
({
...
issueState
,
issueType
:
el
.
dataset
.
issueType
});
const
{
canCreateIncident
,
...
issuableProps
}
=
issuableData
;
return
new
Vue
({
el
,
apolloProvider
,
store
,
provide
:
{
canCreateIncident
,
},
computed
:
{
...
mapGetters
([
'
getNoteableData
'
]),
},
render
(
createElement
)
{
return
createElement
(
IssuableApp
,
{
props
:
{
...
issuable
Data
,
...
issuable
Props
,
isConfidential
:
this
.
getNoteableData
?.
confidential
,
isLocked
:
this
.
getNoteableData
?.
discussion_locked
,
issuableStatus
:
this
.
getNoteableData
?.
state
,
...
...
app/helpers/issuables_helper.rb
View file @
38365cfa
...
...
@@ -257,7 +257,8 @@ module IssuablesHelper
zoomMeetingUrl:
ZoomMeeting
.
canonical_meeting_url
(
issuable
),
sentryIssueIdentifier:
SentryIssue
.
find_by
(
issue:
issuable
)
&
.
sentry_issue_identifier
,
# rubocop:disable CodeReuse/ActiveRecord
iid:
issuable
.
iid
.
to_s
,
isHidden:
issue_hidden?
(
issuable
)
isHidden:
issue_hidden?
(
issuable
),
canCreateIncident:
create_issue_type_allowed?
(
issuable
.
project
,
:incident
)
}
end
...
...
spec/features/issues/issue_detail_spec.rb
View file @
38365cfa
...
...
@@ -3,8 +3,9 @@
require
'spec_helper'
RSpec
.
describe
'Issue Detail'
,
:js
do
let_it_be_with_refind
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
user
)
}
let
(
:incident
)
{
create
(
:incident
,
project:
project
,
author:
user
)
}
...
...
@@ -90,7 +91,13 @@ RSpec.describe 'Issue Detail', :js do
end
describe
'user updates `issue_type` via the issue type dropdown'
do
context
'when an issue `issue_type` is edited by a signed in user'
do
let_it_be
(
:reporter
)
{
create
(
:user
)
}
before_all
do
project
.
add_reporter
(
reporter
)
end
describe
'when an issue `issue_type` is edited'
do
before
do
sign_in
(
user
)
...
...
@@ -98,18 +105,33 @@ RSpec.describe 'Issue Detail', :js do
wait_for_requests
end
it
'routes the user to the incident details page when the `issue_type` is set to incident'
do
open_issue_edit_form
context
'by non-member author'
do
it
'cannot see Incident option'
do
open_issue_edit_form
page
.
within
(
'[data-testid="issuable-form"]'
)
do
expect
(
page
).
to
have_content
(
'Issue'
)
expect
(
page
).
not_to
have_content
(
'Incident'
)
end
end
end
context
'by reporter'
do
let
(
:user
)
{
reporter
}
page
.
within
(
'[data-testid="issuable-form"]'
)
do
update_type_select
(
'Issue'
,
'Incident'
)
it
'routes the user to the incident details page when the `issue_type` is set to incident'
do
open_issue_edit_form
expect
(
page
).
to
have_current_path
(
project_issues_incident_path
(
project
,
issue
))
page
.
within
(
'[data-testid="issuable-form"]'
)
do
update_type_select
(
'Issue'
,
'Incident'
)
expect
(
page
).
to
have_current_path
(
project_issues_incident_path
(
project
,
issue
))
end
end
end
end
context
'when an incident `issue_type` is edited by a signed in user
'
do
describe
'when an incident `issue_type` is edited
'
do
before
do
sign_in
(
user
)
...
...
@@ -117,13 +139,29 @@ RSpec.describe 'Issue Detail', :js do
wait_for_requests
end
it
'routes the user to the issue details page when the `issue_type` is set to issue'
do
open_issue_edit_form
context
'by non-member author'
do
it
'routes the user to the issue details page when the `issue_type` is set to issue'
do
open_issue_edit_form
page
.
within
(
'[data-testid="issuable-form"]'
)
do
update_type_select
(
'Incident'
,
'Issue'
)
expect
(
page
).
to
have_current_path
(
project_issue_path
(
project
,
incident
))
end
end
end
context
'by reporter'
do
let
(
:user
)
{
reporter
}
it
'routes the user to the issue details page when the `issue_type` is set to issue'
do
open_issue_edit_form
page
.
within
(
'[data-testid="issuable-form"]'
)
do
update_type_select
(
'Incident'
,
'Issue'
)
page
.
within
(
'[data-testid="issuable-form"]'
)
do
update_type_select
(
'Incident'
,
'Issue'
)
expect
(
page
).
to
have_current_path
(
project_issue_path
(
project
,
incident
))
expect
(
page
).
to
have_current_path
(
project_issue_path
(
project
,
incident
))
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment