diff options
Diffstat (limited to 'app/assets/javascripts/issues/show')
4 files changed, 10 insertions, 236 deletions
diff --git a/app/assets/javascripts/issues/show/components/header_actions.vue b/app/assets/javascripts/issues/show/components/header_actions.vue index b929c4dbae0..84def374d13 100644 --- a/app/assets/javascripts/issues/show/components/header_actions.vue +++ b/app/assets/javascripts/issues/show/components/header_actions.vue @@ -2,36 +2,23 @@ import { GlButton, GlDropdown, - GlDropdownDivider, GlDropdownItem, GlLink, GlModal, GlModalDirective, GlTooltipDirective, } from '@gitlab/ui'; -import * as Sentry from '@sentry/browser'; import { mapActions, mapGetters, mapState } from 'vuex'; import { createAlert, VARIANT_SUCCESS } from '~/alert'; import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants'; -import { STATUS_CLOSED, TYPE_INCIDENT, TYPE_ISSUE, IssuableTypeText } from '~/issues/constants'; -import { - ISSUE_STATE_EVENT_CLOSE, - ISSUE_STATE_EVENT_REOPEN, - NEW_ACTIONS_POPOVER_KEY, -} from '~/issues/show/constants'; +import { STATUS_CLOSED, TYPE_INCIDENT, TYPE_ISSUE } from '~/issues/constants'; +import { ISSUE_STATE_EVENT_CLOSE, ISSUE_STATE_EVENT_REOPEN } from '~/issues/show/constants'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; -import { getCookie, parseBoolean, setCookie } from '~/lib/utils/common_utils'; import { visitUrl } from '~/lib/utils/url_utility'; import { s__, __, sprintf } from '~/locale'; import eventHub from '~/notes/event_hub'; import Tracking from '~/tracking'; -import toast from '~/vue_shared/plugins/global_toast'; import AbuseCategorySelector from '~/abuse_reports/components/abuse_category_selector.vue'; -import NewHeaderActionsPopover from '~/issues/show/components/new_header_actions_popover.vue'; -import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; -import IssuableLockForm from '~/sidebar/components/lock/issuable_lock_form.vue'; -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import issueReferenceQuery from '~/sidebar/queries/issue_reference.query.graphql'; import issuesEventHub from '../event_hub'; import promoteToEpicMutation from '../queries/promote_to_epic.mutation.graphql'; import updateIssueMutation from '../queries/update_issue.mutation.graphql'; @@ -57,27 +44,21 @@ export default { 'The issue was successfully promoted to an epic. Redirecting to epic...', ), reportAbuse: __('Report abuse to administrator'), - referenceFetchError: __('An error occurred while fetching reference'), - copyReferenceText: __('Copy reference'), }, components: { DeleteIssueModal, GlButton, GlDropdown, - GlDropdownDivider, GlDropdownItem, GlLink, GlModal, AbuseCategorySelector, - NewHeaderActionsPopover, - SidebarSubscriptionsWidget, - IssuableLockForm, }, directives: { GlModal: GlModalDirective, GlTooltip: GlTooltipDirective, }, - mixins: [trackingMixin, glFeatureFlagMixin()], + mixins: [trackingMixin], inject: { canCreateIssue: { default: false, @@ -124,46 +105,15 @@ export default { reportedFromUrl: { default: '', }, - issuableEmailAddress: { - default: '', - }, - fullPath: { - default: '', - }, }, data() { return { isReportAbuseDrawerOpen: false, }; }, - apollo: { - issuableReference: { - query: issueReferenceQuery, - variables() { - return { - fullPath: this.fullPath, - iid: this.iid, - }; - }, - update(data) { - return data.workspace?.issuable?.reference || ''; - }, - skip() { - return !this.isMrSidebarMoved; - }, - error(error) { - createAlert({ message: this.$options.i18n.referenceFetchError }); - Sentry.captureException(error); - }, - }, - }, computed: { ...mapState(['isToggleStateButtonLoading']), ...mapGetters(['openState', 'getBlockedByIssues']), - ...mapGetters(['getNoteableData']), - isLocked() { - return this.getNoteableData.discussion_locked; - }, isClosed() { return this.openState === STATUS_CLOSED; }, @@ -207,17 +157,6 @@ export default { hasMobileDropdown() { return this.hasDesktopDropdown || this.showToggleIssueStateButton; }, - copyMailAddressText() { - return sprintf(__('Copy %{issueType} email address'), { - issueType: IssuableTypeText[this.issueType], - }); - }, - isMrSidebarMoved() { - return this.glFeatures.movedMrSidebar; - }, - showLockIssueOption() { - return this.isMrSidebarMoved && this.issueType === TYPE_ISSUE; - }, }, created() { eventHub.$on('toggle.issuable.state', this.toggleIssueState); @@ -227,7 +166,6 @@ export default { }, methods: { ...mapActions(['toggleStateButtonLoading']), - ...mapActions(['updateLockedAttribute']), toggleIssueState() { if (!this.isClosed && this.getBlockedByIssues?.length) { this.$refs.blockedByIssuesModal.show(); @@ -306,19 +244,7 @@ export default { edit() { issuesEventHub.$emit('open.form'); }, - dismissPopover() { - if (this.isMrSidebarMoved && !parseBoolean(getCookie(`${NEW_ACTIONS_POPOVER_KEY}`))) { - setCookie(NEW_ACTIONS_POPOVER_KEY, true); - } - }, - copyReference() { - toast(__('Reference copied')); - }, - copyEmailAddress() { - toast(__('Email address copied')); - }, }, - TYPE_ISSUE, }; </script> @@ -333,21 +259,6 @@ export default { data-testid="mobile-dropdown" :loading="isToggleStateButtonLoading" > - <template v-if="isMrSidebarMoved"> - <sidebar-subscriptions-widget - :iid="String(iid)" - :full-path="fullPath" - :issuable-type="$options.TYPE_ISSUE" - data-testid="notification-toggle" - /> - - <gl-dropdown-divider /> - </template> - - <template v-if="showLockIssueOption"> - <issuable-lock-form :is-editable="false" data-testid="lock-issue-toggle" /> - </template> - <gl-dropdown-item v-if="canUpdateIssue" @click="edit"> {{ $options.i18n.edit }} </gl-dropdown-item> @@ -364,21 +275,9 @@ export default { <gl-dropdown-item v-if="canPromoteToEpic" @click="promoteToEpic"> {{ __('Promote to epic') }} </gl-dropdown-item> - <template v-if="isMrSidebarMoved"> - <gl-dropdown-item - :data-clipboard-text="issuableReference" - data-testid="copy-reference" - @click="copyReference" - >{{ $options.i18n.copyReferenceText }}</gl-dropdown-item - > - <gl-dropdown-item - v-if="issuableEmailAddress" - :data-clipboard-text="issuableEmailAddress" - data-testid="copy-email" - @click="copyEmailAddress" - >{{ copyMailAddressText }}</gl-dropdown-item - > - </template> + <gl-dropdown-item v-if="!isIssueAuthor" @click="toggleReportAbuseDrawer(true)"> + {{ $options.i18n.reportAbuse }} + </gl-dropdown-item> <gl-dropdown-item v-if="canReportSpam" :href="submitAsSpamPath" @@ -388,7 +287,6 @@ export default { {{ __('Submit as spam') }} </gl-dropdown-item> <template v-if="canDestroyIssue"> - <gl-dropdown-divider /> <gl-dropdown-item v-gl-modal="$options.deleteModalId" variant="danger" @@ -397,13 +295,6 @@ export default { {{ deleteButtonText }} </gl-dropdown-item> </template> - <gl-dropdown-item - v-if="!isIssueAuthor" - data-testid="report-abuse-item" - @click="toggleReportAbuseDrawer(true)" - > - {{ $options.i18n.reportAbuse }} - </gl-dropdown-item> </gl-dropdown> <gl-button @@ -431,7 +322,6 @@ export default { <gl-dropdown v-if="hasDesktopDropdown" - id="new-actions-header-dropdown" v-gl-tooltip.hover class="gl-display-none gl-sm-display-inline-flex! gl-sm-ml-3" icon="ellipsis_v" @@ -444,19 +334,7 @@ export default { data-testid="desktop-dropdown" no-caret right - @shown="dismissPopover" > - <template v-if="isMrSidebarMoved"> - <sidebar-subscriptions-widget - :iid="String(iid)" - :full-path="fullPath" - :issuable-type="$options.TYPE_ISSUE" - data-testid="notification-toggle" - /> - - <gl-dropdown-divider /> - </template> - <gl-dropdown-item v-if="canCreateIssue" :href="newIssuePath"> {{ newIssueTypeText }} </gl-dropdown-item> @@ -468,24 +346,9 @@ export default { > {{ __('Promote to epic') }} </gl-dropdown-item> - <template v-if="showLockIssueOption"> - <issuable-lock-form :is-editable="false" data-testid="lock-issue-toggle" /> - </template> - <template v-if="isMrSidebarMoved"> - <gl-dropdown-item - :data-clipboard-text="issuableReference" - data-testid="copy-reference" - @click="copyReference" - >{{ $options.i18n.copyReferenceText }}</gl-dropdown-item - > - <gl-dropdown-item - v-if="issuableEmailAddress" - :data-clipboard-text="issuableEmailAddress" - data-testid="copy-email" - @click="copyEmailAddress" - >{{ copyMailAddressText }}</gl-dropdown-item - > - </template> + <gl-dropdown-item v-if="!isIssueAuthor" @click="toggleReportAbuseDrawer(true)"> + {{ $options.i18n.reportAbuse }} + </gl-dropdown-item> <gl-dropdown-item v-if="canReportSpam" :href="submitAsSpamPath" @@ -494,8 +357,8 @@ export default { > {{ __('Submit as spam') }} </gl-dropdown-item> + <template v-if="canDestroyIssue"> - <gl-dropdown-divider /> <gl-dropdown-item v-gl-modal="$options.deleteModalId" variant="danger" @@ -505,16 +368,8 @@ export default { {{ deleteButtonText }} </gl-dropdown-item> </template> - <gl-dropdown-item - v-if="!isIssueAuthor" - data-testid="report-abuse-item" - @click="toggleReportAbuseDrawer(true)" - > - {{ $options.i18n.reportAbuse }} - </gl-dropdown-item> </gl-dropdown> - <new-header-actions-popover v-if="isMrSidebarMoved" :issue-type="issueType" /> <gl-modal ref="blockedByIssuesModal" modal-id="blocked-by-issues-modal" diff --git a/app/assets/javascripts/issues/show/components/new_header_actions_popover.vue b/app/assets/javascripts/issues/show/components/new_header_actions_popover.vue deleted file mode 100644 index 975661c7d32..00000000000 --- a/app/assets/javascripts/issues/show/components/new_header_actions_popover.vue +++ /dev/null @@ -1,77 +0,0 @@ -<script> -import { GlPopover, GlButton } from '@gitlab/ui'; -import { s__, sprintf } from '~/locale'; -import { getCookie, parseBoolean, setCookie } from '~/lib/utils/common_utils'; -import { NEW_ACTIONS_POPOVER_KEY } from '~/issues/show/constants'; -import { IssuableTypeText } from '~/issues/constants'; - -export default { - name: 'NewHeaderActionsPopover', - i18n: { - popoverText: s__( - 'HeaderAction|Notifications and other %{issueType} actions have moved to this menu.', - ), - confirmButtonText: s__('HeaderAction|Okay!'), - }, - components: { - GlPopover, - GlButton, - }, - props: { - issueType: { - type: String, - required: true, - }, - }, - data() { - return { - dismissKey: NEW_ACTIONS_POPOVER_KEY, - popoverDismissed: parseBoolean(getCookie(`${NEW_ACTIONS_POPOVER_KEY}`)), - }; - }, - computed: { - popoverText() { - return sprintf(this.$options.i18n.popoverText, { - issueType: IssuableTypeText[this.issueType], - }); - }, - showPopover() { - return !this.popoverDismissed; - }, - }, - methods: { - dismissPopover() { - this.popoverDismissed = true; - setCookie(this.dismissKey, this.popoverDismissed); - }, - }, -}; -</script> - -<template> - <div> - <gl-popover - v-if="showPopover" - target="new-actions-header-dropdown" - container="viewport" - placement="left" - :show="showPopover" - triggers="manual" - content="text" - :css-classes="['gl-p-2 new-header-popover']" - > - <template #title> - <div class="gl-font-base gl-font-weight-normal"> - {{ popoverText }} - </div> - </template> - <gl-button - data-testid="confirm-button" - variant="confirm" - type="submit" - @click="dismissPopover" - >{{ $options.i18n.confirmButtonText }}</gl-button - > - </gl-popover> - </div> -</template> diff --git a/app/assets/javascripts/issues/show/constants.js b/app/assets/javascripts/issues/show/constants.js index 6320e4ef266..4d8c11f9669 100644 --- a/app/assets/javascripts/issues/show/constants.js +++ b/app/assets/javascripts/issues/show/constants.js @@ -17,5 +17,3 @@ export const issueState = { issueType: undefined, isDirty: false, }; - -export const NEW_ACTIONS_POPOVER_KEY = 'new-actions-popover-viewed'; diff --git a/app/assets/javascripts/issues/show/index.js b/app/assets/javascripts/issues/show/index.js index 100abcbe1e5..e677328cd2e 100644 --- a/app/assets/javascripts/issues/show/index.js +++ b/app/assets/javascripts/issues/show/index.js @@ -174,8 +174,6 @@ export function initHeaderActions(store, type = '') { reportedUserId: parseInt(el.dataset.reportedUserId, 10), reportedFromUrl: el.dataset.reportedFromUrl, submitAsSpamPath: el.dataset.submitAsSpamPath, - issuableEmailAddress: el.dataset.issuableEmailAddress, - fullPath: el.dataset.projectPath, }, render: (createElement) => createElement(HeaderActions), }); |