begin fixing plugin
This commit is contained in:
parent
f515f19ef0
commit
20c1ae0853
3 changed files with 19 additions and 15 deletions
|
@ -19,9 +19,9 @@ NOTE: You will NOT receive an email if you(the author that registered their emai
|
||||||
|
|
||||||
```
|
```
|
||||||
"ep_email_notifications" : {
|
"ep_email_notifications" : {
|
||||||
"panelDisplayLocation": { // Where you want to have the subscription panel - Adding this to break the plugin?
|
"panelDisplayLocation": { // Where you want to have the subscription panel
|
||||||
"mysettings": "true", // In the "mysettings" menu
|
"mysettings": true,
|
||||||
"popup": "true" // A popup that pop in the bottom right corner of the pad after 10 seconds
|
"popup": true
|
||||||
},
|
},
|
||||||
"checkFrequency": "6000", // checkFrequency = How frequently(milliseconds) to check for pad updates -- Move me to the settings file
|
"checkFrequency": "6000", // checkFrequency = How frequently(milliseconds) to check for pad updates -- Move me to the settings file
|
||||||
"staleTime": "30000", // staleTime = How stale(milliseconds) does a pad need to be before notifying subscribers? Move me to settings
|
"staleTime": "30000", // staleTime = How stale(milliseconds) does a pad need to be before notifying subscribers? Move me to settings
|
||||||
|
|
|
@ -39,6 +39,8 @@ exports.handleMessage = function(hook_name, context, callback){
|
||||||
// does email (Un)Subscription already exist for this email address?
|
// does email (Un)Subscription already exist for this email address?
|
||||||
db.get("emailSubscription:"+context.message.data.padId, function(err, userIds){
|
db.get("emailSubscription:"+context.message.data.padId, function(err, userIds){
|
||||||
|
|
||||||
|
console.log("emailSubscription");
|
||||||
|
|
||||||
var alreadyExists = false;
|
var alreadyExists = false;
|
||||||
|
|
||||||
if(userIds){
|
if(userIds){
|
||||||
|
@ -173,6 +175,7 @@ exports.subscriptionEmail = function (context, email, emailFound, userInfo, padI
|
||||||
padId
|
padId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.warn("emailSubSucc");
|
||||||
context.client.json.send({ type: "COLLABROOM",
|
context.client.json.send({ type: "COLLABROOM",
|
||||||
data:{
|
data:{
|
||||||
type: "emailSubscriptionSuccess",
|
type: "emailSubscriptionSuccess",
|
||||||
|
@ -298,18 +301,19 @@ exports.sendUserInfo = function (context, emailFound, email, userInfo) {
|
||||||
|
|
||||||
if (emailFound == true) {
|
if (emailFound == true) {
|
||||||
// We send back the options associated to this userId
|
// We send back the options associated to this userId
|
||||||
context.client.json.send({ type: "COLLABROOM",
|
var msg = {
|
||||||
data:{
|
type: "emailNotificationGetUserInfo",
|
||||||
type: "emailNotificationGetUserInfo",
|
payload: {
|
||||||
payload: {
|
email: email,
|
||||||
email: email,
|
onStart: onStart,
|
||||||
onStart: onStart,
|
onEnd: onEnd,
|
||||||
onEnd: onEnd,
|
formName: context.message.data.userInfo.formName,
|
||||||
formName: context.message.data.userInfo.formName,
|
success:true
|
||||||
success:true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
context.client.json.send({ type: "COLLABROOM", data: msg });
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// No options set for this userId
|
// No options set for this userId
|
||||||
context.client.json.send({ type: "COLLABROOM",
|
context.client.json.send({ type: "COLLABROOM",
|
||||||
|
|
2
index.js
2
index.js
|
@ -8,7 +8,7 @@ db['dbSettings'].cache = 0;
|
||||||
|
|
||||||
exports.registerRoute = function (hook_name, args, callback) {
|
exports.registerRoute = function (hook_name, args, callback) {
|
||||||
// Catching (un)subscribe addresses
|
// Catching (un)subscribe addresses
|
||||||
args.app.get('/p/*/(un){0,1}subscribe=*', function(req, res) {
|
args.app.get(/\/p/*/(un){0,1}subscribe=\/(.*)/, function(req, res) {
|
||||||
var fullURL = req.protocol + "://" + req.get('host') + req.url;
|
var fullURL = req.protocol + "://" + req.get('host') + req.url;
|
||||||
var path=req.url.split("/");
|
var path=req.url.split("/");
|
||||||
var padId=path[2];
|
var padId=path[2];
|
||||||
|
|
Loading…
Reference in a new issue