Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Updates global #5266

Merged
itsjoekent merged 5 commits intoDoSomethingArchive:devfrom
itsjoekent:5168
Sep 28, 2015
Merged

Updates global #5266
itsjoekent merged 5 commits intoDoSomethingArchive:devfrom
itsjoekent:5168

Conversation

@itsjoekent
Copy link
Contributor

What's this PR do?

Updates the logic used to seta users language upon registering. See here for summary of what was discussed in #global #5168 (comment)

All of this was also moved into a new function per @angaither 's suggestion here #5263 (comment)

Also updates dosomething_global_convert_country_to_language to return null rather than 'en'

Where should the reviewer start?

dosomething_user_set_global_attributes();

How should this be manually tested?

Create new users and spoof there country codes, check there languages to make sure they match. Also try making a user without a country code header and make sure it goes to English.

Any background context you want to provide?

Slack discussion from here and down https://dosomething.slack.com/archives/global/p1443451428000871

What are the relevant tickets?

Fixes #5168
Unblocks #5263

Also @deezone this is going to break your logic here for users coming from countries outside US/MX/BR https://github.com/DoSomething/phoenix/blob/cf11f1b791a9668ae73f403b8121dc055156b447/lib/modules/dosomething/dosomething_mbp/dosomething_mbp.module#L235

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$language = 'en'; and $language = 'en-global'; on ln 544. Are they two different languages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes they are two different languages. en is just for US, en global is for all countries outside of the US we don't explicitly support

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the $country_code value suppose to be included in the user_save($user, ['language' => $language]); ?

Perhaps looking up the user country should always be done based on the user language setting? This seems problematic long run if we have more than one country with the same language but need know the users actual country.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

country code doesnt exist yet but yes it will be added.

and ideally the country code is always specified by the fastly headers and/or this variable we're creating. the language conversion hacks have already been made because we didn't have a country field before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACTUALLY the country code exists already and was unintentionally fixed when I updated the get affiliate code logic

https://github.com/DoSomething/phoenix/blob/dev/lib/modules/dosomething/dosomething_user/dosomething_user.module#L1167

@itsjoekent
Copy link
Contributor Author

@angaither I think its ready for re-review. I commented above re: countries, the logic is already in place

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_user_global_attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angaither
Copy link
Contributor

@deadlybutter what do you mean country code was unintentionally fixed? @mshmsh5000 and @sheyd said country code isn't getting passed correctly on friday. looks like that logic was added a while ago

@itsjoekent
Copy link
Contributor Author

I just created two new users with diff country codes in the headers, printed them out and the country field in address was correct. I can do it again and screenshot it? and the function being called was updated, not that line, thats why it was unintentionally fixed

https://github.com/DoSomething/phoenix/blob/458433df8cf46467efd178763f222bf51d7bd873/lib/modules/dosomething/dosomething_settings/dosomething_settings.module#L73

@angaither
Copy link
Contributor

@deadlybutter address was set correctly in the user profile?

@itsjoekent
Copy link
Contributor Author

user profile doesnt display country
screen shot 2015-09-28 at 2 14 24 pm

@angaither
Copy link
Contributor

so I think the issue #5263 for it passing into NS still stands, but we are saving it correctly to the user profile, correct @deadlybutter?

@itsjoekent
Copy link
Contributor Author

yes and yes. just verified country is in the DB. just needs to be passed into northstar but thats #5263

id rather get this fixed rather than wait for northstar integration as its blocking our testing later

@angaither
Copy link
Contributor

yip 👍

itsjoekent pushed a commit that referenced this pull request Sep 28, 2015
@itsjoekent itsjoekent merged commit 86ce1de into DoSomethingArchive:dev Sep 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants