mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 04:26:41 -04:00

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
29 lines
990 B
JavaScript
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");
|
|
}
|
|
});
|