diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-14 15:09:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-14 15:09:37 +0300 |
commit | b7f103736153a739f0da400eba20a155e0db2797 (patch) | |
tree | ad802e7e9b38bb66decea4639a60fea0982eacc1 /app | |
parent | bbacb6748ab541728ac22ee71eb1ffd3884d2a10 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/tracking/constants.js | 1 | ||||
-rw-r--r-- | app/assets/javascripts/tracking/index.js | 1 | ||||
-rw-r--r-- | app/assets/javascripts/tracking/internal_events.js | 29 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/issuable/show/components/issuable_edit_form.vue | 1 | ||||
-rw-r--r-- | app/controllers/groups/settings/ci_cd_controller.rb | 5 | ||||
-rw-r--r-- | app/finders/work_items/namespace_work_items_finder.rb | 27 | ||||
-rw-r--r-- | app/graphql/resolvers/namespaces/work_items_resolver.rb | 4 | ||||
-rw-r--r-- | app/helpers/integrations_helper.rb | 3 | ||||
-rw-r--r-- | app/models/ci/job_artifact.rb | 10 | ||||
-rw-r--r-- | app/models/work_items/type.rb | 10 | ||||
-rw-r--r-- | app/views/groups/edit.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/edit.html.haml | 2 |
12 files changed, 75 insertions, 20 deletions
diff --git a/app/assets/javascripts/tracking/constants.js b/app/assets/javascripts/tracking/constants.js index d0447fa167c..114587bb363 100644 --- a/app/assets/javascripts/tracking/constants.js +++ b/app/assets/javascripts/tracking/constants.js @@ -20,6 +20,7 @@ export const DEFAULT_SNOWPLOW_OPTIONS = { export const ACTION_ATTR_SELECTOR = '[data-track-action]'; export const LOAD_ACTION_ATTR_SELECTOR = '[data-track-action="render"]'; export const INTERNAL_EVENTS_SELECTOR = '[data-event-tracking]'; +export const LOAD_INTERNAL_EVENTS_SELECTOR = '[data-event-tracking-load="true"]'; export const URLS_CACHE_STORAGE_KEY = 'gl-snowplow-pseudonymized-urls'; diff --git a/app/assets/javascripts/tracking/index.js b/app/assets/javascripts/tracking/index.js index 7c2cd6fde27..ffbd932c02b 100644 --- a/app/assets/javascripts/tracking/index.js +++ b/app/assets/javascripts/tracking/index.js @@ -71,4 +71,5 @@ export function initDefaultTrackers() { Tracking.trackLoadEvents(); InternalEvents.bindInternalEventDocument(); + InternalEvents.trackInternalLoadEvents(); } diff --git a/app/assets/javascripts/tracking/internal_events.js b/app/assets/javascripts/tracking/internal_events.js index 4d9c7761347..a5fbb55ff63 100644 --- a/app/assets/javascripts/tracking/internal_events.js +++ b/app/assets/javascripts/tracking/internal_events.js @@ -1,9 +1,13 @@ import API from '~/api'; import Tracking from './tracking'; -import { GITLAB_INTERNAL_EVENT_CATEGORY, SERVICE_PING_SCHEMA } from './constants'; +import { + GITLAB_INTERNAL_EVENT_CATEGORY, + LOAD_INTERNAL_EVENTS_SELECTOR, + SERVICE_PING_SCHEMA, +} from './constants'; import { Tracker } from './tracker'; -import { InternalEventHandler } from './utils'; +import { InternalEventHandler, createInternalEventPayload } from './utils'; const InternalEvents = { /** @@ -53,6 +57,27 @@ const InternalEvents = { parent.addEventListener(handler.name, handler.func); return handler; }, + /** + * Attaches internal event handlers for load events. + * @param {HTMLElement} parent - element containing event targets + * @returns {Array} + */ + trackInternalLoadEvents(parent = document) { + if (!Tracker.enabled()) { + return []; + } + + const loadEvents = parent.querySelectorAll(LOAD_INTERNAL_EVENTS_SELECTOR); + + loadEvents.forEach((element) => { + const action = createInternalEventPayload(element); + if (action) { + this.track_event(action); + } + }); + + return loadEvents; + }, }; export default InternalEvents; diff --git a/app/assets/javascripts/vue_shared/issuable/show/components/issuable_edit_form.vue b/app/assets/javascripts/vue_shared/issuable/show/components/issuable_edit_form.vue index 387fc5e0d1c..7c3dd5c3623 100644 --- a/app/assets/javascripts/vue_shared/issuable/show/components/issuable_edit_form.vue +++ b/app/assets/javascripts/vue_shared/issuable/show/components/issuable_edit_form.vue @@ -130,7 +130,6 @@ export default { :label="__('Description')" :label-sr-only="!showFieldTitle" label-for="issuable-description" - label-class="gl-pb-0!" class="col-12 gl-px-0 common-note-form" > <markdown-field diff --git a/app/controllers/groups/settings/ci_cd_controller.rb b/app/controllers/groups/settings/ci_cd_controller.rb index b4b2bddcaec..f50cdd2b1de 100644 --- a/app/controllers/groups/settings/ci_cd_controller.rb +++ b/app/controllers/groups/settings/ci_cd_controller.rb @@ -49,7 +49,6 @@ module Groups def define_variables define_ci_variables - define_view_variables end def define_ci_variables @@ -59,10 +58,6 @@ module Groups .map { |variable| variable.present(current_user: current_user) } end - def define_view_variables - @content_class = 'limit-container-width' unless fluid_layout - end - def authorize_admin_group! return render_404 unless can?(current_user, :admin_group, group) end diff --git a/app/finders/work_items/namespace_work_items_finder.rb b/app/finders/work_items/namespace_work_items_finder.rb index 9a59cf836b5..aad99d710b6 100644 --- a/app/finders/work_items/namespace_work_items_finder.rb +++ b/app/finders/work_items/namespace_work_items_finder.rb @@ -2,19 +2,25 @@ module WorkItems class NamespaceWorkItemsFinder < WorkItemsFinder + def initialize(...) + super + + self.parent_param = namespace + end + def execute items = init_collection + items = by_namespace(items) sort(items) end override :with_confidentiality_access_check def with_confidentiality_access_check - return klass.none unless parent && current_user&.can?("read_#{parent.to_ability_name}".to_sym, parent) return model_class.all if params.user_can_see_all_issuables? # Only admins can see hidden issues, so for non-admins, we filter out any hidden issues - issues = model_class.without_hidden.in_namespaces(parent) + issues = model_class.without_hidden return issues.all if params.user_can_see_all_confidential_issues? @@ -22,5 +28,22 @@ module WorkItems issues.with_confidentiality_check(current_user) end + + private + + def by_namespace(items) + if namespace.blank? || !Ability.allowed?(current_user, "read_#{namespace.to_ability_name}".to_sym, namespace) + return klass.none + end + + items.in_namespaces(namespace) + end + + def namespace + return if params[:namespace_id].blank? + + params[:namespace_id].is_a?(Namespace) ? params[:namespace_id] : Namespace.find_by_id(params[:namespace_id]) + end + strong_memoize_attr :namespace end end diff --git a/app/graphql/resolvers/namespaces/work_items_resolver.rb b/app/graphql/resolvers/namespaces/work_items_resolver.rb index c4a2d3886e6..40f4c637a07 100644 --- a/app/graphql/resolvers/namespaces/work_items_resolver.rb +++ b/app/graphql/resolvers/namespaces/work_items_resolver.rb @@ -11,7 +11,9 @@ module Resolvers return unless Feature.enabled?(:namespace_level_work_items) return WorkItem.none if resource_parent.nil? - finder = ::WorkItems::NamespaceWorkItemsFinder.new(current_user, args) + finder = ::WorkItems::NamespaceWorkItemsFinder.new(current_user, args.merge( + namespace_id: resource_parent + )) Gitlab::Graphql::Loaders::IssuableLoader.new(resource_parent, finder).batching_find_all do |q| apply_lookahead(q) diff --git a/app/helpers/integrations_helper.rb b/app/helpers/integrations_helper.rb index 4026d6261c9..645a08bfcc0 100644 --- a/app/helpers/integrations_helper.rb +++ b/app/helpers/integrations_helper.rb @@ -179,7 +179,8 @@ module IntegrationsHelper 'incident' => _('Incident'), 'test_case' => _('Test case'), 'requirement' => _('Requirement'), - 'task' => _('Task') + 'task' => _('Task'), + 'ticket' => _('Service Desk Ticket') } issue_type_i18n_map[issue_type] || issue_type diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 3f9b1986b70..3f9d8f07b06 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -344,10 +344,16 @@ module Ci end def to_deleted_object_attrs(pick_up_at = nil) + final_path_store_dir, final_path_filename = nil + if file_final_path.present? + final_path_store_dir = File.dirname(file_final_path) + final_path_filename = File.basename(file_final_path) + end + { file_store: file_store, - store_dir: file.store_dir.to_s, - file: file_identifier, + store_dir: final_path_store_dir || file.store_dir.to_s, + file: final_path_filename || file_identifier, pick_up_at: pick_up_at || expire_at || Time.current } end diff --git a/app/models/work_items/type.rb b/app/models/work_items/type.rb index 88ab3d6bab0..369ffc660aa 100644 --- a/app/models/work_items/type.rb +++ b/app/models/work_items/type.rb @@ -20,7 +20,8 @@ module WorkItems task: 'Task', objective: 'Objective', key_result: 'Key Result', - epic: 'Epic' + epic: 'Epic', + ticket: 'Ticket' }.freeze # Base types need to exist on the DB on app startup @@ -34,7 +35,8 @@ module WorkItems task: { name: TYPE_NAMES[:task], icon_name: 'issue-type-task', enum_value: 4 }, objective: { name: TYPE_NAMES[:objective], icon_name: 'issue-type-objective', enum_value: 5 }, ## EE-only key_result: { name: TYPE_NAMES[:key_result], icon_name: 'issue-type-keyresult', enum_value: 6 }, ## EE-only - epic: { name: TYPE_NAMES[:epic], icon_name: 'issue-type-epic', enum_value: 7 } ## EE-only + epic: { name: TYPE_NAMES[:epic], icon_name: 'issue-type-epic', enum_value: 7 }, ## EE-only + ticket: { name: TYPE_NAMES[:ticket], icon_name: 'issue-type-issue', enum_value: 8 } }.freeze # A list of types user can change between - both original and new @@ -42,7 +44,7 @@ module WorkItems # where it's possible to switch between issue and incident. CHANGEABLE_BASE_TYPES = %w[issue incident test_case].freeze - WI_TYPES_WITH_CREATED_HEADER = %w[issue incident].freeze + WI_TYPES_WITH_CREATED_HEADER = %w[issue incident ticket].freeze cache_markdown_field :description, pipeline: :single_line @@ -81,7 +83,7 @@ module WorkItems end def self.allowed_types_for_issues - base_types.keys.excluding('task', 'objective', 'key_result', 'epic') + base_types.keys.excluding('task', 'objective', 'key_result', 'epic', 'ticket') end def default? diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index dedff502a87..13aedd6e4e0 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -38,7 +38,7 @@ = s_('GroupSettings|Badges') = render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do = expanded ? _('Collapse') : _('Expand') - %p + %p.gl-text-secondary.gl-mb-0 = s_('GroupSettings|Customize this group\'s badges.') = link_to s_('GroupSettings|What are badges?'), help_page_path('user/project/badges') .settings-content diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index b9149bbd7b3..78878141b80 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -46,7 +46,7 @@ = s_('ProjectSettings|Badges') = render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do = expanded ? _('Collapse') : _('Expand') - %p + %p.gl-text-secondary.gl-mb-0 = s_('ProjectSettings|Customize this project\'s badges.') = link_to s_('ProjectSettings|What are badges?'), help_page_path('user/project/badges') .settings-content |