Fix missing timeagos for comments in the single post view
This commit is contained in:
parent
17949ffb4e
commit
6ae2df2f9e
2 changed files with 11 additions and 1 deletions
|
|
@ -118,7 +118,8 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
// on post ownership in the Comment view.
|
// on post ownership in the Comment view.
|
||||||
comment.set({parent : this.model.toJSON()});
|
comment.set({parent : this.model.toJSON()});
|
||||||
|
|
||||||
var commentHtml = new this.CommentView({model: comment}).render().el;
|
var commentView = new this.CommentView({model: comment});
|
||||||
|
var commentHtml = commentView.render().el;
|
||||||
var commentBlocks = this.$(".comments div.comment.media");
|
var commentBlocks = this.$(".comments div.comment.media");
|
||||||
this._moveInsertPoint(comment.get("created_at"), commentBlocks);
|
this._moveInsertPoint(comment.get("created_at"), commentBlocks);
|
||||||
if (this._insertPoint >= commentBlocks.length) {
|
if (this._insertPoint >= commentBlocks.length) {
|
||||||
|
|
@ -128,6 +129,7 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
} else {
|
} else {
|
||||||
commentBlocks.eq(this._insertPoint).before(commentHtml);
|
commentBlocks.eq(this._insertPoint).before(commentHtml);
|
||||||
}
|
}
|
||||||
|
commentView.renderPluginWidgets();
|
||||||
},
|
},
|
||||||
|
|
||||||
removeComment: function(comment) {
|
removeComment: function(comment) {
|
||||||
|
|
|
||||||
|
|
@ -267,6 +267,14 @@ describe("app.views.CommentStream", function(){
|
||||||
expect(this.view.$(".comments div.comment.media").length).toEqual(6);
|
expect(this.view.$(".comments div.comment.media").length).toEqual(6);
|
||||||
expect(this.view.$(".comments div.comment.media div.comment-content p").text()).toEqual("123456");
|
expect(this.view.$(".comments div.comment.media div.comment-content p").text()).toEqual("123456");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("calls renderPluginWidgets", function() {
|
||||||
|
var comment = factory.comment();
|
||||||
|
this.view.CommentView = app.views.Comment;
|
||||||
|
spyOn(app.views.Comment.prototype, "renderPluginWidgets");
|
||||||
|
this.view.appendComment(comment);
|
||||||
|
expect(app.views.Comment.prototype.renderPluginWidgets).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("removeComment", function() {
|
describe("removeComment", function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue