Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ * Show more information of recipients on conversation creation [#7129](https://github.com/diaspora/diaspora/pull/7129) * Update notifications every 5 minutes and when opening the notification dropdown [#6952](https://github.com/diaspora/diaspora/pull/6952) * Show browser notifications when receiving new unread notifications [#6952](https://github.com/diaspora/diaspora/pull/6952) * Only clear comment textarea when comment submission was successful [#7186](https://github.com/diaspora/diaspora/pull/7186) # 0.6.1.0 Loading app/assets/javascripts/app/models/post/interactions.js +1 −2 Original line number Diff line number Diff line Loading @@ -100,12 +100,11 @@ app.models.Post.Interactions = Backbone.Model.extend({ if (options.error) { options.error(); } }).done(function() { self.post.set({participation: true}); self.set({"comments_count": self.get("comments_count") + 1}); self.trigger('change'); //updates after sync if (options.success) { options.success(); } }); this.trigger("change"); //updates count in an eager manner app.instrument("track", "Comment"); }, Loading spec/javascripts/app/models/post/interacations_spec.js +21 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,13 @@ describe("app.models.Post.Interactions", function(){ expect(this.post.get("participation")).toBeTruthy(); }); it("increases the comments count", function() { var commentsCount = this.interactions.get("comments_count"); this.interactions.comment("text"); jasmine.Ajax.requests.mostRecent().respondWith(ajaxSuccess); expect(this.interactions.get("comments_count")).toBe(commentsCount + 1); }); it("triggers a change on the model", function() { spyOn(this.interactions, "trigger"); this.interactions.comment("text"); Loading @@ -237,6 +244,20 @@ describe("app.models.Post.Interactions", function(){ expect(this.post.get("participation")).toBeFalsy(); }); it("doesn't increase the comments count", function() { var commentsCount = this.interactions.get("comments_count"); this.interactions.comment("text"); jasmine.Ajax.requests.mostRecent().respondWith({status: 400}); expect(this.interactions.get("comments_count")).toBe(commentsCount); }); it("doesn't trigger a change on the model", function() { spyOn(this.interactions, "trigger"); this.interactions.comment("text"); jasmine.Ajax.requests.mostRecent().respondWith({status: 400}); expect(this.interactions.trigger).not.toHaveBeenCalledWith("change"); }); it("calls the error function if one is given", function() { var error = jasmine.createSpy(); this.interactions.comment("text", {error: error}); Loading Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ * Show more information of recipients on conversation creation [#7129](https://github.com/diaspora/diaspora/pull/7129) * Update notifications every 5 minutes and when opening the notification dropdown [#6952](https://github.com/diaspora/diaspora/pull/6952) * Show browser notifications when receiving new unread notifications [#6952](https://github.com/diaspora/diaspora/pull/6952) * Only clear comment textarea when comment submission was successful [#7186](https://github.com/diaspora/diaspora/pull/7186) # 0.6.1.0 Loading
app/assets/javascripts/app/models/post/interactions.js +1 −2 Original line number Diff line number Diff line Loading @@ -100,12 +100,11 @@ app.models.Post.Interactions = Backbone.Model.extend({ if (options.error) { options.error(); } }).done(function() { self.post.set({participation: true}); self.set({"comments_count": self.get("comments_count") + 1}); self.trigger('change'); //updates after sync if (options.success) { options.success(); } }); this.trigger("change"); //updates count in an eager manner app.instrument("track", "Comment"); }, Loading
spec/javascripts/app/models/post/interacations_spec.js +21 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,13 @@ describe("app.models.Post.Interactions", function(){ expect(this.post.get("participation")).toBeTruthy(); }); it("increases the comments count", function() { var commentsCount = this.interactions.get("comments_count"); this.interactions.comment("text"); jasmine.Ajax.requests.mostRecent().respondWith(ajaxSuccess); expect(this.interactions.get("comments_count")).toBe(commentsCount + 1); }); it("triggers a change on the model", function() { spyOn(this.interactions, "trigger"); this.interactions.comment("text"); Loading @@ -237,6 +244,20 @@ describe("app.models.Post.Interactions", function(){ expect(this.post.get("participation")).toBeFalsy(); }); it("doesn't increase the comments count", function() { var commentsCount = this.interactions.get("comments_count"); this.interactions.comment("text"); jasmine.Ajax.requests.mostRecent().respondWith({status: 400}); expect(this.interactions.get("comments_count")).toBe(commentsCount); }); it("doesn't trigger a change on the model", function() { spyOn(this.interactions, "trigger"); this.interactions.comment("text"); jasmine.Ajax.requests.mostRecent().respondWith({status: 400}); expect(this.interactions.trigger).not.toHaveBeenCalledWith("change"); }); it("calls the error function if one is given", function() { var error = jasmine.createSpy(); this.interactions.comment("text", {error: error}); Loading