fix: hide new post indicator on thread open

This fixes the removal of the new post indicator in the Discussion XBlock once a thread has been opened.
This commit is contained in:
Paul Aswa
2021-03-04 23:46:46 +03:00
committed by Agrendalath
parent d1856c27a1
commit b62478c365
2 changed files with 19 additions and 1 deletions

View File

@@ -154,6 +154,7 @@
});
this.threadView.render();
this.listenTo(this.threadView.showView, 'thread:_delete', this.navigateToAllPosts);
this.$(".forum-nav-thread[data-id='" + threadId + "']").removeClass('never-read');
this.threadListView.$el.addClass('is-hidden');
this.$('.inline-thread').removeClass('is-hidden');
},

View File

@@ -35,6 +35,7 @@
});
createTestView = function(test) {
var testView;
var courseSettings = DiscussionSpecHelper.createTestCourseSettings({
groups: [
{
@@ -62,7 +63,7 @@
children: []
}
});
var testView = new DiscussionInlineView({
testView = new DiscussionInlineView({
el: $('.discussion-module')
});
testView.render();
@@ -234,6 +235,22 @@
// Verify that the individual thread is no longer shown
expect(testView.$('.group-visibility-label').length).toBe(0);
});
it('marks a thread as read once it is opened', function() {
var testView = createTestView(this);
var thread;
showDiscussion(this, testView);
thread = testView.$('.forum-nav-thread');
// The thread is marked as unread.
expect(thread).toHaveClass('never-read');
// Navigate to the thread.
thread.find('.forum-nav-thread-link').click();
// The thread is no longer marked as unread.
expect(thread).not.toHaveClass('never-read');
});
});
});
}());