fixing users stuff

This commit is contained in:
Sacha Greif 2015-05-07 16:18:07 +09:00
parent 9f7e87f722
commit 400fe55dc1
7 changed files with 32 additions and 14 deletions

View file

@ -10,7 +10,8 @@ Package.onUse(function (api) {
var packages = [ var packages = [
'standard-app-packages', 'standard-app-packages',
'accounts-base', 'service-configuration',
'accounts-ui',
'accounts-base', 'accounts-base',
'accounts-password', 'accounts-password',
'accounts-twitter', 'accounts-twitter',

View file

@ -596,6 +596,21 @@ var migrationsList = {
} }
console.log("---------------------"); console.log("---------------------");
return i; return i;
},
migrateDisplayName: function () {
var i = 0;
var allUsers = Meteor.users.find({"telescope.displayName": {$exists: false}});
console.log('> Found '+allUsers.count()+' users.\n');
allUsers.forEach(function(user){
i++;
console.log('> Updating user '+user._id+' (' + user.username + ')');
var displayName = user.profile.name || user.profile.username;
console.log('name: ', displayName);
Meteor.users.update(user._id, {$set: {"telescope.displayName": displayName}});
});
return i;
} }
}; };

View file

@ -53,3 +53,6 @@
padding-top: 15px; padding-top: 15px;
text-align: center; text-align: center;
} }
.at-pwd-link{
margin-bottom: 20px;
}

View file

@ -28,8 +28,8 @@ function setupUser (user, options) {
user.telescope.emailHash = Gravatar.hash(options.email); user.telescope.emailHash = Gravatar.hash(options.email);
} }
// set username on telescope // set displayName on telescope
user.telescope.username = user.username; user.telescope.displayName = user.username;
// create slug from username // create slug from username
user.telescope.slug = Telescope.utils.slugify(user.telescope.username); user.telescope.slug = Telescope.utils.slugify(user.telescope.username);

View file

@ -6,16 +6,16 @@ Template.usersDashboard.helpers({
showFilter: true, showFilter: true,
fields: [ fields: [
{ key: 'avatar', label: '', tmpl: Template.users_list_avatar, sortable: false }, { key: 'avatar', label: '', tmpl: Template.users_list_avatar, sortable: false },
{ key: 'username', label: 'Username', tmpl: Template.users_list_username },
{ key: 'profile.username', label: 'Display Name' },
{ key: 'profile.email', label: 'Email', tmpl: Template.users_list_email },
{ key: 'createdAt', label: 'Member Since', tmpl: Template.users_list_created_at, sort: 'descending' }, { key: 'createdAt', label: 'Member Since', tmpl: Template.users_list_created_at, sort: 'descending' },
{ key: 'postCount', label: 'Posts' },
{ key: 'commentCount', label: 'Comments' },
{ key: 'karma', label: 'Karma', fn: function(val){return Math.round(100*val)/100} },
{ key: 'inviteCount', label: 'Invites' },
{ key: 'isInvited', label: 'Invited', fn: function(val){return val ? 'Yes':'No'} },
{ key: 'isAdmin', label: 'Admin', fn: function(val){return val ? 'Yes':'No'} }, { key: 'isAdmin', label: 'Admin', fn: function(val){return val ? 'Yes':'No'} },
{ key: 'username', label: 'Username', tmpl: Template.users_list_username },
{ key: 'telescope.displayName', label: 'Display Name' },
{ key: 'telescope.email', label: 'Email', tmpl: Template.users_list_email },
{ key: 'telescope.postCount', label: 'Posts' },
{ key: 'telescope.commentCount', label: 'Comments' },
{ key: 'telescope.karma', label: 'Karma', fn: function(val){return Math.round(100*val)/100} },
{ key: 'telescope.inviteCount', label: 'Invites' },
{ key: 'telescope.isInvited', label: 'Invited', fn: function(val){return val ? 'Yes':'No'} },
{ key: 'actions', label: 'Actions', tmpl: Template.users_list_actions, sortable: false } { key: 'actions', label: 'Actions', tmpl: Template.users_list_actions, sortable: false }
] ]
}; };

View file

@ -1,3 +1,3 @@
<template name="users_list_email"> <template name="users_list_email">
<a href="mailto:{{profile.email}}">{{profile.email}}</a> <a href="mailto:{{telescope.email}}">{{telescope.email}}</a>
</template> </template>

View file

@ -34,9 +34,8 @@ Telescope.schemas.userData = new SimpleSchema({
type: Number, type: Number,
optional: true optional: true
}, },
displayName: { displayName: { // can contain spaces and special characters, doesn't need to be unique
type: String, type: String,
regEx: /^[a-zA-Z-]{2,25}$/,
optional: true, optional: true,
editableBy: ["member", "admin"] editableBy: ["member", "admin"]
}, },