Added Patreon notification badge for new patreon posts
This commit is contained in:
26
app/Model/Meta/PatreonPosts.js
Normal file
26
app/Model/Meta/PatreonPosts.js
Normal file
@@ -0,0 +1,26 @@
|
||||
PatreonPosts = new Mongo.Collection("patreonPosts");
|
||||
|
||||
Schemas.PatreonPosts = new SimpleSchema({
|
||||
link: {
|
||||
type: String,
|
||||
},
|
||||
dateAdded: {
|
||||
type: Date,
|
||||
autoValue(){
|
||||
return new Date();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
PatreonPosts.attachSchema(Schemas.PatreonPosts);
|
||||
|
||||
PatreonPosts.allow({
|
||||
insert: function(userId, doc) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
if (user) return _.contains(user.roles, "admin");
|
||||
},
|
||||
remove: function(userId, doc) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
if (user) return _.contains(user.roles, "admin");
|
||||
},
|
||||
});
|
||||
@@ -70,6 +70,10 @@ Schemas.User = new SimpleSchema({
|
||||
index: 1,
|
||||
optional: true,
|
||||
},
|
||||
lastPatreonPostClicked: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.users.attachSchema(Schemas.User);
|
||||
@@ -107,3 +111,11 @@ if (Meteor.isServer) Meteor.methods({
|
||||
Meteor.users.update(this.userId, {$set: {apiKey}});
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
clickPatreonPost(link) {
|
||||
Meteor.users.update(this.userId, {$set: {
|
||||
lastPatreonPostClicked: link
|
||||
}});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user