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
3fca9e93
Commit
3fca9e93
authored
Oct 27, 2020
by
David O'Regan
Committed by
Heinrich Lee Yu
Oct 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update issuable show entry
Allow issuable show entry to be a generic wrapper that can accept any type
parent
b8bbf57d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
225 additions
and
102 deletions
+225
-102
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+6
-1
app/views/projects/incidents/show.html.haml
app/views/projects/incidents/show.html.haml
+6
-1
app/views/projects/issuable/_show.html.haml
app/views/projects/issuable/_show.html.haml
+10
-0
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+2
-99
app/views/shared/issue_type/_details_content.html.haml
app/views/shared/issue_type/_details_content.html.haml
+31
-0
app/views/shared/issue_type/_details_header.html.haml
app/views/shared/issue_type/_details_header.html.haml
+52
-0
app/views/shared/issue_type/_emoji_block.html.haml
app/views/shared/issue_type/_emoji_block.html.haml
+9
-0
app/views/shared/issue_type/_sentry_stack_trace.html.haml
app/views/shared/issue_type/_sentry_stack_trace.html.haml
+4
-0
ee/app/views/projects/issues/_timeline_toggle.html.haml
ee/app/views/projects/issues/_timeline_toggle.html.haml
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/features/incidents/user_views_incident_spec.rb
spec/features/incidents/user_views_incident_spec.rb
+80
-0
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+18
-0
No files found.
app/helpers/issuables_helper.rb
View file @
3fca9e93
...
...
@@ -377,7 +377,12 @@ module IssuablesHelper
end
def
issuable_display_type
(
issuable
)
issuable
.
model_name
.
human
.
downcase
case
issuable
when
Issue
issuable
.
issue_type
.
downcase
when
MergeRequest
issuable
.
model_name
.
human
.
downcase
end
end
def
has_filter_bar_param?
...
...
app/views/projects/incidents/show.html.haml
View file @
3fca9e93
=
render
template:
'projects/issues/show'
-
@content_class
=
"limit-container-width"
unless
fluid_layout
-
add_to_breadcrumbs
_
(
"Incidents"
),
project_incidents_path
(
@project
)
-
breadcrumb_title
@issue
.
to_reference
-
page_title
"
#{
@issue
.
title
}
(
#{
@issue
.
to_reference
}
)"
,
_
(
"Incidents"
)
=
render
'projects/issuable/show'
,
issuable:
@issue
app/views/projects/issuable/_show.html.haml
0 → 100644
View file @
3fca9e93
-
page_description
issuable
.
description_html
-
page_card_attributes
issuable
.
card_attributes
-
if
issuable
.
relocation_target
-
page_canonical_link
issuable
.
relocation_target
.
present
(
current_user:
current_user
).
web_url
=
render_if_exists
"projects/issues/alert_blocked"
,
issue:
issuable
,
current_user:
current_user
=
render
"projects/issues/alert_moved_from_service_desk"
,
issue:
issuable
=
render
'shared/issue_type/details_header'
,
issuable:
issuable
=
render
'shared/issue_type/details_content'
,
issuable:
issuable
app/views/projects/issues/show.html.haml
View file @
3fca9e93
-
@content_class
=
"limit-container-width"
unless
fluid_layout
-
add_to_breadcrumbs
_
(
"Issues"
),
project_issues_path
(
@project
)
-
breadcrumb_title
@issue
.
to_reference
-
page_title
"
#{
@issue
.
title
}
(
#{
@issue
.
to_reference
}
)"
,
_
(
"Issues"
)
-
page_description
@issue
.
description_html
-
page_card_attributes
@issue
.
card_attributes
-
if
@issue
.
relocation_target
-
page_canonical_link
@issue
.
relocation_target
.
present
(
current_user:
current_user
).
web_url
-
if
@issue
.
sentry_issue
.
present?
-
add_page_specific_style
'page_bundles/error_tracking_details'
-
page_title
"
#{
@issue
.
title
}
(
#{
@issue
.
to_reference
}
)"
,
_
(
"Issues"
)
-
can_update_issue
=
can?
(
current_user
,
:update_issue
,
@issue
)
-
can_reopen_issue
=
can?
(
current_user
,
:reopen_issue
,
@issue
)
-
can_report_spam
=
@issue
.
submittable_as_spam_by?
(
current_user
)
-
can_create_issue
=
show_new_issue_link?
(
@project
)
-
related_branches_path
=
related_branches_project_issue_path
(
@project
,
@issue
)
=
render_if_exists
"projects/issues/alert_blocked"
,
issue:
@issue
,
current_user:
current_user
=
render
"projects/issues/alert_moved_from_service_desk"
,
issue:
@issue
.detail-page-header
.detail-page-header-body
.issuable-status-box.status-box.status-box-issue-closed
{
class:
issue_status_visibility
(
@issue
,
status_box: :closed
)
}
=
sprite_icon
(
'mobile-issue-close'
,
css_class:
'd-block d-sm-none'
)
.d-none.d-sm-block
=
issue_closed_text
(
@issue
,
current_user
)
.issuable-status-box.status-box.status-box-open
{
class:
issue_status_visibility
(
@issue
,
status_box: :open
)
}
=
sprite_icon
(
'issue-open-m'
,
css_class:
'd-block d-sm-none'
)
%span
.d-none.d-sm-block
Open
.issuable-meta
#js-issuable-header-warnings
=
issuable_meta
(
@issue
,
@project
,
"Issue"
)
%a
.btn.btn-default.float-right.d-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle
{
href:
"#"
}
=
sprite_icon
(
'chevron-double-lg-left'
)
.detail-page-header-actions.js-issuable-actions.js-issuable-buttons
{
data:
{
"action"
:
"close-reopen"
}
}
.clearfix.issue-btn-group.dropdown
%button
.btn.btn-default.float-left.d-md-none
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
Options
=
icon
(
'caret-down'
)
.dropdown-menu.dropdown-menu-right.d-lg-none
%ul
-
unless
current_user
==
@issue
.
author
%li
=
link_to
'Report abuse'
,
new_abuse_report_path
(
user_id:
@issue
.
author
.
id
,
ref_url:
issue_url
(
@issue
))
-
if
can_update_issue
%li
=
link_to
'Close issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :close
},
format:
'json'
),
class:
"btn-close js-btn-issue-action
#{
issue_button_visibility
(
@issue
,
true
)
}
"
,
title:
'Close issue'
-
if
can_reopen_issue
%li
=
link_to
'Reopen issue'
,
issue_path
(
@issue
,
issue:
{
state_event: :reopen
},
format:
'json'
),
class:
"btn-reopen js-btn-issue-action
#{
issue_button_visibility
(
@issue
,
false
)
}
"
,
title:
'Reopen issue'
-
if
can_report_spam
%li
=
link_to
'Submit as spam'
,
mark_as_spam_project_issue_path
(
@project
,
@issue
),
method: :post
,
class:
'btn-spam'
,
title:
'Submit as spam'
-
if
can_create_issue
-
if
can_update_issue
||
can_report_spam
%li
.divider
%li
=
link_to
'New issue'
,
new_project_issue_path
(
@project
),
id:
'new_issue_link'
=
render
'shared/issuable/close_reopen_button'
,
issuable:
@issue
,
can_update:
can_update_issue
,
can_reopen:
can_reopen_issue
,
warn_before_close:
defined?
(
@issue
.
blocked?
)
&&
@issue
.
blocked?
-
if
can_report_spam
=
link_to
'Submit as spam'
,
mark_as_spam_project_issue_path
(
@project
,
@issue
),
method: :post
,
class:
'd-none d-md-block gl-button btn btn-grouped btn-spam'
,
title:
'Submit as spam'
-
if
can_create_issue
=
link_to
new_project_issue_path
(
@project
),
class:
'd-none d-md-block gl-button btn btn-grouped btn-success btn-inverted'
,
title:
'New issue'
,
id:
'new_issue_link'
do
New issue
.issue-details.issuable-details
.detail-page-description.content-block
#js-issuable-app
{
data:
{
initial:
issuable_initial_data
(
@issue
).
to_json
}
}
.title-container
%h2
.title
=
markdown_field
(
@issue
,
:title
)
-
if
@issue
.
description
.
present?
.description
.md
=
markdown_field
(
@issue
,
:description
)
=
edited_time_ago_with_tooltip
(
@issue
,
placement:
'bottom'
,
html_class:
'issue-edited-ago js-issue-edited-ago'
)
-
if
@issue
.
sentry_issue
.
present?
#js-sentry-error-stack-trace
{
data:
error_details_data
(
@project
,
@issue
.
sentry_issue
.
sentry_issue_identifier
)
}
=
render
'projects/issues/design_management'
=
render_if_exists
'projects/issues/related_issues'
#js-related-merge-requests
{
data:
{
endpoint:
expose_path
(
api_v4_projects_issues_related_merge_requests_path
(
id:
@project
.
id
,
issue_iid:
@issue
.
iid
)),
project_namespace:
@project
.
namespace
.
path
,
project_path:
@project
.
path
}
}
-
if
can?
(
current_user
,
:download_code
,
@project
)
-
add_page_startup_api_call
related_branches_path
#related-branches
{
data:
{
url:
related_branches_path
}
}
-# This element is filled in using JavaScript.
.content-block.emoji-block.emoji-block-sticky
.row.gl-m-0.gl-justify-content-space-between
.js-noteable-awards
=
render
'award_emoji/awards_block'
,
awardable:
@issue
,
inline:
true
.new-branch-col
=
render_if_exists
"projects/issues/timeline_toggle"
,
issue:
@issue
#js-vue-sort-issue-discussions
#js-vue-discussion-filter
{
data:
{
default_filter:
current_user
&
.
notes_filter_for
(
@issue
),
notes_filters:
UserPreference
.
notes_filters
.
to_json
}
}
=
render
'new_branch'
if
show_new_branch_button?
=
render
'projects/issues/discussion'
=
render
'shared/issuable/sidebar'
,
issuable_sidebar:
@issuable_sidebar
,
assignees:
@issue
.
assignees
=
render
'projects/issuable/show'
,
issuable:
@issue
app/views/shared/issue_type/_details_content.html.haml
0 → 100644
View file @
3fca9e93
-
related_branches_path
=
related_branches_project_issue_path
(
@project
,
issuable
)
.issue-details.issuable-details
.detail-page-description.content-block
#js-issuable-app
{
data:
{
initial:
issuable_initial_data
(
issuable
).
to_json
}
}
.title-container
%h2
.title
=
markdown_field
(
issuable
,
:title
)
-
if
issuable
.
description
.
present?
.description
.md
=
markdown_field
(
issuable
,
:description
)
=
edited_time_ago_with_tooltip
(
issuable
,
placement:
'bottom'
,
html_class:
'issue-edited-ago js-issue-edited-ago'
)
=
render
'shared/issue_type/sentry_stack_trace'
,
issuable:
issuable
=
render
'projects/issues/design_management'
=
render_if_exists
'projects/issues/related_issues'
#js-related-merge-requests
{
data:
{
endpoint:
expose_path
(
api_v4_projects_issues_related_merge_requests_path
(
id:
@project
.
id
,
issue_iid:
issuable
.
iid
)),
project_namespace:
@project
.
namespace
.
path
,
project_path:
@project
.
path
}
}
-
if
can?
(
current_user
,
:download_code
,
@project
)
-
add_page_startup_api_call
related_branches_path
#related-branches
{
data:
{
url:
related_branches_path
}
}
-# This element is filled in using JavaScript.
=
render
'shared/issue_type/emoji_block'
,
issuable:
issuable
=
render
'projects/issues/discussion'
=
render
'shared/issuable/sidebar'
,
issuable_sidebar:
@issuable_sidebar
,
assignees:
@issue
.
assignees
app/views/shared/issue_type/_details_header.html.haml
0 → 100644
View file @
3fca9e93
-
can_update_issue
=
can?
(
current_user
,
:update_issue
,
issuable
)
-
can_reopen_issue
=
can?
(
current_user
,
:reopen_issue
,
issuable
)
-
can_report_spam
=
issuable
.
submittable_as_spam_by?
(
current_user
)
-
can_create_issue
=
show_new_issue_link?
(
@project
)
-
display_issuable_type
=
issuable_display_type
(
issuable
)
-
new_issuable_params
=
({
issuable_template:
'incident'
,
issue:
{
issue_type:
'incident'
}
}
if
issuable
.
incident?
)
.detail-page-header
.detail-page-header-body
.issuable-status-box.status-box.status-box-issue-closed
{
class:
issue_status_visibility
(
issuable
,
status_box: :closed
)
}
=
sprite_icon
(
'mobile-issue-close'
,
css_class:
'gl-display-block gl-display-sm-none!'
)
.gl-display-none.gl-display-sm-block
!
=
issue_closed_text
(
issuable
,
current_user
)
.issuable-status-box.status-box.status-box-open
{
class:
issue_status_visibility
(
issuable
,
status_box: :open
)
}
=
sprite_icon
(
'issue-open-m'
,
css_class:
'gl-display-block gl-display-sm-none!'
)
%span
.gl-display-none.gl-display-sm-block
!
=
_
(
'Open'
)
.issuable-meta
#js-issuable-header-warnings
=
issuable_meta
(
issuable
,
@project
,
display_issuable_type
)
%a
.btn.gl-button.btn-default.float-right.gl-display-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle
{
href:
"#"
}
=
sprite_icon
(
'chevron-double-lg-left'
)
.detail-page-header-actions.js-issuable-actions.js-issuable-buttons
{
data:
{
"action"
:
"close-reopen"
}
}
.clearfix.issue-btn-group.dropdown
%button
.btn.gl-button.btn-default.float-left.d-md-none.d-lg-none.d-xl-none
{
type:
"button"
,
data:
{
toggle:
"dropdown"
}
}
=
_
(
'Options'
)
=
icon
(
'caret-down'
)
.dropdown-menu.dropdown-menu-right.d-lg-none.d-xl-none
%ul
-
unless
current_user
==
issuable
.
author
%li
=
link_to
_
(
'Report abuse'
),
new_abuse_report_path
(
user_id:
issuable
.
author
.
id
,
ref_url:
issue_url
(
issuable
))
-
if
can_update_issue
%li
=
link_to
_
(
'Close %{display_issuable_type}'
)
%
{
display_issuable_type:
display_issuable_type
},
issue_path
(
issuable
,
issue:
{
state_event: :close
},
format:
'json'
),
class:
"btn-close js-btn-issue-action
#{
issue_button_visibility
(
issuable
,
true
)
}
"
,
title:
_
(
'Close %{display_issuable_type}'
)
%
{
display_issuable_type:
display_issuable_type
}
-
if
can_reopen_issue
%li
=
link_to
_
(
'Reopen %{display_issuable_type}'
)
%
{
display_issuable_type:
display_issuable_type
},
issue_path
(
issuable
,
issue:
{
state_event: :reopen
},
format:
'json'
),
class:
"btn-reopen js-btn-issue-action
#{
issue_button_visibility
(
issuable
,
false
)
}
"
,
title:
_
(
'Reopen %{display_issuable_type}'
)
%
{
display_issuable_type:
display_issuable_type
}
-
if
can_report_spam
%li
=
link_to
_
(
'Submit as spam'
),
mark_as_spam_project_issue_path
(
@project
,
issuable
),
method: :post
,
class:
'btn-spam'
,
title:
'Submit as spam'
-
if
can_create_issue
-
if
can_update_issue
||
can_report_spam
%li
.divider
%li
=
link_to
_
(
'New %{display_issuable_type}'
)
%
{
display_issuable_type:
display_issuable_type
},
new_project_issue_path
(
@project
,
new_issuable_params
),
id:
'new_%{display_issuable_type}_link'
%
{
display_issuable_type:
display_issuable_type
}
=
render
'shared/issuable/close_reopen_button'
,
issuable:
issuable
,
can_update:
can_update_issue
,
can_reopen:
can_reopen_issue
,
warn_before_close:
defined?
(
issuable
.
blocked?
)
&&
issuable
.
blocked?
-
if
can_report_spam
=
link_to
_
(
'Submit as spam'
),
mark_as_spam_project_issue_path
(
@project
,
issuable
),
method: :post
,
class:
'gl-display-none gl-display-sm-none gl-display-md-block gl-button btn btn-grouped btn-spam'
,
title:
'Submit as spam'
-
if
can_create_issue
=
link_to
new_project_issue_path
(
@project
,
new_issuable_params
),
class:
'gl-display-none gl-display-sm-none gl-display-md-block gl-button btn btn-grouped btn-success btn-inverted'
,
title:
_
(
'New %{display_issuable_type}'
)
%
{
display_issuable_type:
display_issuable_type
},
id:
'new_%{display_issuable_type}_link'
%
{
display_issuable_type:
display_issuable_type
}
do
=
_
(
'New %{display_issuable_type}'
)
%
{
display_issuable_type:
display_issuable_type
}
app/views/shared/issue_type/_emoji_block.html.haml
0 → 100644
View file @
3fca9e93
.content-block.emoji-block.emoji-block-sticky
.row.gl-m-0.gl-justify-content-space-between
.js-noteable-awards
=
render
'award_emoji/awards_block'
,
awardable:
issuable
,
inline:
true
.new-branch-col
=
render_if_exists
"projects/issues/timeline_toggle"
,
issuable:
issuable
#js-vue-sort-issue-discussions
#js-vue-discussion-filter
{
data:
{
default_filter:
current_user
&
.
notes_filter_for
(
issuable
),
notes_filters:
UserPreference
.
notes_filters
.
to_json
}
}
=
render
'new_branch'
if
show_new_branch_button?
app/views/shared/issue_type/_sentry_stack_trace.html.haml
0 → 100644
View file @
3fca9e93
-
return
unless
issuable
.
sentry_issue
.
present?
-
add_page_specific_style
'page_bundles/error_tracking_details'
#js-sentry-error-stack-trace
{
data:
error_details_data
(
@project
,
issuable
.
sentry_issue
.
sentry_issue_identifier
)
}
ee/app/views/projects/issues/_timeline_toggle.html.haml
View file @
3fca9e93
-
if
show_timeline_view_toggle?
(
issue
)
-
if
show_timeline_view_toggle?
(
issu
abl
e
)
#js-incidents-timeline-toggle
locale/gitlab.pot
View file @
3fca9e93
...
...
@@ -17722,6 +17722,9 @@ msgstr ""
msgid "New"
msgstr ""
msgid "New %{display_issuable_type}"
msgstr ""
msgid "New Application"
msgstr ""
...
...
@@ -25466,6 +25469,9 @@ msgstr ""
msgid "Submit a review"
msgstr ""
msgid "Submit as spam"
msgstr ""
msgid "Submit changes"
msgstr ""
...
...
spec/features/incidents/user_views_incident_spec.rb
0 → 100644
View file @
3fca9e93
# frozen_string_literal: true
require
"spec_helper"
RSpec
.
describe
"User views incident"
do
let_it_be
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:incident
)
{
create
(
:incident
,
project:
project
,
description:
"# Description header
\n\n
**Lorem** _ipsum_ dolor sit [amet](https://example.com)"
,
author:
user
)
}
let_it_be
(
:note
)
{
create
(
:note
,
noteable:
incident
,
project:
project
,
author:
user
)
}
before_all
do
project
.
add_developer
(
user
)
end
before
do
sign_in
(
user
)
visit
(
project_issues_incident_path
(
project
,
incident
))
end
it
{
expect
(
page
).
to
have_header_with_correct_id_and_link
(
1
,
"Description header"
,
"description-header"
)
}
it_behaves_like
'page meta description'
,
' Description header Lorem ipsum dolor sit amet'
it
'shows the merge request and incident actions'
,
:aggregate_failures
do
expect
(
page
).
to
have_link
(
'New incident'
)
expect
(
page
).
to
have_button
(
'Create merge request'
)
expect
(
page
).
to
have_link
(
'Close incident'
)
end
context
'when the project is archived'
do
before
do
project
.
update!
(
archived:
true
)
visit
(
project_issues_incident_path
(
project
,
incident
))
end
it
'hides the merge request and incident actions'
,
:aggregate_failures
do
expect
(
page
).
not_to
have_link
(
'New incident'
)
expect
(
page
).
not_to
have_button
(
'Create merge request'
)
expect
(
page
).
not_to
have_link
(
'Close incident'
)
end
end
describe
'user status'
do
subject
{
visit
(
project_issues_incident_path
(
project
,
incident
))
}
context
'when showing status of the author of the incident'
do
it_behaves_like
'showing user status'
do
let
(
:user_with_status
)
{
user
}
end
end
context
'when showing status of a user who commented on an incident'
,
:js
do
it_behaves_like
'showing user status'
do
let
(
:user_with_status
)
{
user
}
end
end
context
'when status message has an emoji'
,
:js
do
let_it_be
(
:message
)
{
'My status with an emoji'
}
let_it_be
(
:message_emoji
)
{
'basketball'
}
let_it_be
(
:status
)
{
create
(
:user_status
,
user:
user
,
emoji:
'smirk'
,
message:
"
#{
message
}
:
#{
message_emoji
}
:"
)
}
it
'correctly renders the emoji'
do
wait_for_requests
tooltip_span
=
page
.
first
(
".user-status-emoji[title^='
#{
message
}
']"
)
tooltip_span
.
hover
wait_for_requests
tooltip
=
page
.
find
(
'.tooltip .tooltip-inner'
)
page
.
within
(
tooltip
)
do
expect
(
page
).
to
have_emoji
(
message_emoji
)
end
end
end
end
end
spec/helpers/issuables_helper_spec.rb
View file @
3fca9e93
...
...
@@ -345,6 +345,24 @@ RSpec.describe IssuablesHelper do
end
end
describe
'#issuable_display_type'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:issuable_type
,
:issuable_display_type
)
do
:issue
|
'issue'
:incident
|
'incident'
:merge_request
|
'merge request'
end
with_them
do
let
(
:issuable
)
{
build_stubbed
(
issuable_type
)
}
subject
{
helper
.
issuable_display_type
(
issuable
)
}
it
{
is_expected
.
to
eq
(
issuable_display_type
)
}
end
end
describe
'#sidebar_milestone_tooltip_label'
do
it
'escapes HTML in the milestone title'
do
milestone
=
build
(
:milestone
,
title:
'<img onerror=alert(1)>'
)
...
...
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