Opened 6 years ago

Closed 6 years ago

#1858 closed improve feature (fixed)

Add "city" for possible scopes in massmail tool

Reported by: pablobd Owned by: shevek
Priority: major Milestone: 1.6
Component: BW Admin Keywords: massmail, volunteer tool, cities
Cc: jsfan

Description

In the massmail tool where you configure the sending http://www.bewelcome.org/bw/admin/adminmassmails.php?action=prepareenque Current posible scopes are

  • a list of members
  • a country
  • a group

we need to add an option for a city in order to let volunteers target all members for a given city for e.g. special anouncements. there is already an opt-out setting for this in place in the profile preferences.

Attachments (1)

wordsformassmail.sql (6.9 KB) - added by shevek 6 years ago.

Download all attachments as: .zip

Change History (65)

comment:1 Changed 6 years ago by shevek

The list of cities should probably be filtered by a country selection first or would a simple text field for the city name be enough to serve this purpose?

Especially as the whole thing will be superseded by the event tool soon.

comment:2 Changed 6 years ago by pablobd

Maybe use the same method of the profile select location? http://www.bewelcome.org/setlocation

comment:3 Changed 6 years ago by shevek

If that tool would be already in the 'build' part of the site that would be an option. But to improve the bw part to such an extend just doesn't make sense.

So edit field for city name? And with luck for 1.3.

comment:4 Changed 6 years ago by shevek

  • Milestone changed from unassigned to 1.5
  • Status changed from new to local_testing

Some time and a volunteer cafe went by. The event tool is still somewhere at the horizon. To get a event mailing facility earlier I moved the mass mailing tool to Rox.

The code is here: https://gitorious.org/~thisismeonmounteverest/bewelcome/search_and_set_location/commits/1858_city_for_massmail

To run it needs a DB update to add the possibility to write event mass mailings:

ALTER TABLE `broadcast` CHANGE `Type` `Type` ENUM( 'Normal', 'RemindToLog', 'Specific' ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Normal' COMMENT 'Normal or Reinder to logs in'

The rights management needed some adaptation:

  • Level 1: Edit, create, enqueue and unqueue newsletters
  • Level 5: Trigger and untrigger newsletters

Scope:

  • "All"
  • "ChangeType?": Change the type of a newsletter. Newsletters with type 'Specific' aren't shown on /newsletter
  • "Specific": Limit the volunteer to only act on 'Specific' newsletters (list of newsletters also only shows specific once)
  • "General": Same as "Specific" but for 'Normal' newsletters (the difference in naming stems from the DB)
  • "Members": Allow volunteer to enqueue massmailings to all or specific members
  • "Location": Allow to enqueue to all countries (one at a time)
  • "Location: list of countrycodes": Limit volunteer to list of countries (list is comma separated)
  • "Group": Allow to enqueue to all groups (one at a time)
  • "Group: list of group ids": Limit volunteer to list of groups (list is comma separated)
  • "Vote": Allow to enqueue for voting process. Sends to random members.

Rest of it should be intuitive I hope ;-)

comment:5 Changed 6 years ago by mahouni

local_testing on the mileston 1.5 branch:
https://gitorious.org/~mahouni/bewelcome/mahouni-rox/commits/ms15_develop_20130129

Don't forget the Database update for ticket #1892 and #1858.
Check: http://trac.bewelcome.org/wiki/DatabaseChanges

comment:6 Changed 6 years ago by jsfan

  • Summary changed from Add "city" fo posible scopes in massmail tool to Add "city" for possible scopes in massmail tool

comment:7 Changed 6 years ago by jsfan

  • Status changed from local_testing to needs_work

comment:8 Changed 6 years ago by jsfan

  • Owner set to mahouni
  • Status changed from needs_work to assigned

comment:9 Changed 6 years ago by jsfan

  • Status changed from assigned to local_testing

comment:10 Changed 6 years ago by shevek

@jsfan: Could you please reassign this ticket to me?

comment:11 Changed 6 years ago by jsfan

  • Status changed from local_testing to needs_work

comment:12 Changed 6 years ago by jsfan

  • Owner changed from mahouni to shevek
  • Status changed from needs_work to assigned

comment:13 Changed 6 years ago by jsfan

  • Status changed from assigned to local_testing

comment:14 follow-up: Changed 6 years ago by crumbking

Shevek could you provide a sql statement with all "AdminMassMail?..." wordcodes to insert in my local DB? It's a pain in the ass to edit all by hand. As they are quite long they break layouts. Oh and could you point to the relevant commits for code review?

BTW: The table hurt my eyes ;-)

Changed 6 years ago by shevek

comment:15 in reply to: ↑ 14 Changed 6 years ago by shevek

Replying to crumbking:

Shevek could you provide a sql statement with all "AdminMassMail?..." wordcodes to insert in my local DB?

See attachment. We should probably use something like that to update the words table before we call for translation. (Well for this feature we can skip translation for now I guess.)

Oh and could you point to the relevant commits for code review?

This one I guess: https://gitorious.org/bewelcome/rox/commit/9e7259d716566b6845a295a363aecf3675b45dc3

Mahouni already started code review. More input is welcome, though.

BTW: The table hurt my eyes ;-)

Which one?

I agree that the one I used in enqueue members could (or should) be done differently but the one on the start page for mass mail is a table and therefore should be one ;-)

comment:16 follow-up: Changed 6 years ago by jsfan

Not sure about the testing workflow. I tried with locations that have members in the test db and never had any hits. The newsletter was never sent to anyone.

Also, the /bw menus have not been updated to point to the new script location. Please add a patch for that.

comment:17 follow-up: Changed 6 years ago by jsfan

I noticed that the naming of the methods is inconsistent. Some are in lower camel case others are all lower case. It would be nice to make that consistent.

comment:18 in reply to: ↑ 16 Changed 6 years ago by shevek

Replying to jsfan:

Not sure about the testing workflow. I tried with locations that have members in the test db and never had any hits. The newsletter was never sent to anyone.

For the location the preference inform me about local events is evaluated. If that was (surprisingly) set for the members no trigger would happen.

What exactly do you mean by 'not sent'? You need to manually call mailbot.php to actually get mails sent.

Also, the /bw menus have not been updated to point to the new script location. Please add a patch for that.

I try but am not sure if I succeed (after looking at the file). (In fact that problem already existed before. Check the admin menu after clicking on AdminWord if you have the right to access the Volunteer Queries. Login as admin is the easiest.)

Last edited 6 years ago by shevek (previous) (diff)

comment:19 in reply to: ↑ 17 Changed 6 years ago by shevek

Replying to jsfan:

I noticed that the naming of the methods is inconsistent. Some are in lower camel case others are all lower case. It would be nice to make that consistent.

Fixed: https://gitorious.org/bewelcome/rox/commit/8e85484d969f7728ff11bacb305bf4cdced4da62

comment:20 Changed 6 years ago by jsfan

  • Status changed from local_testing to to_alpha

Please keep testing locally if you don't have the necessary permissions to test on alpha.

comment:21 Changed 6 years ago by jsfan

  • Status changed from to_alpha to testing

comment:22 Changed 6 years ago by jsfan

@pablobd: Have you been able to test this on alpha?

comment:23 Changed 6 years ago by pablobd

how do i test this without sending a real mail to users?

comment:24 Changed 6 years ago by shevek

If you don't trigger no mails are send. You can check who would get the mails by clicking on the newsletter name.

  • You could create a test member in a country that has no members yet and send a newsletter to this country.
  • You can create a group and send to all members.
  • For members you can check if sending to a username list works as expected and check the results in the table. There you can trigger also.
  • For votes you can't check sending but in the end that's the same process in the background.

comment:25 Changed 6 years ago by shevek

Different rights assignment we have to test later on I suppose.

comment:26 follow-up: Changed 6 years ago by pablobd

while creating a new newsletter I get the error code AdminMassMailCodeExists? no matter what name i choose

comment:27 Changed 6 years ago by pablobd

I enqueues existing newsletter to an empty country, I get success code "NewsDecember2012 successfully enqueued to 0 members." but newsletter obviusly is not enqueued. I should get an Error/Warning? message instead

