diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-12 03:08:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-12 03:08:51 +0300 |
commit | 92ab5f89fe0935677ca8b0c78099228f1da192ac (patch) | |
tree | 4b0afa1911e9d1aaefad658f4fbc8e504f20d5c5 /app/assets/javascripts/sidebar | |
parent | d5012fff67191be53070d024a89195a666a581ed (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/sidebar')
3 files changed, 22 insertions, 37 deletions
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 06876546fa4..1eff4db3970 100644 --- a/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue +++ b/app/assets/javascripts/sidebar/components/lock/issuable_lock_form.vue @@ -1,9 +1,8 @@ <script> import { GlIcon, GlTooltipDirective, GlOutsideDirective as Outside } from '@gitlab/ui'; import { mapGetters, mapActions } from 'vuex'; -import { TYPE_ISSUE } from '~/issues/constants'; +import { TYPE_ISSUE, TYPE_MERGE_REQUEST } from '~/issues/constants'; import { __, sprintf } from '~/locale'; -import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { createAlert } from '~/alert'; import toast from '~/vue_shared/plugins/global_toast'; @@ -46,8 +45,10 @@ export default { }, computed: { ...mapGetters(['getNoteableData']), - isMovedMrSidebar() { - return this.glFeatures.movedMrSidebar; + isMergeRequest() { + return ( + this.getNoteableData.targetType === TYPE_MERGE_REQUEST && this.glFeatures.movedMrSidebar + ); }, issuableDisplayName() { const isInIssuePage = this.getNoteableData.targetType === TYPE_ISSUE; @@ -59,6 +60,7 @@ export default { lockStatus() { return this.isLocked ? this.$options.locked : this.$options.unlocked; }, + tooltipLabel() { return this.isLocked ? __('Locked') : __('Unlocked'); }, @@ -87,13 +89,8 @@ export default { fullPath: this.fullPath, }) .then(() => { - if (this.isMovedMrSidebar) { - toast( - sprintf(__('%{issuableDisplayName} %{lockStatus}.'), { - issuableDisplayName: capitalizeFirstCharacter(this.issuableDisplayName), - lockStatus: this.isLocked ? __('locked') : __('unlocked'), - }), - ); + if (this.isMergeRequest) { + toast(this.isLocked ? __('Merge request locked.') : __('Merge request unlocked.')); } }) .catch(() => { @@ -116,14 +113,14 @@ export default { </script> <template> - <li v-if="isMovedMrSidebar" class="gl-dropdown-item"> - <button type="button" class="dropdown-item" data-testid="issuable-lock" @click="toggleLocked"> + <li v-if="isMergeRequest" class="gl-dropdown-item"> + <button type="button" class="dropdown-item" @click="toggleLocked"> <span class="gl-dropdown-item-text-wrapper"> <template v-if="isLocked"> - {{ sprintf(__('Unlock %{issuableType}'), { issuableType: issuableDisplayName }) }} + {{ __('Unlock merge request') }} </template> <template v-else> - {{ sprintf(__('Lock %{issuableType}'), { issuableType: issuableDisplayName }) }} + {{ __('Lock merge request') }} </template> </span> </button> 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 f2b960ed02c..344fa880131 100644 --- a/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue +++ b/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue @@ -1,7 +1,12 @@ <script> import { GlDropdownForm, GlIcon, GlLoadingIcon, GlToggle, GlTooltipDirective } from '@gitlab/ui'; import { createAlert } from '~/alert'; -import { TYPE_EPIC, WORKSPACE_GROUP, WORKSPACE_PROJECT } from '~/issues/constants'; +import { + TYPE_EPIC, + TYPE_MERGE_REQUEST, + WORKSPACE_GROUP, + WORKSPACE_PROJECT, +} from '~/issues/constants'; import { isLoggedIn } from '~/lib/utils/common_utils'; import { __, sprintf } from '~/locale'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; @@ -86,8 +91,8 @@ export default { }, }, computed: { - isMovedMrSidebar() { - return this.glFeatures.movedMrSidebar; + isMergeRequest() { + return this.issuableType === TYPE_MERGE_REQUEST && this.glFeatures.movedMrSidebar; }, isLoading() { return this.$apollo.queries?.subscribed?.loading || this.loading; @@ -143,7 +148,7 @@ export default { }); } - if (this.isMovedMrSidebar) { + if (this.isMergeRequest) { toast(subscribed ? __('Notifications turned on.') : __('Notifications turned off.')); } }, @@ -182,7 +187,7 @@ export default { </script> <template> - <gl-dropdown-form v-if="isMovedMrSidebar" class="gl-dropdown-item"> + <gl-dropdown-form v-if="isMergeRequest" class="gl-dropdown-item"> <div class="gl-px-5 gl-pb-2 gl-pt-1"> <gl-toggle :value="subscribed" diff --git a/app/assets/javascripts/sidebar/mount_sidebar.js b/app/assets/javascripts/sidebar/mount_sidebar.js index 1542c2e441d..2c56dc34701 100644 --- a/app/assets/javascripts/sidebar/mount_sidebar.js +++ b/app/assets/javascripts/sidebar/mount_sidebar.js @@ -17,7 +17,6 @@ import { __ } from '~/locale'; import { apolloProvider } from '~/graphql_shared/issuable_client'; import Translate from '~/vue_shared/translate'; import UserSelect from '~/vue_shared/components/user_select/user_select.vue'; -import NewHeaderActionsPopover from '~/issues/show/components/new_header_actions_popover.vue'; import CollapsedAssigneeList from './components/assignees/collapsed_assignee_list.vue'; import SidebarAssignees from './components/assignees/sidebar_assignees.vue'; import SidebarAssigneesWidget from './components/assignees/sidebar_assignees_widget.vue'; @@ -788,21 +787,6 @@ export function mountAssigneesDropdown() { }); } -function mountNewIssuePopover() { - const el = document.querySelector('.js-sidebar-header-popover'); - - if (!el) { - return null; - } - - return new Vue({ - el, - name: 'NewHeaderActionsPopover', - render: (createElement) => - createElement(NewHeaderActionsPopover, { props: { issueType: TYPE_MERGE_REQUEST } }), - }); -} - const isAssigneesWidgetShown = (isInIssuePage() || isInDesignPage() || isInMRPage()) && gon.features.issueAssigneesWidget; @@ -830,7 +814,6 @@ export function mountSidebar(mediator, store) { mountSidebarSeverityWidget(); mountSidebarEscalationStatus(); mountMoveIssueButton(); - mountNewIssuePopover(); } export { getSidebarOptions }; |