begin fixing plugin

This commit is contained in:
John McLear 2015-05-03 12:48:15 +01:00
parent f515f19ef0
commit 20c1ae0853
3 changed files with 19 additions and 15 deletions

View file

@ -19,9 +19,9 @@ NOTE: You will NOT receive an email if you(the author that registered their emai
```
"ep_email_notifications" : {
"panelDisplayLocation": { // Where you want to have the subscription panel - Adding this to break the plugin?
"mysettings": "true", // In the "mysettings" menu
"popup": "true" // A popup that pop in the bottom right corner of the pad after 10 seconds
"panelDisplayLocation": { // Where you want to have the subscription panel
"mysettings": true,
"popup": true
},
"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

View file

@ -39,6 +39,8 @@ exports.handleMessage = function(hook_name, context, callback){
// does email (Un)Subscription already exist for this email address?
db.get("emailSubscription:"+context.message.data.padId, function(err, userIds){
console.log("emailSubscription");
var alreadyExists = false;
if(userIds){
@ -173,6 +175,7 @@ exports.subscriptionEmail = function (context, email, emailFound, userInfo, padI
padId
);
console.warn("emailSubSucc");
context.client.json.send({ type: "COLLABROOM",
data:{
type: "emailSubscriptionSuccess",
@ -298,18 +301,19 @@ exports.sendUserInfo = function (context, emailFound, email, userInfo) {
if (emailFound == true) {
// We send back the options associated to this userId
context.client.json.send({ type: "COLLABROOM",
data:{
type: "emailNotificationGetUserInfo",
payload: {
email: email,
onStart: onStart,
onEnd: onEnd,
formName: context.message.data.userInfo.formName,
success:true
}
var msg = {
type: "emailNotificationGetUserInfo",
payload: {
email: email,
onStart: onStart,
onEnd: onEnd,
formName: context.message.data.userInfo.formName,
success:true
}
});
}
context.client.json.send({ type: "COLLABROOM", data: msg });
} else {
// No options set for this userId
context.client.json.send({ type: "COLLABROOM",

View file

@ -8,7 +8,7 @@ db['dbSettings'].cache = 0;
exports.registerRoute = function (hook_name, args, callback) {
// 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 path=req.url.split("/");
var padId=path[2];