Remove unused post interactions parse method
This commit is contained in:
parent
55349162bd
commit
ad53a43f88
3 changed files with 3 additions and 29 deletions
|
|
@ -14,33 +14,16 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
||||||
this.reshares = new app.collections.Reshares(this.get("reshares"), {post : this.post});
|
this.reshares = new app.collections.Reshares(this.get("reshares"), {post : this.post});
|
||||||
},
|
},
|
||||||
|
|
||||||
parse : function(resp){
|
|
||||||
this.comments.reset(resp.comments);
|
|
||||||
this.likes.reset(resp.likes);
|
|
||||||
this.reshares.reset(resp.reshares);
|
|
||||||
|
|
||||||
var comments = this.comments
|
|
||||||
, likes = this.likes
|
|
||||||
, reshares = this.reshares;
|
|
||||||
|
|
||||||
return {
|
|
||||||
comments : comments,
|
|
||||||
likes : likes,
|
|
||||||
reshares : reshares,
|
|
||||||
fetched : true
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
likesCount : function(){
|
likesCount : function(){
|
||||||
return this.get("fetched") ? this.likes.models.length : this.get("likes_count");
|
return this.get("likes_count");
|
||||||
},
|
},
|
||||||
|
|
||||||
resharesCount : function(){
|
resharesCount : function(){
|
||||||
return this.get("fetched") ? this.reshares.models.length : this.get("reshares_count");
|
return this.get("reshares_count");
|
||||||
},
|
},
|
||||||
|
|
||||||
commentsCount : function(){
|
commentsCount : function(){
|
||||||
return this.get("fetched") ? this.comments.models.length : this.get("comments_count");
|
return this.get("comments_count");
|
||||||
},
|
},
|
||||||
|
|
||||||
userLike : function(){
|
userLike : function(){
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ app.views.SinglePostCommentStream = app.views.CommentStream.extend({
|
||||||
this.CommentView = app.views.ExpandedComment;
|
this.CommentView = app.views.ExpandedComment;
|
||||||
$(window).on('hashchange',this.highlightPermalinkComment);
|
$(window).on('hashchange',this.highlightPermalinkComment);
|
||||||
this.setupBindings();
|
this.setupBindings();
|
||||||
this.model.comments.on("reset", this.render, this);
|
|
||||||
this.model.comments.fetch({success: function() {
|
this.model.comments.fetch({success: function() {
|
||||||
setTimeout(this.highlightPermalinkComment, 0);
|
setTimeout(this.highlightPermalinkComment, 0);
|
||||||
}.bind(this)});
|
}.bind(this)});
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,6 @@ describe("app.views.SinglePostCommentStream", function() {
|
||||||
expect(this.view.CommentView).toBe(app.views.ExpandedComment);
|
expect(this.view.CommentView).toBe(app.views.ExpandedComment);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("calls render when the comments collection has been resetted", function() {
|
|
||||||
spyOn(app.views.SinglePostCommentStream.prototype, "render");
|
|
||||||
this.view.initialize();
|
|
||||||
expect(app.views.SinglePostCommentStream.prototype.render).not.toHaveBeenCalled();
|
|
||||||
this.post.comments.reset();
|
|
||||||
expect(app.views.SinglePostCommentStream.prototype.render).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("calls setupBindings", function() {
|
it("calls setupBindings", function() {
|
||||||
spyOn(app.views.SinglePostCommentStream.prototype, "setupBindings");
|
spyOn(app.views.SinglePostCommentStream.prototype, "setupBindings");
|
||||||
this.view.initialize();
|
this.view.initialize();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue