diaspora/app/assets/javascripts/app/models/user.js
Daniel Sun 13419066d4 refactor authorIsCurrentUser to user model as isAuthorOf
Dried up authorIsCurrentUser in views.js

removed authorIsCurrentUser, now called from views.js

remove authorIsCurrentUser from views.js
2014-08-19 10:37:57 +01:00

23 lines
614 B
JavaScript

app.models.User = Backbone.Model.extend({
toggleNsfwState : function() {
if(!app.currentUser.authenticated()){ return false }
this.set({showNsfw : !this.get("showNsfw")});
this.trigger("nsfwChanged");
},
authenticated : function() {
return !!this.id;
},
expProfileUrl : function(){
return "/people/" + app.currentUser.get("guid") + "?ex=true"
},
isServiceConfigured : function(providerName) {
return _.include(this.get("configured_services"), providerName)
},
isAuthorOf: function(model) {
return this.authenticated() && model.get("author").id == this.id;
}
});