diff --git a/app/assets/javascripts/blob/file_template_mediator.js b/app/assets/javascripts/blob/file_template_mediator.js index 35e0fdf53f5..136457c115d 100644 --- a/app/assets/javascripts/blob/file_template_mediator.js +++ b/app/assets/javascripts/blob/file_template_mediator.js @@ -145,7 +145,7 @@ export default class FileTemplateMediator { text: __('Undo'), onClick: (e, toastObj) => { self.restoreFromCache(); - toastObj.goAway(0); + toastObj.hide(); }, }, }); diff --git a/app/assets/javascripts/issuable/components/issuable_by_email.vue b/app/assets/javascripts/issuable/components/issuable_by_email.vue index c659dfef495..48eadec1d5c 100644 --- a/app/assets/javascripts/issuable/components/issuable_by_email.vue +++ b/app/assets/javascripts/issuable/components/issuable_by_email.vue @@ -78,7 +78,7 @@ export default { } = await axios.put(this.resetPath); this.email = newAddress; } catch { - this.$toast.show(__('There was an error when reseting email token.'), { type: 'error' }); + this.$toast.show(__('There was an error when reseting email token.')); } }, cancelHandler() { diff --git a/app/assets/javascripts/notifications/components/custom_notifications_modal.vue b/app/assets/javascripts/notifications/components/custom_notifications_modal.vue index 2b5cff35fc8..7427e39f8fe 100644 --- a/app/assets/javascripts/notifications/components/custom_notifications_modal.vue +++ b/app/assets/javascripts/notifications/components/custom_notifications_modal.vue @@ -73,7 +73,7 @@ export default { this.events = this.buildEvents(events); } catch (error) { - this.$toast.show(this.$options.i18n.loadNotificationLevelErrorMessage, { type: 'error' }); + this.$toast.show(this.$options.i18n.loadNotificationLevelErrorMessage); } finally { this.isLoading = false; } @@ -93,7 +93,7 @@ export default { this.events = this.buildEvents(events); } catch (error) { - this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage, { type: 'error' }); + this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage); } }, }, diff --git a/app/assets/javascripts/notifications/components/notifications_dropdown.vue b/app/assets/javascripts/notifications/components/notifications_dropdown.vue index 4963b9386c1..69eb2115bf4 100644 --- a/app/assets/javascripts/notifications/components/notifications_dropdown.vue +++ b/app/assets/javascripts/notifications/components/notifications_dropdown.vue @@ -104,7 +104,7 @@ export default { this.selectedNotificationLevel = level; this.openNotificationsModal(); } catch (error) { - this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage, { type: 'error' }); + this.$toast.show(this.$options.i18n.updateNotificationLevelErrorMessage); } finally { this.isLoading = false; } diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/terraform_installation.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/terraform_installation.vue index 399a3e086f1..c19ff3b4293 100644 --- a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/terraform_installation.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/terraform_installation.vue @@ -12,16 +12,16 @@ export default { GlSprintf, }, computed: { - ...mapState(['packageEntity', 'terraformHelpPath', 'projectPath']), + ...mapState(['packageEntity', 'terraformHelpPath', 'gitlabHost', 'projectPath']), provisionInstructions() { // eslint-disable-next-line @gitlab/require-i18n-strings return `module "${this.packageEntity.name}" { - source = "${this.projectPath}/${this.packageEntity.name}" + source = "${this.gitlabHost}/${this.projectPath}/${this.packageEntity.name}" version = "${this.packageEntity.version}" }`; }, registrySetup() { - return `credentials "gitlab.com" { + return `credentials "${this.gitlabHost}" { token = "" }`; }, diff --git a/app/assets/javascripts/packages_and_registries/settings/group/components/group_settings_app.vue b/app/assets/javascripts/packages_and_registries/settings/group/components/group_settings_app.vue index 01d4861f5c2..ec3be43196c 100644 --- a/app/assets/javascripts/packages_and_registries/settings/group/components/group_settings_app.vue +++ b/app/assets/javascripts/packages_and_registries/settings/group/components/group_settings_app.vue @@ -86,7 +86,7 @@ export default { this.alertMessage = ERROR_UPDATING_SETTINGS; } else { this.dismissAlert(); - this.$toast.show(SUCCESS_UPDATING_SETTINGS, { type: 'success' }); + this.$toast.show(SUCCESS_UPDATING_SETTINGS); } }) .catch((e) => { diff --git a/app/assets/javascripts/packages_and_registries/settings/project/components/settings_form.vue b/app/assets/javascripts/packages_and_registries/settings/project/components/settings_form.vue index 41be70a3ad5..efdb65265d0 100644 --- a/app/assets/javascripts/packages_and_registries/settings/project/components/settings_form.vue +++ b/app/assets/javascripts/packages_and_registries/settings/project/components/settings_form.vue @@ -158,14 +158,14 @@ export default { .then(({ data }) => { const errorMessage = data?.updateContainerExpirationPolicy?.errors[0]; if (errorMessage) { - this.$toast.show(errorMessage, { type: 'error' }); + this.$toast.show(errorMessage); } else { - this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' }); + this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE); } }) .catch((error) => { this.setApiErrors(error); - this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' }); + this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE); }) .finally(() => { this.mutationLoading = false; diff --git a/app/assets/javascripts/self_monitor/components/self_monitor_form.vue b/app/assets/javascripts/self_monitor/components/self_monitor_form.vue index c608c71714b..4c1f0d892af 100644 --- a/app/assets/javascripts/self_monitor/components/self_monitor_form.vue +++ b/app/assets/javascripts/self_monitor/components/self_monitor_form.vue @@ -82,7 +82,7 @@ export default { text: this.alertContent.actionText, onClick: (_, toastObject) => { this[this.alertContent.actionName](); - toastObject.goAway(0); + toastObject.hide(); }, }, }; diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js b/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js index 9775a9119c6..994ce6a762a 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/constants.js @@ -10,8 +10,11 @@ export const FILTER_CURRENT = 'Current'; export const OPERATOR_IS = '='; export const OPERATOR_IS_TEXT = __('is'); export const OPERATOR_IS_NOT = '!='; +export const OPERATOR_IS_NOT_TEXT = __('is not'); export const OPERATOR_IS_ONLY = [{ value: OPERATOR_IS, description: OPERATOR_IS_TEXT }]; +export const OPERATOR_IS_NOT_ONLY = [{ value: OPERATOR_IS_NOT, description: OPERATOR_IS_NOT_TEXT }]; +export const OPERATOR_IS_AND_IS_NOT = [...OPERATOR_IS_ONLY, ...OPERATOR_IS_NOT_ONLY]; export const DEFAULT_LABEL_NONE = { value: FILTER_NONE, text: __(FILTER_NONE) }; export const DEFAULT_LABEL_ANY = { value: FILTER_ANY, text: __(FILTER_ANY) }; diff --git a/app/assets/javascripts/vue_shared/plugins/global_toast.js b/app/assets/javascripts/vue_shared/plugins/global_toast.js index bfea2bedd40..fb52b31c2c8 100644 --- a/app/assets/javascripts/vue_shared/plugins/global_toast.js +++ b/app/assets/javascripts/vue_shared/plugins/global_toast.js @@ -2,7 +2,7 @@ import { GlToast } from '@gitlab/ui'; import Vue from 'vue'; Vue.use(GlToast); -const instance = new Vue(); +export const instance = new Vue(); export default function showGlobalToast(...args) { return instance.$toast.show(...args); diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 53d80b8be58..24e2dbac560 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -162,6 +162,7 @@ class ProjectsController < Projects::ApplicationController format.atom do load_events + @events = @events.select { |event| event.visible_to_user?(current_user) } render layout: 'xml.atom' end end diff --git a/app/graphql/mutations/concerns/mutations/package_eventable.rb b/app/graphql/mutations/concerns/mutations/package_eventable.rb index 86fd7b9a88a..134e3659125 100644 --- a/app/graphql/mutations/concerns/mutations/package_eventable.rb +++ b/app/graphql/mutations/concerns/mutations/package_eventable.rb @@ -8,7 +8,7 @@ module Mutations def track_event(event, scope) ::Packages::CreateEventService.new(nil, current_user, event_name: event, scope: scope).execute - ::Gitlab::Tracking.event(event.to_s, scope.to_s) + ::Gitlab::Tracking.event(event.to_s, scope.to_s, user: current_user) end end end diff --git a/app/models/event.rb b/app/models/event.rb index 5b755736f47..75067f93782 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -390,16 +390,15 @@ class Event < ApplicationRecord read_snippet: %i[personal_snippet_note? project_snippet_note?], read_milestone: %i[milestone?], read_wiki: %i[wiki_page?], - read_design: %i[design_note? design?] + read_design: %i[design_note? design?], + read_note: %i[note?] } end private def permission_object - if note? - note_target - elsif target_id.present? + if target_id.present? target else project diff --git a/app/models/event_collection.rb b/app/models/event_collection.rb index 4768506b8fa..f799377a15f 100644 --- a/app/models/event_collection.rb +++ b/app/models/event_collection.rb @@ -59,6 +59,7 @@ class EventCollection parents_for_lateral = parents.select(:id).to_sql lateral = filtered_events + # Applying the limit here (before we filter (permissions) means we may get less than limit) .limit(limit_for_join_lateral) .where("events.#{parent_column} = parents_for_lateral.id") # rubocop:disable GitlabSecurity/SqlInjection .to_sql diff --git a/app/views/projects/packages/infrastructure_registry/show.html.haml b/app/views/projects/packages/infrastructure_registry/show.html.haml index e5701343b83..e7c77478170 100644 --- a/app/views/projects/packages/infrastructure_registry/show.html.haml +++ b/app/views/projects/packages/infrastructure_registry/show.html.haml @@ -10,6 +10,7 @@ can_delete: can?(current_user, :destroy_package, @project).to_s, svg_path: image_path('illustrations/no-packages.svg'), project_name: @project.name, - project_path: expose_url(@project.full_path), + project_path: @project.root_ancestor.full_path, + gitlab_host: Gitlab.config.gitlab.host, terraform_help_path: help_page_path('user/infrastructure/index'), project_list_url: project_infrastructure_registry_index_path(@project)} } diff --git a/app/views/shared/issue_type/_details_content.html.haml b/app/views/shared/issue_type/_details_content.html.haml index ceedb5e5c59..0bf002fbbc5 100644 --- a/app/views/shared/issue_type/_details_content.html.haml +++ b/app/views/shared/issue_type/_details_content.html.haml @@ -20,6 +20,9 @@ #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, :admin_feature_flags_issue_links, @project) + = render_if_exists 'projects/issues/related_feature_flags' + - if can?(current_user, :download_code, @project) - add_page_startup_api_call related_branches_path #related-branches{ data: { url: related_branches_path } } diff --git a/doc/operations/feature_flags.md b/doc/operations/feature_flags.md index 4045e46de04..5df787142fd 100644 --- a/doc/operations/feature_flags.md +++ b/doc/operations/feature_flags.md @@ -392,8 +392,10 @@ end > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36617) in GitLab 13.2. > - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/251234) in GitLab 13.5. +> - [Updated](https://gitlab.com/gitlab-org/gitlab/-/issues/220333) in GitLab 14.1 You can link related issues to a feature flag. In the **Linked issues** section, click the `+` button and input the issue reference number or the full URL of the issue. +The issue(s) will then appear in the related feautre flag and vice versa. This feature is similar to the [linked issues](../user/project/issues/related_issues.md) feature. diff --git a/lib/gitlab/database_importers/instance_administrators/create_group.rb b/lib/gitlab/database_importers/instance_administrators/create_group.rb index d9425810405..79244120776 100644 --- a/lib/gitlab/database_importers/instance_administrators/create_group.rb +++ b/lib/gitlab/database_importers/instance_administrators/create_group.rb @@ -89,7 +89,7 @@ module Gitlab end def track_event(result) - ::Gitlab::Tracking.event("instance_administrators_group", "group_created") + ::Gitlab::Tracking.event("instance_administrators_group", "group_created", namespace: result[:group]) success(result) end diff --git a/lib/gitlab/database_importers/self_monitoring/project/create_service.rb b/lib/gitlab/database_importers/self_monitoring/project/create_service.rb index 7607771a451..57d354eb907 100644 --- a/lib/gitlab/database_importers/self_monitoring/project/create_service.rb +++ b/lib/gitlab/database_importers/self_monitoring/project/create_service.rb @@ -118,7 +118,8 @@ module Gitlab end def track_event(result) - ::Gitlab::Tracking.event("self_monitoring", "project_created") + project = result[:project] + ::Gitlab::Tracking.event("self_monitoring", "project_created", project: project, namespace: project.namespace) success(result) end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index e02e41b5aed..62ffb4d976a 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -17027,6 +17027,9 @@ msgstr "" msgid "InProductMarketing|you may %{unsubscribe_link} at any time." msgstr "" +msgid "Inactive" +msgstr "" + msgid "Incident" msgstr "" @@ -26890,6 +26893,9 @@ msgstr "" msgid "Related Issues" msgstr "" +msgid "Related feature flags" +msgstr "" + msgid "Related issues" msgstr "" @@ -32859,6 +32865,9 @@ msgstr "" msgid "There was an error loading merge request approval settings." msgstr "" +msgid "There was an error loading related feature flags" +msgstr "" + msgid "There was an error loading users activity calendar." msgstr "" diff --git a/package.json b/package.json index 20aa85a580c..f6c89a9a8b4 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@gitlab/favicon-overlay": "2.0.0", "@gitlab/svgs": "1.199.0", "@gitlab/tributejs": "1.0.0", - "@gitlab/ui": "29.38.1", + "@gitlab/ui": "30.0.0", "@gitlab/visual-review-tools": "1.6.1", "@rails/actioncable": "6.1.3-2", "@rails/ujs": "6.1.3-2", diff --git a/scripts/review_apps/base-config.yaml b/scripts/review_apps/base-config.yaml index bb4d5392b3b..981a8b51674 100644 --- a/scripts/review_apps/base-config.yaml +++ b/scripts/review_apps/base-config.yaml @@ -23,6 +23,7 @@ gitlab: memory: 1500M persistence: size: 10G + storageClass: ssd gitlab-exporter: enabled: false mailroom: diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index ce229fb861a..17d83054319 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -119,11 +119,6 @@ RSpec.describe ProjectsController do get :activity, params: { namespace_id: project.namespace, id: project, format: :json } expect(json_response['html']).to eq("\n") - end - - it 'filters out invisible event when calculating the count' do - get :activity, params: { namespace_id: project.namespace, id: project, format: :json } - expect(json_response['count']).to eq(0) end end @@ -1484,6 +1479,30 @@ RSpec.describe ProjectsController do end end + context 'GET show.atom' do + let_it_be(:public_project) { create(:project, :public) } + let_it_be(:event) { create(:event, :commented, project: public_project, target: create(:note, project: public_project)) } + let_it_be(:invisible_event) { create(:event, :commented, project: public_project, target: create(:note, :confidential, project: public_project)) } + + it 'filters by calling event.visible_to_user?' do + expect(EventCollection).to receive_message_chain(:new, :to_a).and_return([event, invisible_event]) + expect(event).to receive(:visible_to_user?).and_return(true) + expect(invisible_event).to receive(:visible_to_user?).and_return(false) + + get :show, format: :atom, params: { id: public_project, namespace_id: public_project.namespace } + + expect(response).to render_template('xml.atom') + expect(assigns(:events)).to eq([event]) + end + + it 'filters by calling event.visible_to_user?' do + get :show, format: :atom, params: { id: public_project, namespace_id: public_project.namespace } + + expect(response).to render_template('xml.atom') + expect(assigns(:events)).to eq([event]) + end + end + describe 'GET resolve' do shared_examples 'resolvable endpoint' do it 'redirects to the project page' do diff --git a/spec/features/projects/files/undo_template_spec.rb b/spec/features/projects/files/undo_template_spec.rb index 09ae595490a..560cb53ead2 100644 --- a/spec/features/projects/files/undo_template_spec.rb +++ b/spec/features/projects/files/undo_template_spec.rb @@ -47,11 +47,11 @@ end def check_undo_button_display expect(page).to have_content('template applied') - expect(page).to have_css('.toasted-container') + expect(page).to have_css('.b-toaster') end def check_content_reverted(template_content) - find('.toasted-container a', text: 'Undo').click + find('.b-toaster a', text: 'Undo').click expect(page).not_to have_content(template_content) expect(page).to have_css('.template-type-selector .dropdown-toggle-text') end diff --git a/spec/frontend/emoji/awards_app/store/actions_spec.js b/spec/frontend/emoji/awards_app/store/actions_spec.js index e96920d1112..02b643244d2 100644 --- a/spec/frontend/emoji/awards_app/store/actions_spec.js +++ b/spec/frontend/emoji/awards_app/store/actions_spec.js @@ -5,6 +5,7 @@ import * as actions from '~/emoji/awards_app/store/actions'; import axios from '~/lib/utils/axios_utils'; jest.mock('@sentry/browser'); +jest.mock('~/vue_shared/plugins/global_toast'); describe('Awards app actions', () => { afterEach(() => { diff --git a/spec/frontend/issuable/components/issuable_by_email_spec.js b/spec/frontend/issuable/components/issuable_by_email_spec.js index f11c41fe25d..01abf239e57 100644 --- a/spec/frontend/issuable/components/issuable_by_email_spec.js +++ b/spec/frontend/issuable/components/issuable_by_email_spec.js @@ -154,10 +154,7 @@ describe('IssuableByEmail', () => { await clickResetEmail(); - expect(mockToastShow).toHaveBeenCalledWith( - 'There was an error when reseting email token.', - { type: 'error' }, - ); + expect(mockToastShow).toHaveBeenCalledWith('There was an error when reseting email token.'); expect(findFormInputGroup().props('value')).toBe('user@gitlab.com'); }); }); diff --git a/spec/frontend/notifications/components/custom_notifications_modal_spec.js b/spec/frontend/notifications/components/custom_notifications_modal_spec.js index 5e4114d91f5..0782ec7cdd5 100644 --- a/spec/frontend/notifications/components/custom_notifications_modal_spec.js +++ b/spec/frontend/notifications/components/custom_notifications_modal_spec.js @@ -177,11 +177,8 @@ describe('CustomNotificationsModal', () => { await waitForPromises(); - expect( - mockToastShow, - ).toHaveBeenCalledWith( + expect(mockToastShow).toHaveBeenCalledWith( 'An error occurred while loading the notification settings. Please try again.', - { type: 'error' }, ); }); }); @@ -255,11 +252,8 @@ describe('CustomNotificationsModal', () => { await waitForPromises(); - expect( - mockToastShow, - ).toHaveBeenCalledWith( + expect(mockToastShow).toHaveBeenCalledWith( 'An error occurred while updating the notification settings. Please try again.', - { type: 'error' }, ); }); }); diff --git a/spec/frontend/notifications/components/notifications_dropdown_spec.js b/spec/frontend/notifications/components/notifications_dropdown_spec.js index e90bd68d067..e12251ce6d9 100644 --- a/spec/frontend/notifications/components/notifications_dropdown_spec.js +++ b/spec/frontend/notifications/components/notifications_dropdown_spec.js @@ -242,11 +242,8 @@ describe('NotificationsDropdown', () => { await clickDropdownItemAt(1); expect(wrapper.vm.selectedNotificationLevel).toBe('global'); - expect( - mockToastShow, - ).toHaveBeenCalledWith( + expect(mockToastShow).toHaveBeenCalledWith( 'An error occurred while updating the notification settings. Please try again.', - { type: 'error' }, ); }); diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/__snapshots__/terraform_installation_spec.js.snap b/spec/frontend/packages_and_registries/infrastructure_registry/components/__snapshots__/terraform_installation_spec.js.snap index 427160b45e3..16d148bbea4 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/__snapshots__/terraform_installation_spec.js.snap +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/__snapshots__/terraform_installation_spec.js.snap @@ -11,7 +11,7 @@ exports[`TerraformInstallation renders all the messages 1`] = ` \\" }" label="To authorize access to the Terraform registry:" diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/terraform_installation_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/terraform_installation_spec.js index 7a129794d54..d527587da16 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/terraform_installation_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/terraform_installation_spec.js @@ -13,6 +13,7 @@ describe('TerraformInstallation', () => { const store = new Vuex.Store({ state: { packageEntity, + gitlabHost: 'bar.dev', projectPath: 'foo', }, }); @@ -42,7 +43,7 @@ describe('TerraformInstallation', () => { it('renders the correct command', () => { expect(findCodeInstructions().at(0).props('instruction')).toMatchInlineSnapshot(` "module \\"Test/system-22\\" { - source = \\"foo/Test/system-22\\" + source = \\"bar.dev/foo/Test/system-22\\" version = \\"0.1\\" }" `); @@ -52,7 +53,7 @@ describe('TerraformInstallation', () => { describe('setup commands', () => { it('renders the correct command', () => { expect(findCodeInstructions().at(1).props('instruction')).toMatchInlineSnapshot(` - "credentials \\"gitlab.com\\" { + "credentials \\"bar.dev\\" { token = \\"\\" }" `); diff --git a/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js b/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js index 14ee3f3e3b8..4ee23e15dac 100644 --- a/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js +++ b/spec/frontend/packages_and_registries/settings/group/components/group_settings_app_spec.js @@ -244,9 +244,7 @@ describe('Group Settings App', () => { await waitForPromises(); - expect(show).toHaveBeenCalledWith(SUCCESS_UPDATING_SETTINGS, { - type: 'success', - }); + expect(show).toHaveBeenCalledWith(SUCCESS_UPDATING_SETTINGS); }); it('has an optimistic response', async () => { diff --git a/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js b/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js index 7e5383d7ff1..9e4f61ff820 100644 --- a/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js +++ b/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js @@ -321,9 +321,7 @@ describe('Settings Form', () => { await waitForPromises(); await wrapper.vm.$nextTick(); - expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_SUCCESS_MESSAGE, { - type: 'success', - }); + expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_SUCCESS_MESSAGE); }); describe('when submit fails', () => { @@ -339,9 +337,7 @@ describe('Settings Form', () => { await waitForPromises(); await wrapper.vm.$nextTick(); - expect(wrapper.vm.$toast.show).toHaveBeenCalledWith('foo', { - type: 'error', - }); + expect(wrapper.vm.$toast.show).toHaveBeenCalledWith('foo'); }); }); @@ -355,9 +351,7 @@ describe('Settings Form', () => { await waitForPromises(); await wrapper.vm.$nextTick(); - expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_ERROR_MESSAGE, { - type: 'error', - }); + expect(wrapper.vm.$toast.show).toHaveBeenCalledWith(UPDATE_SETTINGS_ERROR_MESSAGE); }); it('parses the error messages', async () => { diff --git a/spec/frontend/vue_shared/plugins/global_toast_spec.js b/spec/frontend/vue_shared/plugins/global_toast_spec.js index 89f43a5e556..322586a772c 100644 --- a/spec/frontend/vue_shared/plugins/global_toast_spec.js +++ b/spec/frontend/vue_shared/plugins/global_toast_spec.js @@ -1,11 +1,10 @@ -import Vue from 'vue'; -import toast from '~/vue_shared/plugins/global_toast'; +import toast, { instance } from '~/vue_shared/plugins/global_toast'; describe('Global toast', () => { let spyFunc; beforeEach(() => { - spyFunc = jest.spyOn(Vue.prototype.$toast, 'show').mockImplementation(() => {}); + spyFunc = jest.spyOn(instance.$toast, 'show').mockImplementation(() => {}); }); afterEach(() => { @@ -18,7 +17,7 @@ describe('Global toast', () => { toast(arg1, arg2); - expect(Vue.prototype.$toast.show).toHaveBeenCalledTimes(1); - expect(Vue.prototype.$toast.show).toHaveBeenCalledWith(arg1, arg2); + expect(instance.$toast.show).toHaveBeenCalledTimes(1); + expect(instance.$toast.show).toHaveBeenCalledWith(arg1, arg2); }); }); diff --git a/spec/lib/gitlab/database_importers/instance_administrators/create_group_spec.rb b/spec/lib/gitlab/database_importers/instance_administrators/create_group_spec.rb index e70b34d6557..2740664d200 100644 --- a/spec/lib/gitlab/database_importers/instance_administrators/create_group_spec.rb +++ b/spec/lib/gitlab/database_importers/instance_administrators/create_group_spec.rb @@ -56,10 +56,10 @@ RSpec.describe Gitlab::DatabaseImporters::InstanceAdministrators::CreateGroup do it "tracks successful install" do expect(::Gitlab::Tracking).to receive(:event).with( - 'instance_administrators_group', 'group_created' + 'instance_administrators_group', 'group_created', namespace: group ) - result + subject.execute end it 'creates group' do diff --git a/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb b/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb index 56d9514a16a..f5ea660ee1e 100644 --- a/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb +++ b/spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb @@ -86,10 +86,10 @@ RSpec.describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService end it "tracks successful install" do - expect(::Gitlab::Tracking).to receive(:event).twice - expect(::Gitlab::Tracking).to receive(:event).with('self_monitoring', 'project_created') + expect(::Gitlab::Tracking).to receive(:event).with("instance_administrators_group", "group_created", namespace: project.namespace) + expect(::Gitlab::Tracking).to receive(:event).with('self_monitoring', 'project_created', project: project, namespace: project.namespace) - result + subject.execute end it 'creates group' do diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index a440bf684e5..f3ee6f84e53 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -54,6 +54,7 @@ issues: - namespace - note_authors - issue_email_participants +- test_reports events: - author - project diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 949e8ec0a72..f1aeacb86a8 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -268,6 +268,7 @@ RSpec.describe Event do let(:design) { create(:design, issue: issue, project: project) } let(:note_on_commit) { create(:note_on_commit, project: project) } let(:note_on_issue) { create(:note_on_issue, noteable: issue, project: project) } + let(:confidential_note) { create(:note, noteable: issue, project: project, confidential: true) } let(:note_on_confidential_issue) { create(:note_on_issue, noteable: confidential_issue, project: project) } let(:note_on_project_snippet) { create(:note_on_project_snippet, author: author, noteable: project_snippet, project: project) } let(:note_on_personal_snippet) { create(:note_on_personal_snippet, author: author, noteable: personal_snippet, project: nil) } @@ -399,6 +400,16 @@ RSpec.describe Event do include_examples 'visible to assignee and author', true end + context 'confidential note' do + let(:target) { confidential_note } + + include_examples 'visibility examples' do + let(:visibility) { visible_to_none_except(:member) } + end + + include_examples 'visible to author', true + end + context 'private project' do let(:project) { private_project } let(:target) { note_on_issue } diff --git a/yarn.lock b/yarn.lock index 9d00bf1585a..5a50475c0b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -908,13 +908,12 @@ resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8" integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw== -"@gitlab/ui@29.38.1": - version "29.38.1" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-29.38.1.tgz#93ab2ad7cb8008b3050599b452b626c109630e97" - integrity sha512-5sKdbZI9Q9S7KW3/ybN40tFS/KInm76cog8O0SMe2Ne026ZZ18CAHEMvkfoVXTN3XMkWZnMlk92s8f/WqM5//A== +"@gitlab/ui@30.0.0": + version "30.0.0" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-30.0.0.tgz#1f7c4bb2dfa1a987f5673f865384ebcbbe3d7a3e" + integrity sha512-+o8t4TVm8MOV6llX6zq9HKuggRWKuPDZfbmjptNJA0CwW3IGPV/WcgFuSozHW8x2lxE0ZfrD7vMwI0dfTwghwQ== dependencies: "@babel/standalone" "^7.0.0" - "@gitlab/vue-toasted" "^1.3.0" bootstrap-vue "2.18.1" copy-to-clipboard "^3.0.8" dompurify "^2.2.9" @@ -932,11 +931,6 @@ resolved "https://registry.yarnpkg.com/@gitlab/visual-review-tools/-/visual-review-tools-1.6.1.tgz#0d8f3ff9f51b05f7c80b9a107727703d48997e4e" integrity sha512-vY8K1igwZFoEOmU0h4E7XTLlilsQ4ylPr27O01UsSe6ZTKi6oEMREsRAEpNIUgRlxUARCsf+Opp4pgSFzFkFcw== -"@gitlab/vue-toasted@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@gitlab/vue-toasted/-/vue-toasted-1.3.0.tgz#f21550d4ce406ee5f99447a02abf36250ecc922d" - integrity sha512-xexu7YbbIkQS5FDqPaewrOTQ4/myth5VyU8+hWZ+Tj1e5CuAlDNha3dHbvwyLW8/2flm/2mfslFNPAX2DRe8ZQ== - "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"