From de660e89d2a5aec4792823265c1e99c075a88ac2 Mon Sep 17 00:00:00 2001 From: quenenni Date: Thu, 4 Apr 2013 17:57:37 +0200 Subject: [PATCH] if no settings for the pligin -> msg sent to the user --- client.js | 4 +++- locales/en.json | 2 +- static/js/ep_email.js | 4 ++-- update.js | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client.js b/client.js index 73a98d9..1b360be 100644 --- a/client.js +++ b/client.js @@ -16,6 +16,8 @@ exports.eejsBlock_styles = function (hook_name, args, cb) { }; exports.clientVars = function(hook, context, callback) { + var pluginSettings = settings.ep_email_notifications; + var panelDisplayLocation = (pluginSettings && pluginSettings.panelDisplayLocation)?pluginSettings.panelDisplayLocation:"undefiend"; // return the setting to the clientVars, sending the value - return callback({ "panelDisplayLocation": settings.ep_email_notifications.panelDisplayLocation }); + return callback({ "panelDisplayLocation": panelDisplayLocation }); }; diff --git a/locales/en.json b/locales/en.json index b036aa0..2884b90 100644 --- a/locales/en.json +++ b/locales/en.json @@ -3,7 +3,7 @@ , "ep_email_notifications.titleGritterUnsubscr": "Email unsubscription" , "ep_email_notifications.headerGritterSubscr": "(Receive an email when someone modifies this pad)" , "ep_email_notifications.msgOptionsNotChecked": "You need to check at least one of the two options from 'Send a mail when someone..'" -, "ep_email_notifications.msgParamsMissing": "Some settings for the 'email_Notifications' plugin are missing.
Please contact your administrator." +, "ep_email_notifications.msgParamsMissing": "Settings for the 'email_Notifications' plugin are missing.
Please contact your administrator." , "ep_email_notifications.msgEmailMalformed": "The email address is malformed" , "ep_email_notifications.msgAlreadySubscr": "You are already registered for emails for this pad" , "ep_email_notifications.msgUnsubscrNotExisting": "This email address is not registered for this pad" diff --git a/static/js/ep_email.js b/static/js/ep_email.js index 8a52ae6..8f59212 100644 --- a/static/js/ep_email.js +++ b/static/js/ep_email.js @@ -13,8 +13,8 @@ exports.postAceInit = function(hook, context){ title: window._('ep_email_notifications.titleGritterError'), // (string | mandatory) the text inside the notification text: window._('ep_email_notifications.msgParamsMissing'), - // (int | optional) the time you want it to be alive for before fading out - time: 10000, + // (bool | optional) if you want it to fade out on its own or just sit there + sticky: true }); // Hide the notification menu in mysettings diff --git a/update.js b/update.js index 0874624..1f0e6d9 100644 --- a/update.js +++ b/update.js @@ -8,6 +8,7 @@ settings = require('../../src/node/utils/Settings'); // Settings -- EDIT THESE IN settings.json not here.. var pluginSettings = settings.ep_email_notifications; +var areParamsOk = (pluginSettings)?true:false; var checkFrequency = (pluginSettings && pluginSettings.checkFrequency)?pluginSettings.checkFrequency:60000; // 10 seconds var staleTime = (pluginSettings && pluginSettings.staleTime)?pluginSettings.staleTime:300000; // 5 minutes var fromName = (pluginSettings && pluginSettings.fromName)?pluginSettings.fromName:"Etherpad"; @@ -22,6 +23,8 @@ var timers = {}; var server = email.server.connect(emailServer); exports.padUpdate = function (hook_name, _pad) { + if (areParamsOk == false) return false; + var pad = _pad.pad; var padId = pad.id; exports.sendUpdates(padId);