mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
keep the user.telescope settings schema for migration and backward compatibility with full-Meteor powered app
This commit is contained in:
parent
db5605bd2e
commit
6e2819919e
1 changed files with 191 additions and 6 deletions
|
@ -17,6 +17,191 @@ const canEditAll = user => Users.canDo(user, "users.edit.all");
|
||||||
|
|
||||||
const alwaysPublic = user => true;
|
const alwaysPublic = user => true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary User Data schema
|
||||||
|
* @type {SimpleSchema}
|
||||||
|
*/
|
||||||
|
Telescope.schemas.userData = new SimpleSchema({
|
||||||
|
/**
|
||||||
|
Bio (Markdown version)
|
||||||
|
*/
|
||||||
|
bio: {
|
||||||
|
type: String,
|
||||||
|
optional: true,
|
||||||
|
control: "textarea",
|
||||||
|
insertableIf: canInsert,
|
||||||
|
editableIf: canEdit,
|
||||||
|
// form: {
|
||||||
|
// rows: 5
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
Total comment count
|
||||||
|
*/
|
||||||
|
commentCount: {
|
||||||
|
type: Number,
|
||||||
|
publish: true,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
The name displayed throughout the app. Can contain spaces and special characters, doesn't need to be unique
|
||||||
|
*/
|
||||||
|
displayName: {
|
||||||
|
type: String,
|
||||||
|
optional: true,
|
||||||
|
publish: true,
|
||||||
|
profile: true,
|
||||||
|
control: "text",
|
||||||
|
insertableIf: canInsert,
|
||||||
|
editableIf: canEdit
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
An array containing comment downvotes
|
||||||
|
*/
|
||||||
|
downvotedComments: {
|
||||||
|
type: [Telescope.schemas.votes],
|
||||||
|
publish: false,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
An array containing posts downvotes
|
||||||
|
*/
|
||||||
|
downvotedPosts: {
|
||||||
|
type: [Telescope.schemas.votes],
|
||||||
|
publish: false,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
The user's email. Modifiable.
|
||||||
|
*/
|
||||||
|
email: {
|
||||||
|
type: String,
|
||||||
|
optional: true,
|
||||||
|
regEx: SimpleSchema.RegEx.Email,
|
||||||
|
required: true,
|
||||||
|
control: "text",
|
||||||
|
insertableIf: canInsert,
|
||||||
|
editableIf: canEdit
|
||||||
|
// unique: true // note: find a way to fix duplicate accounts before enabling this
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
A hash of the email, used for Gravatar // TODO: change this when email changes
|
||||||
|
*/
|
||||||
|
emailHash: {
|
||||||
|
type: String,
|
||||||
|
publish: true,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
The HTML version of the bio field
|
||||||
|
*/
|
||||||
|
htmlBio: {
|
||||||
|
type: String,
|
||||||
|
publish: true,
|
||||||
|
profile: true,
|
||||||
|
optional: true,
|
||||||
|
// form: {
|
||||||
|
// omit: true
|
||||||
|
// },
|
||||||
|
template: "user_profile_bio"
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
The user's karma
|
||||||
|
*/
|
||||||
|
karma: {
|
||||||
|
type: Number,
|
||||||
|
decimal: true,
|
||||||
|
publish: true,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
Total post count
|
||||||
|
*/
|
||||||
|
postCount: {
|
||||||
|
type: Number,
|
||||||
|
publish: true,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
A blackbox modifiable object to store the user's settings
|
||||||
|
*/
|
||||||
|
// settings: {
|
||||||
|
// type: Object,
|
||||||
|
// optional: true,
|
||||||
|
// editableIf: canEdit,
|
||||||
|
// blackbox: true,
|
||||||
|
// form: {
|
||||||
|
// omit: true
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
/**
|
||||||
|
The user's profile URL slug // TODO: change this when displayName changes
|
||||||
|
*/
|
||||||
|
slug: {
|
||||||
|
type: String,
|
||||||
|
publish: true,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
The user's Twitter username
|
||||||
|
*/
|
||||||
|
twitterUsername: {
|
||||||
|
type: String,
|
||||||
|
optional: true,
|
||||||
|
publish: true,
|
||||||
|
profile: true,
|
||||||
|
control: "text",
|
||||||
|
insertableIf: canInsert,
|
||||||
|
editableIf: canEdit,
|
||||||
|
template: "user_profile_twitter"
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
An array containing comments upvotes
|
||||||
|
*/
|
||||||
|
upvotedComments: {
|
||||||
|
type: [Telescope.schemas.votes],
|
||||||
|
publish: false,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
An array containing posts upvotes
|
||||||
|
*/
|
||||||
|
upvotedPosts: {
|
||||||
|
type: [Telescope.schemas.votes],
|
||||||
|
publish: false,
|
||||||
|
optional: true
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
A link to the user's homepage
|
||||||
|
*/
|
||||||
|
website: {
|
||||||
|
type: String,
|
||||||
|
regEx: SimpleSchema.RegEx.Url,
|
||||||
|
publish: true,
|
||||||
|
profile: true,
|
||||||
|
optional: true,
|
||||||
|
control: "text",
|
||||||
|
insertableIf: canInsert,
|
||||||
|
editableIf: canEdit
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
Groups
|
||||||
|
*/
|
||||||
|
groups: {
|
||||||
|
type: [String],
|
||||||
|
optional: true,
|
||||||
|
control: "checkboxgroup",
|
||||||
|
insertableIf: canEditAll,
|
||||||
|
editableIf: canEditAll,
|
||||||
|
form: {
|
||||||
|
options: function () {
|
||||||
|
const groups = _.without(_.keys(Users.groups), "anonymous", "default", "admins");
|
||||||
|
return groups.map(group => {return {value: group, label: group};});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Users schema
|
* @summary Users schema
|
||||||
* @type {SimpleSchema}
|
* @type {SimpleSchema}
|
||||||
|
@ -69,12 +254,12 @@ Users.schema = new SimpleSchema({
|
||||||
optional: true,
|
optional: true,
|
||||||
blackbox: true
|
blackbox: true
|
||||||
},
|
},
|
||||||
// 👋 bye bye, 🔭 namespace
|
// telescope-specific data, kept for backward compatibility and migration purposes
|
||||||
// telescope: { // telescope-specific data
|
telescope: {
|
||||||
// type: Telescope.schemas.userData,
|
type: Telescope.schemas.userData,
|
||||||
// optional: true,
|
optional: true,
|
||||||
// viewableIf: alwaysPublic,
|
viewableIf: alwaysPublic,
|
||||||
// },
|
},
|
||||||
services: {
|
services: {
|
||||||
type: Object,
|
type: Object,
|
||||||
optional: true,
|
optional: true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue