Commit 27471d01 authored by Douwe Maan's avatar Douwe Maan

Don’t depend on unique class.

parent 1c2eefef
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
} }
if (nextUnresolvedDiscussionId) { if (nextUnresolvedDiscussionId) {
$.scrollTo(`.${nextUnresolvedDiscussionId}`, { $.scrollTo(`.discussion[data-discussion-id="${nextUnresolvedDiscussionId}"]`, {
offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight()) offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
}); });
} }
......
...@@ -83,13 +83,13 @@ ...@@ -83,13 +83,13 @@
} }
updateUpdatedHtml(discussionId, data) { updateUpdatedHtml(discussionId, data) {
const $discussionHeadline = $(`.${discussionId} .js-discussion-headline`); const $discussionHeadline = $(`.discussion[data-discussion-id="${discussionId}"] .js-discussion-headline`);
if (data.updated_html) { if (data.discussion_headline_html) {
if ($discussionHeadline.length) { if ($discussionHeadline.length) {
$discussionHeadline.replaceWith(data.updated_html); $discussionHeadline.replaceWith(data.discussion_headline_html);
} else { } else {
$(`.${discussionId} .discussion-header`).append(data.updated_html); $(`.discussion[data-discussion-id="${discussionId}"] .discussion-header`).append(data.discussion_headline_html);
} }
} else { } else {
$discussionHeadline.remove(); $discussionHeadline.remove();
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
= link_to user_path(discussion.author) do = link_to user_path(discussion.author) do
= image_tag avatar_icon(discussion.author), class: "avatar s40" = image_tag avatar_icon(discussion.author), class: "avatar s40"
.timeline-content .timeline-content
.discussion.js-toggle-container{ class: discussion.id } .discussion.js-toggle-container{ class: discussion.id, data: { discussion_id: discussion.id } }
.discussion-header .discussion-header
.discussion-actions .discussion-actions
= link_to "#", class: "note-action-button discussion-toggle-button js-toggle-button" do = link_to "#", class: "note-action-button discussion-toggle-button js-toggle-button" do
......
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