Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ ## Refactor ## Bug fixes * Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167) ## Features Loading app/assets/javascripts/app/collections/reshares.js +4 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ app.collections.Reshares = Backbone.Collection.extend({ model: app.models.Reshare, url : "/reshares" initialize: function(models, options) { this.url = "/posts/" + options.post.id + "/reshares"; } }); // @license-end app/assets/javascripts/app/models/post/interactions.js +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ app.models.Post.Interactions = Backbone.Model.extend({ self.post.set({participation: true}); self.trigger("change"); self.set({"likes_count" : self.get("likes_count") + 1}); self.likes.trigger("change"); }, error: function() { app.flashMessages.error(Diaspora.I18n.t("failed_to_like")); Loading @@ -84,6 +85,7 @@ app.models.Post.Interactions = Backbone.Model.extend({ this.userLike().destroy({success : function() { self.trigger('change'); self.set({"likes_count" : self.get("likes_count") - 1}); self.likes.trigger("change"); }}); app.instrument("track", "Unlike"); Loading Loading @@ -116,6 +118,8 @@ app.models.Post.Interactions = Backbone.Model.extend({ app.stream.addNow(reshare); } interactions.trigger("change"); interactions.set({"reshares_count": interactions.get("reshares_count") + 1}); interactions.reshares.trigger("change"); }) .fail(function(){ app.flashMessages.error(Diaspora.I18n.t("reshares.duplicate")); Loading app/assets/javascripts/app/views/likes_info_view.js +5 −7 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ app.views.LikesInfo = app.views.Base.extend({ tooltipSelector : ".avatar", initialize : function() { this.model.interactions.bind('change', this.render, this); this.model.interactions.likes.on("change", this.render, this); this.displayAvatars = false; }, Loading @@ -19,18 +19,16 @@ app.views.LikesInfo = app.views.Base.extend({ return _.extend(this.defaultPresenter(), { likes : this.model.interactions.likes.toJSON(), likesCount : this.model.interactions.likesCount(), displayAvatars : this.model.interactions.get("fetched") && this.displayAvatars displayAvatars: this.displayAvatars }); }, showAvatars : function(evt){ if(evt) { evt.preventDefault() } this.displayAvatars = true; if(!this.model.interactions.get("fetched")){ this.model.interactions.fetch(); } else { this.model.interactions.trigger("change"); } this.model.interactions.likes.fetch({success: function() { this.model.interactions.likes.trigger("change"); }.bind(this)}); } }); // @license-end app/assets/javascripts/app/views/reshares_info_view.js +5 −7 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ app.views.ResharesInfo = app.views.Base.extend({ tooltipSelector : ".avatar", initialize : function() { this.model.interactions.bind("change", this.render, this); this.model.interactions.reshares.bind("change", this.render, this); this.displayAvatars = false; }, Loading @@ -19,18 +19,16 @@ app.views.ResharesInfo = app.views.Base.extend({ return _.extend(this.defaultPresenter(), { reshares : this.model.interactions.reshares.toJSON(), resharesCount : this.model.interactions.resharesCount(), displayAvatars : this.model.interactions.get("fetched") && this.displayAvatars displayAvatars: this.displayAvatars }); }, showAvatars : function(evt){ if(evt) { evt.preventDefault() } this.displayAvatars = true; if(!this.model.interactions.get("fetched")){ this.model.interactions.fetch(); } else { this.model.interactions.trigger("change"); } this.model.interactions.reshares.fetch({success: function() { this.model.interactions.reshares.trigger("change"); }.bind(this)}); } }); // @license-end Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ ## Refactor ## Bug fixes * Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167) ## Features Loading
app/assets/javascripts/app/collections/reshares.js +4 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ app.collections.Reshares = Backbone.Collection.extend({ model: app.models.Reshare, url : "/reshares" initialize: function(models, options) { this.url = "/posts/" + options.post.id + "/reshares"; } }); // @license-end
app/assets/javascripts/app/models/post/interactions.js +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ app.models.Post.Interactions = Backbone.Model.extend({ self.post.set({participation: true}); self.trigger("change"); self.set({"likes_count" : self.get("likes_count") + 1}); self.likes.trigger("change"); }, error: function() { app.flashMessages.error(Diaspora.I18n.t("failed_to_like")); Loading @@ -84,6 +85,7 @@ app.models.Post.Interactions = Backbone.Model.extend({ this.userLike().destroy({success : function() { self.trigger('change'); self.set({"likes_count" : self.get("likes_count") - 1}); self.likes.trigger("change"); }}); app.instrument("track", "Unlike"); Loading Loading @@ -116,6 +118,8 @@ app.models.Post.Interactions = Backbone.Model.extend({ app.stream.addNow(reshare); } interactions.trigger("change"); interactions.set({"reshares_count": interactions.get("reshares_count") + 1}); interactions.reshares.trigger("change"); }) .fail(function(){ app.flashMessages.error(Diaspora.I18n.t("reshares.duplicate")); Loading
app/assets/javascripts/app/views/likes_info_view.js +5 −7 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ app.views.LikesInfo = app.views.Base.extend({ tooltipSelector : ".avatar", initialize : function() { this.model.interactions.bind('change', this.render, this); this.model.interactions.likes.on("change", this.render, this); this.displayAvatars = false; }, Loading @@ -19,18 +19,16 @@ app.views.LikesInfo = app.views.Base.extend({ return _.extend(this.defaultPresenter(), { likes : this.model.interactions.likes.toJSON(), likesCount : this.model.interactions.likesCount(), displayAvatars : this.model.interactions.get("fetched") && this.displayAvatars displayAvatars: this.displayAvatars }); }, showAvatars : function(evt){ if(evt) { evt.preventDefault() } this.displayAvatars = true; if(!this.model.interactions.get("fetched")){ this.model.interactions.fetch(); } else { this.model.interactions.trigger("change"); } this.model.interactions.likes.fetch({success: function() { this.model.interactions.likes.trigger("change"); }.bind(this)}); } }); // @license-end
app/assets/javascripts/app/views/reshares_info_view.js +5 −7 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ app.views.ResharesInfo = app.views.Base.extend({ tooltipSelector : ".avatar", initialize : function() { this.model.interactions.bind("change", this.render, this); this.model.interactions.reshares.bind("change", this.render, this); this.displayAvatars = false; }, Loading @@ -19,18 +19,16 @@ app.views.ResharesInfo = app.views.Base.extend({ return _.extend(this.defaultPresenter(), { reshares : this.model.interactions.reshares.toJSON(), resharesCount : this.model.interactions.resharesCount(), displayAvatars : this.model.interactions.get("fetched") && this.displayAvatars displayAvatars: this.displayAvatars }); }, showAvatars : function(evt){ if(evt) { evt.preventDefault() } this.displayAvatars = true; if(!this.model.interactions.get("fetched")){ this.model.interactions.fetch(); } else { this.model.interactions.trigger("change"); } this.model.interactions.reshares.fetch({success: function() { this.model.interactions.reshares.trigger("change"); }.bind(this)}); } }); // @license-end