summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/components
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 12:09:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 12:09:42 +0000
commit729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch)
treef326420fc64999c6bcc28816ed54f0972fb46459 /app/assets/javascripts/notes/components
parent6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff)
downloadgitlab-ce-729e3765d5feb762df1ccfbc228a8dd4662aa3f9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notes/components')
-rw-r--r--app/assets/javascripts/notes/components/discussion_counter.vue37
1 files changed, 30 insertions, 7 deletions
diff --git a/app/assets/javascripts/notes/components/discussion_counter.vue b/app/assets/javascripts/notes/components/discussion_counter.vue
index 577612de06a..c28ac94b3ed 100644
--- a/app/assets/javascripts/notes/components/discussion_counter.vue
+++ b/app/assets/javascripts/notes/components/discussion_counter.vue
@@ -1,5 +1,5 @@
<script>
-import { mapGetters } from 'vuex';
+import { mapGetters, mapActions } from 'vuex';
import { GlTooltipDirective } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import discussionNavigation from '../mixins/discussion_navigation';
@@ -18,13 +18,11 @@ export default {
'getNoteableData',
'resolvableDiscussionsCount',
'unresolvedDiscussionsCount',
+ 'discussions',
]),
isLoggedIn() {
return this.getUserData.id;
},
- hasNextButton() {
- return this.isLoggedIn && !this.allResolved;
- },
allResolved() {
return this.unresolvedDiscussionsCount === 0;
},
@@ -34,6 +32,21 @@ export default {
resolvedDiscussionsCount() {
return this.resolvableDiscussionsCount - this.unresolvedDiscussionsCount;
},
+ toggeableDiscussions() {
+ return this.discussions.filter(discussion => !discussion.individual_note);
+ },
+ allExpanded() {
+ return this.toggeableDiscussions.every(discussion => discussion.expanded);
+ },
+ },
+ methods: {
+ ...mapActions(['setExpandDiscussions']),
+ handleExpandDiscussions() {
+ this.setExpandDiscussions({
+ discussionIds: this.toggeableDiscussions.map(discussion => discussion.id),
+ expanded: !this.allExpanded,
+ });
+ },
},
};
</script>
@@ -44,8 +57,8 @@ export default {
ref="discussionCounter"
class="line-resolve-all-container full-width-mobile"
>
- <div class="full-width-mobile d-flex d-sm-block">
- <div :class="{ 'has-next-btn': hasNextButton }" class="line-resolve-all">
+ <div class="full-width-mobile d-flex d-sm-flex">
+ <div class="line-resolve-all">
<span
:class="{ 'is-active': allResolved }"
class="line-resolve-btn is-disabled"
@@ -75,7 +88,7 @@ export default {
<div v-if="isLoggedIn && !allResolved" class="btn-group btn-group-sm" role="group">
<button
v-gl-tooltip
- title="Jump to next unresolved thread"
+ :title="__('Jump to next unresolved thread')"
class="btn btn-default discussion-next-btn"
data-track-event="click_button"
data-track-label="mr_next_unresolved_thread"
@@ -85,6 +98,16 @@ export default {
<icon name="comment-next" />
</button>
</div>
+ <div v-if="isLoggedIn" class="btn-group btn-group-sm" role="group">
+ <button
+ v-gl-tooltip
+ :title="__('Toggle all threads')"
+ class="btn btn-default toggle-all-discussions-btn"
+ @click="handleExpandDiscussions"
+ >
+ <icon :name="allExpanded ? 'angle-up' : 'angle-down'" />
+ </button>
+ </div>
</div>
</div>
</template>