Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1622 Fix unsubscribe when loading the unsubscribe form on a … #16634

Merged
merged 1 commit into from
Feb 27, 2020

Conversation

seamuslee001
Copy link
Contributor

…different locale to the one the mailing was sent from

Overview

This aims to fix a bug where by if you create and send mailing on locale 1 e.g. en_US but then load the unsubscribe form on locale 2 e.g. fr_FR the unsubscribe form does not show the correct list of groups.

Before

Incorrect list of groups shown if loading unsubscribe form on locale other than the locale used to send the mailing

After

Correct list of groups shown on unsubscribe form no matter the locale

Technical Details

The long and short of is we store the full translated table name in the entity_table and getTableName() will use the current locale to set the table name so if your on a different locale to the one the mailing was sent from then it breaks.

ping @eileenmcnaughton @artfulrobot @mlutfy

@civibot
Copy link

civibot bot commented Feb 26, 2020

(Standard links)

@civibot civibot bot added the master label Feb 26, 2020
@seamuslee001 seamuslee001 changed the title dev/core#1612 Fix unsubscribe when loading the unsubscribe form on a … dev/core#1622 Fix unsubscribe when loading the unsubscribe form on a … Feb 26, 2020
@artfulrobot
Copy link
Contributor

Wow, good find @seamuslee001. I think it should work but a possible improvement might be to add comments about why the === matches the table names, and/or regex on /^civicrm_group(_.._..)$/ (untested) because the substring match also matches several other tables. I realise those are not relevant to the context, but probably deserves explanation.

@mlutfy
Copy link
Member

mlutfy commented Feb 26, 2020

I'm flabbergasted by the speed at which Seamus wrote the PR, and that it includes a test :)

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 I feel like this should be heavily commented as a temporary measure & we should plan to only store the non-translated table name

…different locale to the one the mailing was sent from

Add in comments as per request from Eileen
@seamuslee001
Copy link
Contributor Author

@eileenmcnaughton i have added comments, is that sufficient?

@eileenmcnaughton
Copy link
Contributor

@seamuslee001 yes I think so - would be nice to get that sillyness cleaned up

@eileenmcnaughton eileenmcnaughton merged commit 8afb959 into civicrm:master Feb 27, 2020
@eileenmcnaughton eileenmcnaughton deleted the lab_core_1612 branch February 27, 2020 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants