robogals / myrobogals

myRobogals is the global intranet and record-keeping tool for Robogals. It has been built to simplify many of our day-to-day tasks including organising school visits, maintaining a member database, communicating with members, storing records reliably for future generations and easily collecting statistics on a global scale.
https://my.robogals.org
10 stars 21 forks source link

Unsubscribe link included by default in emails #29

Closed U-238 closed 11 years ago

U-238 commented 12 years ago

Currently, when someone goes to "Send bulk SMS", there is a default opt-out message included.

Email should have something similar - something that says by default in the body field in "Send bulk email", something like: "This email has been sent to you by Robogals Adelaide (unsubscribe)"

The word "unsubscribe" is a link, and when someone clicks that link they can confirm their unsubscription. If they choose to unsubscribe, it will set email_chapter_optin = False

The unsubscribe link will need to have some kind of unique ID for that user. For this, you will probably need to edit send_email_cron.php to have a substitution field like {{unique_id}}

If the user is unsubscribing using the link, they do not need to be logged in.

This feature is something that I've been thinking of for a while but it was also recently requested by the Sydney chapter.

yfcheung commented 12 years ago

unique_id: (not saved in the sever)

1: mechanism for checking validity (unknown?) 2: mechanism for extracting user id (lots of ways, which is best?)

U-238 commented 12 years ago

Currently, the "forgot password" functionality (which is a built-in feature of Django) creates a unique ID to be sent as part of the forgot password URL. You could see how they do it, and use something similar.

yfcheung commented 12 years ago

file: myrobogals/daemons/rgsmsd.c line: 201

if (msgarray[oddeven][j][2] == 20 || msgarray[oddeven][j][2] == 22) { index out of range?

variable: int msgarray[2][101][2];

U-238 commented 12 years ago

What are the values of oddeven and j when you get index out of range?

Also, how is rgsmsd.c involved in the unsubscribe link issue?

yfcheung commented 12 years ago

Currently, when someone goes to "Send bulk SMS", there is a default opt-out message included.

So I thought the opt-out message related operations are done in the daemons for sending SMS.

Did not actually run the code, just by reading and thought it strange. Below are my understanding of the variable: msgarray[oddeven][j][i]:

oddeven: rotating storage for preventing processing a recipient twice within at least 250000, at most 250000 micro-seconds.

j: recipients to be processed, or processed.

i: 0: recipient id 1: recipient status

msgarray possible arrangement:

  1. 3D array crammed into a 1D array.
  2. Linked list tree like structure.
U-238 commented 12 years ago

For send bulk SMS, no substitution is needed in the opt-out message because there's no unique ID in the opt-out message. As such, no substitution is done in the daemon.

oddeven alternates between 0 and 1 with each loop, this is a way of making sure that any message ID sent in the current loop is not the same as a message ID sent in the previous loop. This protects against sending the same message over and over, in the case where the database cannot be written to, so the message is always marked as "pending" even after being sent.

yfcheung commented 12 years ago

the cron lock file worries me!

yfcheung commented 12 years ago

unique key:

hash = sha_constructor(unicode(user.id) + unicode(timestamp)).hexdigest()[::2]

U-238 commented 12 years ago

Cron lock file is to make sure only 1 instance of the script is running simultaneously

yfcheung commented 12 years ago

I will look into it further.

U-238 commented 11 years ago

New feature merged and tested. Well done! Issue closed.