diff options
Diffstat (limited to 'app/assets/javascripts/sidebar')
26 files changed, 75 insertions, 111 deletions
diff --git a/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue b/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue index 18b26c7d8bd..15fd365b4da 100644 --- a/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue +++ b/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees.vue @@ -1,6 +1,6 @@ <script> import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { __ } from '~/locale'; import eventHub from '~/sidebar/event_hub'; import Store from '~/sidebar/stores/sidebar_store'; @@ -113,7 +113,7 @@ export default { }) .catch(() => { this.loading = false; - return createFlash({ + return createAlert({ message: __('Error occurred when saving assignees'), }); }); diff --git a/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees_widget.vue b/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees_widget.vue index 26fda2a823c..395dcf73693 100644 --- a/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees_widget.vue +++ b/app/assets/javascripts/sidebar/components/assignees/sidebar_assignees_widget.vue @@ -1,7 +1,7 @@ <script> import { GlDropdownItem } from '@gitlab/ui'; import Vue from 'vue'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { IssuableType } from '~/issues/constants'; import { __, n__ } from '~/locale'; import SidebarAssigneesRealtime from '~/sidebar/components/assignees/assignees_realtime.vue'; @@ -111,7 +111,7 @@ export default { } }, error() { - createFlash({ message: __('An error occurred while fetching participants.') }); + createAlert({ message: __('An error occurred while fetching participants.') }); }, }, }, @@ -191,7 +191,7 @@ export default { return data; }) .catch(() => { - createFlash({ message: __('An error occurred while updating assignees.') }); + createAlert({ message: __('An error occurred while updating assignees.') }); }) .finally(() => { this.isSettingAssignees = false; @@ -220,7 +220,7 @@ export default { this.$refs.userSelect.showDropdown(); }, showError() { - createFlash({ message: __('An error occurred while fetching participants.') }); + createAlert({ message: __('An error occurred while fetching participants.') }); }, setDirtyState() { this.isDirty = true; diff --git a/app/assets/javascripts/sidebar/components/assignees/sidebar_participant.vue b/app/assets/javascripts/sidebar/components/assignees/sidebar_participant.vue index 0ed40f56bea..29298ef7627 100644 --- a/app/assets/javascripts/sidebar/components/assignees/sidebar_participant.vue +++ b/app/assets/javascripts/sidebar/components/assignees/sidebar_participant.vue @@ -58,7 +58,7 @@ export default { v-if="hasCannotMergeIcon" name="warning-solid" aria-hidden="true" - class="merge-icon gl-left-6 gl-bottom-0" + class="merge-icon" :size="12" /> </template> diff --git a/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_form.vue b/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_form.vue index c44ce8b0057..3532b75b6e7 100644 --- a/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_form.vue +++ b/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_form.vue @@ -1,6 +1,6 @@ <script> import { GlSprintf, GlButton } from '@gitlab/ui'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { IssuableType } from '~/issues/constants'; import { __, sprintf } from '~/locale'; import { confidentialityQueries } from '~/sidebar/constants'; @@ -92,7 +92,7 @@ export default { }, }) => { if (errors.length) { - createFlash({ + createAlert({ message: errors[0], }); } else { @@ -101,7 +101,7 @@ export default { }, ) .catch(() => { - createFlash({ + createAlert({ message: sprintf( __('Something went wrong while setting %{issuableType} confidentiality.'), { diff --git a/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_widget.vue b/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_widget.vue index f234c5ea3c9..f3bd58c11d4 100644 --- a/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_widget.vue +++ b/app/assets/javascripts/sidebar/components/confidential/sidebar_confidentiality_widget.vue @@ -1,7 +1,7 @@ <script> import produce from 'immer'; import Vue from 'vue'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { __, sprintf } from '~/locale'; import SidebarEditableItem from '~/sidebar/components/sidebar_editable_item.vue'; import { confidentialityQueries, Tracking } from '~/sidebar/constants'; @@ -72,7 +72,7 @@ export default { this.$emit('confidentialityUpdated', data.workspace?.issuable?.confidential); }, error() { - createFlash({ + createAlert({ message: sprintf( __('Something went wrong while setting %{issuableType} confidentiality.'), { diff --git a/app/assets/javascripts/sidebar/components/crm_contacts/crm_contacts.vue b/app/assets/javascripts/sidebar/components/crm_contacts/crm_contacts.vue index 67f36f65b5d..81090bfa062 100644 --- a/app/assets/javascripts/sidebar/components/crm_contacts/crm_contacts.vue +++ b/app/assets/javascripts/sidebar/components/crm_contacts/crm_contacts.vue @@ -1,7 +1,7 @@ <script> import { GlIcon, GlLink, GlPopover, GlTooltipDirective } from '@gitlab/ui'; import { __, n__, sprintf } from '~/locale'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { convertToGraphQLId, getIdFromGraphQLId } from '~/graphql_shared/utils'; import { TYPE_ISSUE } from '~/graphql_shared/constants'; import getIssueCrmContactsQuery from './queries/get_issue_crm_contacts.query.graphql'; @@ -41,7 +41,7 @@ export default { return data?.issue?.customerRelationsContacts?.nodes; }, error(error) { - createFlash({ + createAlert({ message: __('Something went wrong trying to load issue contacts.'), error, captureError: true, diff --git a/app/assets/javascripts/sidebar/components/date/sidebar_date_widget.vue b/app/assets/javascripts/sidebar/components/date/sidebar_date_widget.vue index ef99d540c86..98468583992 100644 --- a/app/assets/javascripts/sidebar/components/date/sidebar_date_widget.vue +++ b/app/assets/javascripts/sidebar/components/date/sidebar_date_widget.vue @@ -1,6 +1,6 @@ <script> import { GlIcon, GlDatepicker, GlTooltipDirective, GlLink, GlPopover } from '@gitlab/ui'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { IssuableType } from '~/issues/constants'; import { dateInWords, formatDate, parsePikadayDate } from '~/lib/utils/datetime_utility'; import { __, sprintf } from '~/locale'; @@ -92,7 +92,7 @@ export default { this.$emit(`${this.dateType}Updated`, data.workspace?.issuable?.[this.dateType]); }, error() { - createFlash({ + createAlert({ message: sprintf( __('Something went wrong while setting %{issuableType} %{dateType} date.'), { @@ -205,7 +205,7 @@ export default { }, }) => { if (errors.length) { - createFlash({ + createAlert({ message: errors[0], }); } else { @@ -214,7 +214,7 @@ export default { }, ) .catch(() => { - createFlash({ + createAlert({ message: sprintf( __('Something went wrong while setting %{issuableType} %{dateType} date.'), { diff --git a/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue b/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue index 8145506f32c..df03af346c0 100644 --- a/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue +++ b/app/assets/javascripts/sidebar/components/lock/edit_form_buttons.vue @@ -2,7 +2,7 @@ import { GlButton } from '@gitlab/ui'; import $ from 'jquery'; import { mapActions } from 'vuex'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { __, sprintf } from '~/locale'; import eventHub from '../../event_hub'; @@ -52,7 +52,7 @@ export default { const flashMessage = __( 'Something went wrong trying to change the locked state of this %{issuableDisplayName}', ); - createFlash({ + createAlert({ message: sprintf(flashMessage, { issuableDisplayName: this.issuableDisplayName }), }); }) diff --git a/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue b/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue index 286bd50f6dd..d32d8a7b044 100644 --- a/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue +++ b/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue @@ -3,7 +3,7 @@ import { GlIcon, GlTooltipDirective, GlOutsideDirective as Outside } from '@gitl import { mapGetters, mapActions } from 'vuex'; import { __, sprintf } from '~/locale'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import eventHub from '~/sidebar/event_hub'; import toast from '~/vue_shared/plugins/global_toast'; import EditForm from './edit_form.vue'; @@ -95,7 +95,7 @@ export default { const flashMessage = __( 'Something went wrong trying to change the locked state of this %{issuableDisplayName}', ); - createFlash({ + createAlert({ message: sprintf(flashMessage, { issuableDisplayName: this.issuableDisplayName }), }); }) diff --git a/app/assets/javascripts/sidebar/components/reviewers/reviewer_title.vue b/app/assets/javascripts/sidebar/components/reviewers/reviewer_title.vue index 933b9b11b40..55bb214aa65 100644 --- a/app/assets/javascripts/sidebar/components/reviewers/reviewer_title.vue +++ b/app/assets/javascripts/sidebar/components/reviewers/reviewer_title.vue @@ -43,6 +43,7 @@ export default { data-track-action="click_edit_button" data-track-label="right_sidebar" data-track-property="reviewer" + data-qa-selector="reviewers_edit_button" > {{ __('Edit') }} </a> diff --git a/app/assets/javascripts/sidebar/components/reviewers/sidebar_reviewers.vue b/app/assets/javascripts/sidebar/components/reviewers/sidebar_reviewers.vue index b0d820ddd15..ad061dd2e6b 100644 --- a/app/assets/javascripts/sidebar/components/reviewers/sidebar_reviewers.vue +++ b/app/assets/javascripts/sidebar/components/reviewers/sidebar_reviewers.vue @@ -3,7 +3,7 @@ // It will soon be overhauled in Issue https://gitlab.com/gitlab-org/gitlab/-/issues/233736 import Vue from 'vue'; import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { __ } from '~/locale'; import eventHub from '~/sidebar/event_hub'; import Store from '~/sidebar/stores/sidebar_store'; @@ -64,7 +64,7 @@ export default { this.initialLoading = false; }, error() { - createFlash({ message: __('An error occurred while fetching reviewers.') }); + createAlert({ message: __('An error occurred while fetching reviewers.') }); }, }, }, @@ -85,7 +85,7 @@ export default { return this.loading || this.$apollo.queries.issuable.loading; }, canUpdate() { - return this.issuable.userPermissions?.updateMergeRequest || false; + return this.issuable.userPermissions?.adminMergeRequest || false; }, }, created() { @@ -120,7 +120,7 @@ export default { }) .catch(() => { this.loading = false; - return createFlash({ + return createAlert({ message: __('Error occurred when saving reviewers'), }); }); diff --git a/app/assets/javascripts/sidebar/components/severity/sidebar_severity.vue b/app/assets/javascripts/sidebar/components/severity/sidebar_severity.vue index a562df4ecd6..f02e0c783e1 100644 --- a/app/assets/javascripts/sidebar/components/severity/sidebar_severity.vue +++ b/app/assets/javascripts/sidebar/components/severity/sidebar_severity.vue @@ -7,7 +7,7 @@ import { GlSprintf, GlButton, } from '@gitlab/ui'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { INCIDENT_SEVERITY, ISSUABLE_TYPES, I18N } from './constants'; import updateIssuableSeverity from './graphql/mutations/update_issuable_severity.mutation.graphql'; import SeverityToken from './severity.vue'; @@ -123,7 +123,7 @@ export default { this.severity = severity; }) .catch(() => - createFlash({ + createAlert({ message: `${this.$options.i18n.UPDATE_SEVERITY_ERROR} ${this.$options.i18n.TRY_AGAIN}`, }), ) diff --git a/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue b/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue index 6c615109bb8..c33b1468ca4 100644 --- a/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue +++ b/app/assets/javascripts/sidebar/components/sidebar_dropdown_widget.vue @@ -13,7 +13,7 @@ import { GlButton, } from '@gitlab/ui'; import { kebabCase, snakeCase } from 'lodash'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { IssuableType } from '~/issues/constants'; import { timeFor } from '~/lib/utils/datetime_utility'; @@ -25,6 +25,8 @@ import { Tracking, IssuableAttributeState, IssuableAttributeType, + LocalizedIssuableAttributeType, + IssuableAttributeTypeKeyMap, issuableAttributesQueries, noAttributeId, defaultEpicSort, @@ -125,7 +127,7 @@ export default { return data?.workspace?.issuable.attribute; }, error(error) { - createFlash({ + createAlert({ message: this.i18n.currentFetchError, captureError: true, error, @@ -179,7 +181,7 @@ export default { return []; }, error(error) { - createFlash({ message: this.i18n.listFetchError, captureError: true, error }); + createAlert({ message: this.i18n.listFetchError, captureError: true, error }); }, }, }, @@ -229,7 +231,9 @@ export default { return timeFor(this.currentAttribute?.dueDate); }, i18n() { - return dropdowni18nText(this.issuableAttribute, this.issuableType); + const localizedAttribute = + LocalizedIssuableAttributeType[IssuableAttributeTypeKeyMap[this.issuableAttribute]]; + return dropdowni18nText(localizedAttribute, this.issuableType); }, isEpic() { // MV to EE https://gitlab.com/gitlab-org/gitlab/-/issues/345311 @@ -280,7 +284,7 @@ export default { }) .then(({ data }) => { if (data.issuableSetAttribute?.errors?.length) { - createFlash({ + createAlert({ message: data.issuableSetAttribute.errors[0], captureError: true, error: data.issuableSetAttribute.errors[0], @@ -290,7 +294,7 @@ export default { } }) .catch((error) => { - createFlash({ message: this.i18n.updateError, captureError: true, error }); + createAlert({ message: this.i18n.updateError, captureError: true, error }); }) .finally(() => { this.updating = false; diff --git a/app/assets/javascripts/sidebar/components/sidebar_editable_item.vue b/app/assets/javascripts/sidebar/components/sidebar_editable_item.vue index cc88812c7b0..1680e42e5e4 100644 --- a/app/assets/javascripts/sidebar/components/sidebar_editable_item.vue +++ b/app/assets/javascripts/sidebar/components/sidebar_editable_item.vue @@ -89,7 +89,9 @@ export default { return; } - this.edit = true; + if (this.canEdit && this.canUpdate) { + this.edit = true; + } this.$emit('open'); window.addEventListener('click', this.collapseWhenOffClick); window.addEventListener('keyup', this.collapseOnEscape); @@ -125,7 +127,7 @@ export default { <template> <div> <div - class="gl-display-flex gl-align-items-center gl-line-height-20 gl-mb-2 gl-text-gray-900 gl-font-weight-bold" + class="gl-display-flex gl-align-items-center gl-line-height-20 gl-text-gray-900 gl-font-weight-bold" @click.self="collapse" > <span class="hide-collapsed" data-testid="title" @click="collapse"> diff --git a/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue b/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue index e5bee4df9b8..99e7c825b72 100644 --- a/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue +++ b/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue @@ -1,6 +1,6 @@ <script> -import { GlIcon, GlLoadingIcon, GlToggle, GlTooltipDirective } from '@gitlab/ui'; -import createFlash from '~/flash'; +import { GlDropdownForm, GlIcon, GlLoadingIcon, GlToggle, GlTooltipDirective } from '@gitlab/ui'; +import { createAlert } from '~/flash'; import { IssuableType } from '~/issues/constants'; import { isLoggedIn } from '~/lib/utils/common_utils'; import { __, sprintf } from '~/locale'; @@ -22,6 +22,7 @@ export default { GlTooltip: GlTooltipDirective, }, components: { + GlDropdownForm, GlIcon, GlLoadingIcon, GlToggle, @@ -73,7 +74,7 @@ export default { this.$emit('subscribedUpdated', data.workspace?.issuable?.subscribed); }, error() { - createFlash({ + createAlert({ message: sprintf( __('Something went wrong while setting %{issuableType} notifications.'), { @@ -137,7 +138,7 @@ export default { }, }) => { if (errors.length) { - createFlash({ + createAlert({ message: errors[0], }); } @@ -148,7 +149,7 @@ export default { }, ) .catch(() => { - createFlash({ + createAlert({ message: sprintf( __('Something went wrong while setting %{issuableType} notifications.'), { @@ -181,7 +182,7 @@ export default { </script> <template> - <div v-if="isMergeRequest" class="gl-new-dropdown-item"> + <gl-dropdown-form v-if="isMergeRequest" class="gl-new-dropdown-item"> <div class="gl-px-5 gl-pb-2 gl-pt-1"> <gl-toggle :value="subscribed" @@ -192,7 +193,7 @@ export default { @change="toggleSubscribed" /> </div> - </div> + </gl-dropdown-form> <sidebar-editable-item v-else ref="editable" diff --git a/app/assets/javascripts/sidebar/components/time_tracking/report.vue b/app/assets/javascripts/sidebar/components/time_tracking/report.vue index d751816bd94..124464088cf 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/report.vue +++ b/app/assets/javascripts/sidebar/components/time_tracking/report.vue @@ -1,6 +1,6 @@ <script> import { GlLoadingIcon, GlTableLite, GlButton, GlTooltipDirective } from '@gitlab/ui'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { TYPE_ISSUE, TYPE_MERGE_REQUEST } from '~/graphql_shared/constants'; import { convertToGraphQLId } from '~/graphql_shared/utils'; import { formatDate, parseSeconds, stringifyTime } from '~/lib/utils/datetime_utility'; @@ -47,7 +47,7 @@ export default { return this.extractTimelogs(data); }, error() { - createFlash({ message: __('Something went wrong. Please try again.') }); + createAlert({ message: __('Something went wrong. Please try again.') }); }, }, }, @@ -105,7 +105,7 @@ export default { } }) .catch((error) => { - createFlash({ + createAlert({ message: s__('TimeTracking|An error occurred while removing the timelog.'), captureError: true, error, diff --git a/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.vue b/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.vue index d472b67d976..62b05421884 100644 --- a/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.vue +++ b/app/assets/javascripts/sidebar/components/time_tracking/sidebar_time_tracking.vue @@ -61,7 +61,7 @@ export default { </script> <template> - <div class="block"> + <div class="block time-tracking"> <issuable-time-tracker :full-path="fullPath" :issuable-id="issuableId" diff --git a/app/assets/javascripts/sidebar/components/todo_toggle/sidebar_todo_widget.vue b/app/assets/javascripts/sidebar/components/todo_toggle/sidebar_todo_widget.vue index 42e16aae312..5da2d65723a 100644 --- a/app/assets/javascripts/sidebar/components/todo_toggle/sidebar_todo_widget.vue +++ b/app/assets/javascripts/sidebar/components/todo_toggle/sidebar_todo_widget.vue @@ -1,7 +1,7 @@ <script> import { GlButton, GlIcon, GlTooltipDirective } from '@gitlab/ui'; import { produce } from 'immer'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { __, sprintf } from '~/locale'; import { todoQueries, TodoMutationTypes, todoMutations } from '~/sidebar/constants'; import { todoLabel } from '~/vue_shared/components/sidebar/todo_toggle//utils'; @@ -73,7 +73,7 @@ export default { this.$emit('todoUpdated', currentUserTodos.length > 0); }, error() { - createFlash({ + createAlert({ message: sprintf(__('Something went wrong while setting %{issuableType} to-do item.'), { issuableType: this.issuableType, }), @@ -155,7 +155,7 @@ export default { }, }) => { if (errors.length) { - createFlash({ + createAlert({ message: errors[0], }); } @@ -166,7 +166,7 @@ export default { }, ) .catch(() => { - createFlash({ + createAlert({ message: sprintf(__('Something went wrong while setting %{issuableType} to-do item.'), { issuableType: this.issuableType, }), diff --git a/app/assets/javascripts/sidebar/constants.js b/app/assets/javascripts/sidebar/constants.js index 60cb4cff727..6248bcb8e2d 100644 --- a/app/assets/javascripts/sidebar/constants.js +++ b/app/assets/javascripts/sidebar/constants.js @@ -1,3 +1,4 @@ +import { invert } from 'lodash'; import { s__, __, sprintf } from '~/locale'; import updateIssueLabelsMutation from '~/boards/graphql/issue_set_labels.mutation.graphql'; import userSearchQuery from '~/graphql_shared/queries/users_search.query.graphql'; @@ -251,6 +252,12 @@ export const IssuableAttributeType = { Milestone: 'milestone', }; +export const LocalizedIssuableAttributeType = { + Milestone: s__('Issuable|milestone'), +}; + +export const IssuableAttributeTypeKeyMap = invert(IssuableAttributeType); + export const IssuableAttributeState = { [IssuableAttributeType.Milestone]: 'active', }; diff --git a/app/assets/javascripts/sidebar/lib/sidebar_move_issue.js b/app/assets/javascripts/sidebar/lib/sidebar_move_issue.js index 5a3122e83d0..2cce27df598 100644 --- a/app/assets/javascripts/sidebar/lib/sidebar_move_issue.js +++ b/app/assets/javascripts/sidebar/lib/sidebar_move_issue.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import { escape } from 'lodash'; import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { __ } from '~/locale'; function isValidProjectId(id) { @@ -44,7 +44,7 @@ class SidebarMoveIssue { .fetchAutocompleteProjects(searchTerm) .then(callback) .catch(() => - createFlash({ + createAlert({ message: __('An error occurred while fetching projects autocomplete.'), }), ); @@ -79,7 +79,7 @@ class SidebarMoveIssue { this.$confirmButton.disable().addClass('is-loading'); this.mediator.moveIssue().catch(() => { - createFlash({ message: __('An error occurred while moving the issue.') }); + createAlert({ message: __('An error occurred while moving the issue.') }); this.$confirmButton.enable().removeClass('is-loading'); }); } diff --git a/app/assets/javascripts/sidebar/mount_sidebar.js b/app/assets/javascripts/sidebar/mount_sidebar.js index 1cb3c30b9e0..9b5bad710dd 100644 --- a/app/assets/javascripts/sidebar/mount_sidebar.js +++ b/app/assets/javascripts/sidebar/mount_sidebar.js @@ -161,7 +161,7 @@ function mountAssigneesComponent() { fullPath, issuableType, issuableId: id, - allowMultipleAssignees: !el.dataset.maxAssignees, + allowMultipleAssignees: !el.dataset.maxAssignees || el.dataset.maxAssignees > 1, editable, }, scopedSlots: { diff --git a/app/assets/javascripts/sidebar/queries/epic_participants.query.graphql b/app/assets/javascripts/sidebar/queries/epic_participants.query.graphql index d665ca1e084..71ce58fb9cc 100644 --- a/app/assets/javascripts/sidebar/queries/epic_participants.query.graphql +++ b/app/assets/javascripts/sidebar/queries/epic_participants.query.graphql @@ -1,5 +1,4 @@ #import "~/graphql_shared/fragments/user.fragment.graphql" -#import "~/graphql_shared/fragments/user_availability.fragment.graphql" query epicParticipants($fullPath: ID!, $iid: ID) { workspace: group(fullPath: $fullPath) { @@ -9,7 +8,6 @@ query epicParticipants($fullPath: ID!, $iid: ID) { participants { nodes { ...User - ...UserAvailability } } } diff --git a/app/assets/javascripts/sidebar/queries/sidebar_details.query.graphql b/app/assets/javascripts/sidebar/queries/sidebar_details.query.graphql deleted file mode 100644 index 90d1a7794ea..00000000000 --- a/app/assets/javascripts/sidebar/queries/sidebar_details.query.graphql +++ /dev/null @@ -1,9 +0,0 @@ -query sidebarDetails($fullPath: ID!, $iid: String!) { - project(fullPath: $fullPath) { - id - issue(iid: $iid) { - id - iid - } - } -} diff --git a/app/assets/javascripts/sidebar/queries/sidebar_details_mr.query.graphql b/app/assets/javascripts/sidebar/queries/sidebar_details_mr.query.graphql deleted file mode 100644 index 0505f88773d..00000000000 --- a/app/assets/javascripts/sidebar/queries/sidebar_details_mr.query.graphql +++ /dev/null @@ -1,9 +0,0 @@ -query mergeRequestSidebarDetails($fullPath: ID!, $iid: String!) { - project(fullPath: $fullPath) { - id - mergeRequest(iid: $iid) { - id - iid # currently unused. - } - } -} diff --git a/app/assets/javascripts/sidebar/services/sidebar_service.js b/app/assets/javascripts/sidebar/services/sidebar_service.js index beacdeb559c..00d3177b75a 100644 --- a/app/assets/javascripts/sidebar/services/sidebar_service.js +++ b/app/assets/javascripts/sidebar/services/sidebar_service.js @@ -1,15 +1,8 @@ -import sidebarDetailsIssueQuery from 'ee_else_ce/sidebar/queries/sidebar_details.query.graphql'; import { TYPE_USER } from '~/graphql_shared/constants'; import { convertToGraphQLId } from '~/graphql_shared/utils'; import createGqClient, { fetchPolicies } from '~/lib/graphql'; import axios from '~/lib/utils/axios_utils'; import reviewerRereviewMutation from '../queries/reviewer_rereview.mutation.graphql'; -import sidebarDetailsMRQuery from '../queries/sidebar_details_mr.query.graphql'; - -const queries = { - merge_request: sidebarDetailsMRQuery, - issue: sidebarDetailsIssueQuery, -}; export const gqClient = createGqClient( {}, @@ -36,37 +29,13 @@ export default class SidebarService { } get() { - return Promise.all([ - axios.get(this.endpoint), - gqClient.query({ - query: this.sidebarDetailsQuery(), - variables: { - fullPath: this.fullPath, - iid: this.iid.toString(), - }, - }), - ]); - } - - sidebarDetailsQuery() { - return queries[this.issuableType]; + return axios.get(this.endpoint); } update(key, data) { return axios.put(this.endpoint, { [key]: data }); } - updateWithGraphQl(mutation, variables) { - return gqClient.mutate({ - mutation, - variables: { - ...variables, - projectPath: this.fullPath, - iid: this.iid.toString(), - }, - }); - } - getProjectsAutocomplete(searchTerm) { return axios.get(this.projectsAutocompleteEndpoint, { params: { diff --git a/app/assets/javascripts/sidebar/sidebar_mediator.js b/app/assets/javascripts/sidebar/sidebar_mediator.js index f7c93b6903c..912f0fdcbef 100644 --- a/app/assets/javascripts/sidebar/sidebar_mediator.js +++ b/app/assets/javascripts/sidebar/sidebar_mediator.js @@ -1,5 +1,5 @@ import Store from '~/sidebar/stores/sidebar_store'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { __ } from '~/locale'; import toast from '~/vue_shared/plugins/global_toast'; import { visitUrl } from '../lib/utils/url_utility'; @@ -93,11 +93,11 @@ export default class SidebarMediator { fetch() { return this.service .get() - .then(([restResponse, graphQlResponse]) => { - this.processFetchedData(restResponse.data, graphQlResponse.data); + .then(({ data }) => { + this.processFetchedData(data); }) .catch(() => - createFlash({ + createAlert({ message: __('Error occurred when fetching sidebar data'), }), ); |