don't attempt to favorite with a save if you are not the post owner. in doing so, you will get logged out. also, update the gemfile.lock

This commit is contained in:
danielgrippi 2012-04-29 00:05:49 -07:00
parent cfb52a7129
commit 90919fa488
3 changed files with 9 additions and 12 deletions

View file

@ -13,13 +13,6 @@ GIT
specs:
settingslogic (2.0.8)
GIT
remote: git://github.com/diaspora/acts-as-taggable-on.git
revision: c3592fe1a906f6ff1cd12766c5cf1152c51eec40
specs:
acts-as-taggable-on (2.0.6)
rails (>= 3.0)
GIT
remote: git://github.com/diaspora/diaspora-client.git
revision: 99dd3728172834b01e2acae0604fe3865456d969
@ -80,6 +73,8 @@ GEM
activesupport (= 3.1.4)
activesupport (3.1.4)
multi_json (~> 1.0)
acts-as-taggable-on (2.2.2)
rails (~> 3.0)
acts_as_api (0.3.11)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
@ -501,7 +496,7 @@ DEPENDENCIES
SystemTimer (= 1.2.3)
active_reload
activerecord-import (~> 0.2.9)
acts-as-taggable-on!
acts-as-taggable-on (~> 2.2.2)
acts_as_api
addressable (= 2.2.4)
airbrake

View file

@ -40,9 +40,11 @@ app.models.Post = Backbone.Model.extend(_.extend({}, app.models.formatDateMixin,
}
},
toggleFavorite : function(){
toggleFavorite : function(options){
this.set({favorite : !this.get("favorite")})
this.save()
/* guard against attempting to save a model that a user doesn't own */
if(options.save){ this.save() }
},
like : function() {

View file

@ -91,7 +91,8 @@ app.views.SmallFrame = app.views.Post.extend({
}
var prevDimension = this.dimensionsClass();
this.model.toggleFavorite();
this.model.toggleFavorite({save : this.model.get("author").diaspora_id == app.currentUser.get("diaspora_id")})
this.$el.removeClass(prevDimension)
this.render()
@ -99,7 +100,6 @@ app.views.SmallFrame = app.views.Post.extend({
app.page.stream.trigger("reLayout")
//trigger moar relayouts in the case of images WHOA GROSS HAX
_.delay(function(){app.page.stream.trigger("reLayout")}, 200)
_.delay(function(){app.page.stream.trigger("reLayout")}, 500)
},
killPost : function(){