comment:28 follow-up: Changed 6 years ago by pablobd

Enqueue to one selected member doesnt work. I get same message NewsDecember2012 successfully enqueued to 0 members.

comment:29 Changed 6 years ago by pablobd

Enqueuing for Afganistan got the newsletter actually enqueued to angola ???

comment:30 in reply to: ↑ 26 Changed 6 years ago by shevek

  • Cc jsfan added

Replying to pablobd:

while creating a new newsletter I get the error code AdminMassMailCodeExists? no matter what name i choose

@jsfan: Did you apply the database update? As that is the only reason I can think of at the moment, why creating a newsletter fails (it defaults to type Specific which isn't allowed with the current database schema).

comment:31 in reply to: ↑ 28 Changed 6 years ago by shevek

Replying to pablobd:

Enqueue to one selected member doesnt work. I get same message NewsDecember2012 successfully enqueued to 0 members.

Hm. I can reproduce that even with a new member. Need to check.

comment:32 Changed 6 years ago by shevek

@jsfan: I found the reason why you can't send messages to users it's just a typo in admin.model.php in the function enqueueMassmail. There is a call to $varsUsernames? that should be $varsusernames?. As I can't commit from here could you update and commit? Thanks in advance.

comment:33 Changed 6 years ago by jsfan

I have no (re-?)applied the database update and pushed and deployed on alpha with typo corrected.

https://gitorious.org/bewelcome/rox/commit/c98a952b2c1ad0080b242c5b288448477359674d

@pablo: Could you please test again?

Last edited 6 years ago by jsfan (previous) (diff)

comment:34 Changed 6 years ago by shevek

Weird the commit changes from usernames (correct) to Usernames (wrong). When I checked out in the morning I had Usernames in the code and that didn´t work.

If I enter a username now I get an error message saying that username is empty.

comment:35 Changed 6 years ago by jsfan

Reverted commit and re-deployed. Hadn't noticed that the change went the wrong way.

comment:36 Changed 6 years ago by shevek

You changed enqueueMassmailVarsok and not enqueueMassmail :)

Could you please do change enqueueMassmail (line 912).

comment:38 Changed 6 years ago by shevek

Found the problem with the countries as well and setup a new SSH key.

https://gitorious.org/bewelcome/rox/commit/921e2bfa661521ca473850abd5c743ae57eb2992

comment:39 Changed 6 years ago by jsfan

Fix now on alpha.

comment:40 Changed 6 years ago by shevek

Seems to work to me.

@pablobd: could you please check again?

comment:41 Changed 6 years ago by pablobd

still cannot create new newsletter

comment:42 Changed 6 years ago by pablobd

still cannot enqueue to one given username

comment:43 follow-up: Changed 6 years ago by pablobd

enqueueing to a given country seems to work now

enqueueing to a given group works, but only if the group has no special characters in name, e.g. " or #

enqueueing for voting gives negative(!) count of recipients, and includes people with not active status, like asktoleave or mailtoconfirm

remark: bolivia has 33 people acording to http://alpha.bewelcome.org/places/BO/ but only 7 got enqueued, I guess maybe only 7 active members with preference to receive newsleter?

comment:44 in reply to: ↑ 43 Changed 6 years ago by shevek

enqueueing to a given country seems to work now

Good.

enqueueing to a given group works, but only if the group has no special characters in name, e.g. " or #

Bad. I check why that is the case. The group name isn't used during the process. So I guess the problem is while showing the group list?

enqueueing for voting gives negative(!) count of recipients, and includes people with not active status, like asktoleave or mailtoconfirm

I already wrote a ticket about that. That's basically the old query and not in the scope of this ticket.

remark: bolivia has 33 people acording to http://alpha.bewelcome.org/places/BO/ but only 7 got enqueued, I guess maybe only 7 active members with preference to receive newsleter?

There are two possibilities: They either habe the preference to receive the newsletter set to no or the other 26 already got the newsletter. As you can't create new ones that's likely the reason. You can't send a newsletter to the same person twice.

So if you tried to sent the newsletter2012 to yourself that would show successfully enqueued to 0 members. You could try to send a newsletter to shevektest.

