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" : { "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

View file

@ -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,8 +301,7 @@ 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,
@ -309,7 +311,9 @@ exports.sendUserInfo = function (context, emailFound, email, userInfo) {
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",

View file

@ -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];