mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Admin posts are now automatically accepted
This commit is contained in:
parent
035d5c51c9
commit
d1679bd7c0
1 changed files with 19 additions and 6 deletions
|
@ -150,8 +150,9 @@ postSchemaObject = {
|
||||||
// only provide a default value
|
// only provide a default value
|
||||||
// 1) this is an insert operation
|
// 1) this is an insert operation
|
||||||
// 2) status field is not set in the document being inserted
|
// 2) status field is not set in the document being inserted
|
||||||
if(this.isInsert && !this.isSet)
|
var user = Meteor.users.findOne(this.userId);
|
||||||
return getSetting('requirePostsApproval', false) ? STATUS_PENDING: STATUS_APPROVED
|
if (this.isInsert && !this.isSet)
|
||||||
|
return getDefaultPostStatus(user);
|
||||||
},
|
},
|
||||||
autoform: {
|
autoform: {
|
||||||
noselect: true,
|
noselect: true,
|
||||||
|
@ -248,6 +249,17 @@ getPostProperties = function (post) {
|
||||||
return p;
|
return p;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// default status for new posts
|
||||||
|
getDefaultPostStatus = function (user) {
|
||||||
|
if (isAdmin(user) || !getSetting('requirePostsApproval', false)) {
|
||||||
|
// if user is admin, or else post approval is not required
|
||||||
|
return STATUS_APPROVED
|
||||||
|
} else {
|
||||||
|
// else
|
||||||
|
return STATUS_PENDING
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getPostPageUrl = function(post){
|
getPostPageUrl = function(post){
|
||||||
return getSiteUrl()+'posts/'+post._id;
|
return getSiteUrl()+'posts/'+post._id;
|
||||||
};
|
};
|
||||||
|
@ -361,11 +373,12 @@ Meteor.methods({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
var defaultPostStatus = getSetting('requirePostsApproval') ? STATUS_PENDING : STATUS_APPROVED;
|
if(!!post.status && isAdmin(Meteor.user())){
|
||||||
if(isAdmin(Meteor.user()) && !!post.status){ // if user is admin and a custom status has been set
|
// if a custom status has been set, and user is admin, use that
|
||||||
properties.status = post.status;
|
properties.status = post.status;
|
||||||
}else{ // else use default status
|
}else{
|
||||||
properties.status = defaultPostStatus;
|
// else use default status
|
||||||
|
properties.status = getDefaultPostStatus(Meteor.user());
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatedAt
|
// CreatedAt
|
||||||
|
|
Loading…
Add table
Reference in a new issue