comment:45 Changed 6 years ago by shevek

The error regarding the newsletter creation says that the word code already exists. It works perfectly locally. So I'm a bit at a loss there. I added some debug output to find out what's going wrong there.

Commit: https://gitorious.org/bewelcome/rox/commit/ff036ba871252537b6005800fd69958d9f995896

Please push to alpha.

comment:46 Changed 6 years ago by jsfan

Deployed on alpha.

comment:47 Changed 6 years ago by shevek

Arrgh. The reason it fails is that if you have translation rights and you start in edit or translation mode the returned code contains the link to the translation and therefore the code check decides that the code already exists.

Pablo could you please test again with switching translation mode to browse before creating a newsletter?

comment:48 follow-up: Changed 6 years ago by pablobd

OK, everything tested and seeming to work now.

What i noticed is I cannot delete the test newletters!!!!!

comment:49 in reply to: ↑ 48 Changed 6 years ago by shevek

  • Resolution set to fixed
  • Status changed from testing to closed

Replying to pablobd:

OK, everything tested and seeming to work now.

Cool.

What i noticed is I cannot delete the test newletters!!!!!

Yes, that's as before. As long as you use specific newsletters that's not really a problem as they don't show up on /newsletter. Please raise a new ticket if you really need a way to delete a newsletter.

comment:50 Changed 6 years ago by shevek

  • Resolution fixed deleted
  • Status changed from closed to reopened

Changed default for enqueue members to be selected members to avoid accidental enqueueing to all members with http://gitorious.org/bewelcome/rox/commit/a9f7f7e57ec05e1cbbb0500ab67bf17ac60242a3/diffs/7806fb14818d33642e4178ff2523866af7358630

comment:51 Changed 6 years ago by shevek

  • Status changed from reopened to to_alpha

comment:52 Changed 6 years ago by jsfan

  • Status changed from to_alpha to testing

comment:53 Changed 6 years ago by shevek

  • Resolution set to fixed
  • Status changed from testing to closed

Default selection on the 'Members' tab on the enqueue page is now 'Selected Members'. closing as fixed.

comment:54 Changed 6 years ago by crumbking

  • Component changed from unknown to BW Admin

comment:55 Changed 6 years ago by pablobd

I'm re-opening because i found a bug. I cannot send the same newsletter twice to the same user. This makes imposible the testing for many languages, as well as the ability to re send some newsletter in case of need (for example as reminder).

comment:56 Changed 6 years ago by pablobd

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:57 Changed 6 years ago by shevek

  • Milestone changed from 1.5 to 1.6
  • Status changed from reopened to to_alpha

Changed behaviour so that mass mailings can be resent as often as needed.

Bugfix is simple (replace INSERT INTO IGNORE with REPLACE). Can best be tested on Alpha as (only) Pablo has the necessary rights.

Commit: http://www.gitorious.org/bewelcome/rox/commit/d871eff40486ea924a4319b9ccc64e6920aad322

Last edited 6 years ago by shevek (previous) (diff)

comment:58 Changed 6 years ago by shevek

  • Status changed from to_alpha to testing

comment:59 Changed 6 years ago by pablobd

  • Resolution set to fixed
  • Status changed from testing to closed

works for me, thanks!

comment:60 Changed 6 years ago by shevek

  • Resolution fixed deleted
  • Status changed from closed to reopened

A newsletter was send to the Berlin group. Obviously former members received the newsletter as well.

Fixed: https://gitorious.org/bewelcome/rox/commit/ae4187b68907eb19ff5ad9466ace1b2d400f5d6a

comment:61 Changed 6 years ago by shevek

  • Status changed from reopened to to_alpha

comment:62 Changed 6 years ago by shevek

  • Status changed from to_alpha to testing

Deployed to alpha. Please test.

comment:63 Changed 6 years ago by shevek

I joined the testing group and enqueued the Berlin newsletter. That showed two people in the enqueue list. I left the group and enqueued again (after unqueueing) only one member on the list and that wasn't me. As another check I joined again and check the result of enqueing. All fine. Closing as fixed.

comment:64 Changed 6 years ago by shevek

  • Resolution set to fixed
  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.