diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-11-24 18:42:04 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-11-24 18:42:04 +0000 |
commit | ea0684818945fec96b52fa22ce52ea0991abdd4e (patch) | |
tree | d3846c315d1c91a6cfa929f7eb8dc4e35f012640 | |
parent | 1f42395be15579cf81041c5ec03d919bb14e49ca (diff) | |
parent | da553a4f915185f5cc45dfbbe5eba316fe968251 (diff) | |
download | gitlab-ce-ea0684818945fec96b52fa22ce52ea0991abdd4e.tar.gz |
Merge branch 'resolve-discussions-timeago' into 'master'
Fixed resolved discussion timeago not rendering
## What does this MR do?
Initialises the timeago element when a discussion is updated or resolved.
## Screenshots (if relevant)
![Screen_Shot_2016-11-22_at_11.49.22](/uploads/02900cc4de019ac33cd4d59d586629aa/Screen_Shot_2016-11-22_at_11.49.22.png)
## What are the relevant issue numbers?
Closes #24787
See merge request !7656
-rw-r--r-- | app/assets/javascripts/diff_notes/models/discussion.js.es6 | 9 | ||||
-rw-r--r-- | app/assets/javascripts/notes.js | 2 | ||||
-rw-r--r-- | changelogs/unreleased/resolve-discussions-timeago.yml | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/diff_notes/models/discussion.js.es6 b/app/assets/javascripts/diff_notes/models/discussion.js.es6 index 439f55520ef..badcdccc840 100644 --- a/app/assets/javascripts/diff_notes/models/discussion.js.es6 +++ b/app/assets/javascripts/diff_notes/models/discussion.js.es6 @@ -57,14 +57,17 @@ class DiscussionModel { } updateHeadline (data) { - const $discussionHeadline = $(`.discussion[data-discussion-id="${this.id}"] .js-discussion-headline`); + const discussionSelector = `.discussion[data-discussion-id="${this.id}"]`; + const $discussionHeadline = $(`${discussionSelector} .js-discussion-headline`); if (data.discussion_headline_html) { if ($discussionHeadline.length) { $discussionHeadline.replaceWith(data.discussion_headline_html); } else { - $(`.discussion[data-discussion-id="${this.id}"] .discussion-header`).append(data.discussion_headline_html); + $(`${discussionSelector} .discussion-header`).append(data.discussion_headline_html); } + + gl.utils.localTimeAgo($('.js-timeago', `${discussionSelector}`)); } else { $discussionHeadline.remove(); } @@ -74,7 +77,7 @@ class DiscussionModel { if (!this.canResolve) { return false; } - + for (const noteId in this.notes) { const note = this.notes[noteId]; diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index a84c514dac7..47e7b6f831b 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -333,7 +333,7 @@ gl.diffNotesCompileComponents(); } - gl.utils.localTimeAgo($('.js-timeago', note_html), false); + gl.utils.localTimeAgo($('.js-timeago'), false); return this.updateNotesCount(1); }; diff --git a/changelogs/unreleased/resolve-discussions-timeago.yml b/changelogs/unreleased/resolve-discussions-timeago.yml new file mode 100644 index 00000000000..ffedeb93f1d --- /dev/null +++ b/changelogs/unreleased/resolve-discussions-timeago.yml @@ -0,0 +1,4 @@ +--- +title: Fixed timeago not rendering when resolving a discussion +merge_request: +author: |