From 7495140de2b4412240a09d7ee72800a84f57433e Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Fri, 22 Mar 2019 22:33:01 +0800 Subject: [PATCH] Expand discussion when opening link to comment Makes discussion expansion depend on `discussion.expanded` --- .../notes/components/noteable_discussion.vue | 26 +++++-------- .../59352-fix-mr-discussion-expansion.yml | 5 +++ .../user_scrolls_to_note_on_load_spec.rb | 38 ++++++++++++++----- 3 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 changelogs/unreleased/59352-fix-mr-discussion-expansion.yml diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index 0fabbfb06b5..a3d664a738f 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -87,13 +87,10 @@ export default { }, }, data() { - const { diff_discussion: isDiffDiscussion, resolved } = this.discussion; - return { isReplying: false, isResolving: false, resolveAsThread: true, - isRepliesCollapsed: Boolean(!isDiffDiscussion && resolved), }; }, computed: { @@ -178,11 +175,11 @@ export default { return ''; }, - shouldShowDiscussions() { - const { expanded, resolved } = this.discussion; - const isResolvedNonDiffDiscussion = !this.discussion.diff_discussion && resolved; - - return expanded || this.alwaysExpanded || isResolvedNonDiffDiscussion; + isExpanded() { + return this.discussion.expanded || this.alwaysExpanded; + }, + shouldHideDiscussionBody() { + return this.shouldRenderDiffs && !this.isExpanded; }, actionText() { const linkStart = ``; @@ -282,9 +279,6 @@ export default { toggleDiscussionHandler() { this.toggleDiscussion({ discussionId: this.discussion.id }); }, - toggleReplies() { - this.isRepliesCollapsed = !this.isRepliesCollapsed; - }, showReplyForm() { this.isReplying = true; }, @@ -405,7 +399,7 @@ Please check your network connection and try again.`; /> -
+
-