DoSomething / legacy-website

:moyai: The DoSomething.org legacy website.
https://www.dosomething.org/
MIT License
50 stars 22 forks source link

Blank CAMPAIGN_TITLE for campaign_reportback on Mobile App reportbacks #5985

Closed deezone closed 8 years ago

deezone commented 8 years ago

Transactional email request for campaign_reportback on the Grandparents Gone Wired campaign is sending blank values for the `CAMPAIGN_TITLE. I've confirmed that it appears no other campaign reportbacks have the same issue.

Perhaps related, the Grandparents Gone Wired campaign has two languages:

The English version can be viewed but the English, Global page is empty:

The blank / broken English, Global page is displayed if the campaign path is to the node ID: https://www.dosomething.org/node/5775

There appears to be a bug in the ReportbackController specific to the The Grandparents Gone Wired campaign. The $entrity value sent to dosomething_reportback_mbp_request() (https://github.com/DoSomething/phoenix/blob/dev/lib/modules/dosomething/dosomething_reportback/includes/ReportbackController.php#L130) has a blank value for CAMPAIGN_TITLE in the $params sent in the Message Broker request (https://github.com/DoSomething/phoenix/blob/dev/lib/modules/dosomething/dosomething_reportback/dosomething_reportback.module#L863)

The problem payload sent to Message Broker has a NULL value for CAMPAIGN_TITLE in campaign_reportback email transaction requests.

Log Entry for campaign_reportback for The Grandparents Gone Wired campaign. Note the CAMPAIGN_TITLE\";N; value:

{
    "_id" : ObjectId("568c49db0043a891068a31c9"),
    "email" : "xxx@hotmail.com",
    "activity" : "campaign_reportback",
    "source" : "us",
    "activity_details" : "a:11:{s:8:\"activity\";s:19:\"campaign_reportback\";s:5:\"email\";s:22:\"xxx@hotmail.com\";s:3:\"uid\";s:7:\"3449667\";s:10:\"merge_vars\";a:7:{s:12:\"MEMBER_COUNT\";s:11:\"4.7 million\";s:5:\"FNAME\";s:5:\"Megan\";s:14:\"CAMPAIGN_TITLE\";N;s:11:\"IMPACT_VERB\";N;s:13:\"IMPACT_NUMBER\";s:1:\"2\";s:11:\"IMPACT_NOUN\";N;s:23:\"REPORTBACK_IMAGE_MARKUP\";s:173:\"<img src=\"https://www.dosomething.org/sites/default/files/styles/300x300/public/reportbacks/5775/uid_3449667-nid_5775-0.jpg?itok=KgGjL_hi\" width=\"300\" height=\"300\" alt=\"\" />\";}s:12:\"user_country\";s:2:\"US\";s:14:\"email_template\";s:25:\"mb-campaign-reportback-US\";s:8:\"event_id\";s:4:\"5775\";s:10:\"email_tags\";a:1:{i:0;s:26:\"drupal_campaign_reportback\";}s:17:\"campaign_language\";s:2:\"en\";s:18:\"activity_timestamp\";i:1452034523;s:14:\"application_id\";s:2:\"US\";}",
    "activity_date" : ISODate("2016-01-05T22:55:23Z"),
    "logged_date" : ISODate("2016-01-05T22:55:23.941Z"),
    "__v" : 0
}

The result is an email with the merge_var for CAMPAIGN_TITLE not replaced: image

To Reproduce the Bug:

The report back transactional email is triggered when the Drupal API reportback endpoint (https://github.com/DoSomething/phoenix/wiki/API#campaign-reportback) is called.

cc: @marahmi @namimody

sergiitk commented 8 years ago

https://www.dosomething.org/node/5775

That's because you need to access US page, https://www.dosomething.org/us/node/5775

deezone commented 8 years ago

Shouldn't /node/5775 forward to the default language for the campaign? From the Czech Republic, it looks like it's trying to forward to a global english version.

image

image

image

@marahml @namimody I'll check in with the Campaign manager, Adam Garner to see how to reproduce the bug. Let's keep the issue open until we get his feedback.

itsjoekent commented 8 years ago

node 5775 has no global translation @DeeZone

https://www.dosomething.org/us/node/5775/translate

deezone commented 8 years ago

@deadlybutter Yep, that's my point... as a global user, why does accessing the base node not redirect me to:

  1. Global Campaign
  2. or if it doesn't exist, the default language, in this case English.

As a Global Admin user, the edit form is kinda funky:

image

sergiitk commented 8 years ago

Should we move this discussion to its own ticket?

itsjoekent commented 8 years ago

you're logged in as an administrator. for non admins you'd be redirected

continue discussion re: this here --> https://github.com/DoSomething/phoenix/issues/6005

mikefantini commented 8 years ago

@DeeZone @deadlybutter @sergii-tkachenko this is intended behavior right now. Ideally we are avoiding this behavior for the most part by using country specific URLs in situations where campaigns don't exist in multiple translations. I.e. if a campaign only exists in US English we should never advertise an unappended URL (i.e. we should always use www.dosomething.org/us/node/5775 and never use www.dosomething.org/node/5775 if the campaign only exists in US English).

The reason we have gone this route is because we want to stop adding complexity to the redirect logic and stop making assumptions on behalf of the user. So we only redirect users when they hit the base URL if a translation exists in their language. In this case, a translation does not exist in their language and so we don't redirect them.

The ideal solution I'd like to get to eventually is a smart 404 page that tells the user that we don't have that campaign in their language, but here are languages we do have the campaign in (or something like that). This concept is noted here: https://trello.com/c/PMHIIFFa.

@deadlybutter this isn't related to the admin redirect issue because @DeeZone is not logged in as an admin. This is what a user from the Czech Republic would experience

itsjoekent commented 8 years ago

ah I was looking at the second screenshot in the admin menu

deezone commented 8 years ago

@mikefantini Thanks for the clarification. I don't work on the Drupal site on a regular basis. I'm often not aware of the current "intended behavior". Your explanation makes sense.

@sergii-tkachenko

Should we move this discussion to its own ticket?

I'll leave this issue open as the original issue of a blank CAMPAIGN_TITLE transactional bug can't currently be explained. I had hoped I had uncovered a scenario with the discussed global redirect functionality. Even with the blank pages the resulting transactional produced a complete message.

I'll discuss the details with Adam of how he produced the bug.

sergiitk commented 8 years ago

Closing this as a duplicate of #5872.