diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/flash.js | 11 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/flash.scss | 16 | ||||
-rw-r--r-- | app/graphql/types/extended_issue_type.rb | 14 | ||||
-rw-r--r-- | app/graphql/types/issue_type.rb | 5 | ||||
-rw-r--r-- | app/graphql/types/project_type.rb | 2 | ||||
-rw-r--r-- | app/presenters/issue_presenter.rb | 4 | ||||
-rw-r--r-- | app/views/layouts/_flash.html.haml | 3 |
7 files changed, 44 insertions, 11 deletions
diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js index 660f0f0ba3e..fc9c5827ed4 100644 --- a/app/assets/javascripts/flash.js +++ b/app/assets/javascripts/flash.js @@ -40,13 +40,17 @@ const createFlashEl = (message, type) => ` <div class="flash-content flash-${type} rounded"> <div class="flash-text"> ${_.escape(message)} - ${spriteIcon('close', 'close-icon')} + <div class="close-icon-wrapper js-close-icon"> + ${spriteIcon('close', 'close-icon')} + </div> </div> </div> `; const removeFlashClickListener = (flashEl, fadeTransition) => { - flashEl.addEventListener('click', () => hideFlash(flashEl, fadeTransition)); + flashEl + .querySelector('.js-close-icon') + .addEventListener('click', () => hideFlash(flashEl, fadeTransition)); }; /* @@ -78,7 +82,6 @@ const createFlash = function createFlash( flashContainer.innerHTML = createFlashEl(message, type); const flashEl = flashContainer.querySelector(`.flash-${type}`); - removeFlashClickListener(flashEl, fadeTransition); if (actionConfig) { flashEl.innerHTML += createAction(actionConfig); @@ -90,6 +93,8 @@ const createFlash = function createFlash( } } + removeFlashClickListener(flashEl, fadeTransition); + flashContainer.style.display = 'block'; if (addBodyClass) document.body.classList.add('flash-shown'); diff --git a/app/assets/stylesheets/framework/flash.scss b/app/assets/stylesheets/framework/flash.scss index 13a2a74fdab..8fc2fd5f53b 100644 --- a/app/assets/stylesheets/framework/flash.scss +++ b/app/assets/stylesheets/framework/flash.scss @@ -1,7 +1,6 @@ $notification-box-shadow-color: rgba(0, 0, 0, 0.25); .flash-container { - cursor: pointer; margin: 0; margin-bottom: $gl-padding; font-size: 14px; @@ -19,12 +18,17 @@ $notification-box-shadow-color: rgba(0, 0, 0, 0.25); } } - .close-icon { - width: 16px; - height: 16px; + .close-icon-wrapper { + padding: ($gl-btn-padding + $gl-padding-4) $gl-padding $gl-btn-padding; position: absolute; - right: $gl-padding; - top: $gl-padding; + right: 0; + top: 0; + cursor: pointer; + + .close-icon { + width: 16px; + height: 16px; + } } .flash-notice, diff --git a/app/graphql/types/extended_issue_type.rb b/app/graphql/types/extended_issue_type.rb new file mode 100644 index 00000000000..e007c1109a3 --- /dev/null +++ b/app/graphql/types/extended_issue_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Types + class ExtendedIssueType < IssueType + graphql_name 'ExtendedIssue' + + authorize :read_issue + expose_permissions Types::PermissionTypes::Issue + present_using IssuePresenter + + field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5, + description: 'Boolean flag for whether the currently logged in user is subscribed to this issue' + end +end diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 09e51ae4bc0..432f3e1255f 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -49,6 +49,11 @@ module Types field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :relative_position, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions + field :epic, ::Types::EpicType, null: true, description: 'The epic to which issue belongs' + field :participants, Types::UserType.connection_type, null: true, complexity: 5, description: 'List of participants for the issue' + field :time_estimate, GraphQL::INT_TYPE, null: false, description: 'The time estimate on the issue' + field :total_time_spent, GraphQL::INT_TYPE, null: false, description: 'Total time reported as spent on the issue' + field :closed_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 7184cf42284..5663f833b7a 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -92,7 +92,7 @@ module Types resolver: Resolvers::IssuesResolver field :issue, # rubocop:disable Graphql/Descriptions - Types::IssueType, + Types::ExtendedIssueType, null: true, resolver: Resolvers::IssuesResolver.single diff --git a/app/presenters/issue_presenter.rb b/app/presenters/issue_presenter.rb index c9dc0dbf443..3d55b00ac3b 100644 --- a/app/presenters/issue_presenter.rb +++ b/app/presenters/issue_presenter.rb @@ -11,6 +11,10 @@ class IssuePresenter < Gitlab::View::Presenter::Delegated url_builder.issue_path(issue) end + def subscribed? + issue.subscribed?(current_user, issue.project) + end + private def url_builder diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml index d673d7164b3..92572f0308c 100644 --- a/app/views/layouts/_flash.html.haml +++ b/app/views/layouts/_flash.html.haml @@ -5,4 +5,5 @@ - if value %div{ class: "flash-content flash-#{key} rounded" } %span= value - = sprite_icon('close', size: 16, css_class: 'close-icon') + %div{ class: "close-icon-wrapper js-close-icon" } + = sprite_icon('close', size: 16, css_class: 'close-icon') |