Vulcan/client/views/users/profile/user_info.js
Anthony Mayer f9d9891fba Getting rid of redundant permissions functions
Switched everything over to use can.* functions from telescope-lib instead of using can* functions from lib/permissions.js, deleted lib/permissions.js, added some tests for permissions, and some other random cleanup like deleting unused code.

Conflicts:
	client/views/comments/comment_form.js
2015-01-07 08:22:46 +01:00

29 lines
990 B
JavaScript

Template[getTemplate('userInfo')].helpers({
canEditProfile: function() {
var currentUser = Meteor.user();
return currentUser && (this._id == currentUser._id || isAdmin(currentUser));
},
createdAtFormatted: function() {
return this.createdAt;
},
canInvite: function() {
// if the user is logged in, the target user hasn't been invited yet, invites are enabled, and user is not viewing their own profile
return Meteor.user() && Meteor.user()._id != this._id && !isInvited(this) && invitesEnabled() && can.invite(Meteor.user());
},
inviteCount: function() {
return Meteor.user().inviteCount;
},
getTwitterName: function () {
return getTwitterName(this);
},
getGitHubName: function () {
return getGitHubName(this);
}
});
Template[getTemplate('userInfo')].events({
'click .invite-link': function(e, instance){
Meteor.call('inviteUser', instance.data.user._id);
flashMessage('Thanks, user has been invited.', "success");
}
});