dirtyish way of handling a cookie to stop re-prompt
This commit is contained in:
parent
aeb44eb8ca
commit
f4d455a751
3 changed files with 9 additions and 4 deletions
|
@ -22,7 +22,6 @@ Open that pad in ANOTHER BROWSER then begin modifying, you should recieve an ema
|
|||
```
|
||||
|
||||
# TODO
|
||||
* stop the ui prompting if already subscribed
|
||||
* Clean up all code
|
||||
* Stop it emailing me if I'm already on the pad
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
var cookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie;
|
||||
|
||||
if(typeof exports == 'undefined'){
|
||||
var exports = this['mymodule'] = {};
|
||||
}
|
||||
|
@ -28,7 +30,10 @@ function init(){
|
|||
if(clientHasAlreadyRegistered()){ // if the client has already registered for emails on this pad.
|
||||
// showAlreadyRegistered(); // client has already registered, let em know..
|
||||
}else{
|
||||
askClientToEnterEmail(); // ask the client to register TODO uncomment me for a pop up
|
||||
var cookieVal = pad.getPadId() + "email";
|
||||
if(cookie.getPref(cookieVal) !== "true"){ // if this user hasn't already subscribed
|
||||
askClientToEnterEmail(); // ask the client to register TODO uncomment me for a pop up
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +76,7 @@ function askClientToEnterEmail(){
|
|||
// (string | mandatory) the heading of the notification
|
||||
title: "Enter your email to recieve an email when someone modifies this pad",
|
||||
// (string | mandatory) the text inside the notification
|
||||
text: "<form class='ep_email_form'><label for='ep_email'><input id='ep_email_notification' placeholder='your@email.com' style='padding:5px;width:200px;' type=email><input type=submit value=subscribe style='padding:5px;'></form>",
|
||||
text: "<form class='ep_email_form'><label for='ep_email'><input id='ep_email_notification' placeholder='your@email.com' style='padding:5px;width:180px;' type=email><input type=submit value=subscribe style='padding:5px;'></form>",
|
||||
// (bool | optional) if you want it to fade out on its own or just sit there
|
||||
sticky: true,
|
||||
// (int | optional) the time you want it to be alive for before fading out
|
||||
|
@ -101,6 +106,7 @@ function sendEmailToServer(){
|
|||
message.userInfo.userId = userId;
|
||||
if(email){
|
||||
pad.collabClient.sendMessage(message);
|
||||
cookie.setPref(message.padId+"email", "true");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ exports.notifyEnd = function(padId){
|
|||
db.get("emailSubscription:" + padId, function(err, recipients){ // get everyone we need to email
|
||||
if(recipients){
|
||||
async.forEach(Object.keys(recipients), function(recipient, cb){
|
||||
console.debug("Emailing "+recipient +" about a new begin update");
|
||||
console.warn("Emailing "+recipient +" about a pad finish editing");
|
||||
|
||||
server.send({
|
||||
text: "Your pad at "+urlToPads+padId +" has finished being edited, we're just emailing you let you know :) The changes look like this:" + changesToPad,
|
||||
|
|
Loading…
Reference in a new issue