Commit f187ecbd authored by Fatih Acet's avatar Fatih Acet Committed by Alejandro Rodríguez

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
parent ae9d29bc
...@@ -57,14 +57,17 @@ class DiscussionModel { ...@@ -57,14 +57,17 @@ class DiscussionModel {
} }
updateHeadline (data) { 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 (data.discussion_headline_html) {
if ($discussionHeadline.length) { if ($discussionHeadline.length) {
$discussionHeadline.replaceWith(data.discussion_headline_html); $discussionHeadline.replaceWith(data.discussion_headline_html);
} else { } 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 { } else {
$discussionHeadline.remove(); $discussionHeadline.remove();
} }
......
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
gl.diffNotesCompileComponents(); gl.diffNotesCompileComponents();
} }
gl.utils.localTimeAgo($('.js-timeago', note_html), false); gl.utils.localTimeAgo($('.js-timeago'), false);
return this.updateNotesCount(1); return this.updateNotesCount(1);
}; };
......
---
title: Fixed timeago not rendering when resolving a discussion
merge_request:
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment