diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-16 15:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-16 15:09:17 +0300 |
commit | 09dff3eec735ccbe001d165293ecebf195452071 (patch) | |
tree | 03c73077d0703edb9452145e7109835da2cd4918 /app/assets/javascripts/design_management/pages | |
parent | 78e911431fc575ff4f6c9b7e0f95c02b57a5e926 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/design_management/pages')
-rw-r--r-- | app/assets/javascripts/design_management/pages/design/index.vue | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/assets/javascripts/design_management/pages/design/index.vue b/app/assets/javascripts/design_management/pages/design/index.vue index 19bfa123487..48ee7068809 100644 --- a/app/assets/javascripts/design_management/pages/design/index.vue +++ b/app/assets/javascripts/design_management/pages/design/index.vue @@ -1,10 +1,12 @@ <script> import { GlLoadingIcon, GlAlert } from '@gitlab/ui'; +import { isNull } from 'lodash'; import Mousetrap from 'mousetrap'; import { ApolloMutation } from 'vue-apollo'; import { keysFor, ISSUE_CLOSE_DESIGN } from '~/behaviors/shortcuts/keybindings'; import createFlash from '~/flash'; import { fetchPolicies } from '~/lib/graphql'; +import { updateGlobalTodoCount } from '~/vue_shared/components/sidebar/todo_toggle/utils'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import DesignDestroyer from '../../components/design_destroyer.vue'; import DesignReplyForm from '../../components/design_notes/design_reply_form.vue'; @@ -93,6 +95,7 @@ export default { errorMessage: '', scale: DEFAULT_SCALE, resolvedDiscussionsExpanded: false, + prevCurrentUserTodos: null, }; }, apollo: { @@ -163,6 +166,13 @@ export default { resolvedDiscussions() { return this.discussions.filter((discussion) => discussion.resolved); }, + currentUserTodos() { + if (!this.design || !this.design.currentUserTodos) { + return null; + } + + return this.design.currentUserTodos?.nodes?.length; + }, }, watch: { resolvedDiscussions(val) { @@ -170,6 +180,9 @@ export default { this.resolvedDiscussionsExpanded = false; } }, + currentUserTodos(_, prevCurrentUserTodos) { + this.prevCurrentUserTodos = prevCurrentUserTodos; + }, }, mounted() { Mousetrap.bind(keysFor(ISSUE_CLOSE_DESIGN), this.closeDesign); @@ -272,9 +285,14 @@ export default { this.$refs.newDiscussionForm.focusInput(); } }, - closeCommentForm() { + closeCommentForm(data) { this.comment = ''; this.annotationCoordinates = null; + + if (data?.data && !isNull(this.prevCurrentUserTodos)) { + updateGlobalTodoCount(this.currentUserTodos - this.prevCurrentUserTodos); + this.prevCurrentUserTodos = this.currentUserTodos; + } }, closeDesign() { this.$router.push({ |