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

Render enrollment emails in the student's language #6082

Merged
merged 2 commits into from
Jan 21, 2015

Conversation

regisb
Copy link
Contributor

@regisb regisb commented Nov 27, 2014

Context: Course instructors have the option to enroll, unenroll and assign the "beta user" role to a list of manually-written email addresses. An email is then sent to each address to inform the address owner of the change.

Problem: the emails that correspond to existing users are not written in the user's language, but in the instructor's language.

Proposed solution: render the email messages and subject using the user's language, if available. If no user corresponds to a given email address, then the instructor's language is used (which is the current default behaviour).

This pull request is related to this Google groups conversation.

@openedx-webhooks
Copy link

Thanks for the pull request, @regisb! I've created OSPR-244 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams.

Feel free to add as much of the following information to the ticket:

  • supporting documentation
  • edx-code email threads
  • timeline information ('this must be merged by XX date', and why that is)
  • partner information ('this is a course on edx.org')
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will still be done via the Github pull request interface. As a reminder, our process documentation is here.

We can't start reviewing your pull request until you've submitted a signed contributor agreement or indicated your institutional affiliation and added yourself to the AUTHORS file. Please see the CONTRIBUTING file for more information.

@regisb regisb force-pushed the edx/translate-enrollment-emails branch 2 times, most recently from fe6725b to 457cfee Compare November 27, 2014 11:11
@sarina
Copy link
Contributor

sarina commented Nov 27, 2014

@regisb this is a good fix! Please be sure to submit your contributors agreement as stated by the bot - we can't review it until that's straightened out.

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed needs triage labels Nov 27, 2014
@regisb
Copy link
Contributor Author

regisb commented Nov 27, 2014

I just sent my contributor agreement yesterday; would you like a copy?

@sarina
Copy link
Contributor

sarina commented Nov 27, 2014

Nope - our legal team will process it. It is Thanksgiving holiday for us in the USA, so expect more attention early next week. Thanks!

@openedx-webhooks openedx-webhooks added product review PR requires product review before merging and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Nov 27, 2014
@regisb regisb force-pushed the edx/translate-enrollment-emails branch from 457cfee to 8d9a7f9 Compare November 27, 2014 13:31
@regisb
Copy link
Contributor Author

regisb commented Nov 27, 2014

Sounds good! Meanwhile: it seems the Jenkins tests are failing because they were run on a previous version of my PR. Would you mind starting them again manually please?

@sarina
Copy link
Contributor

sarina commented Nov 27, 2014

build should automatically trigger when you push a new commit and/or do a
rebase atop master.

On Thu, Nov 27, 2014 at 11:03 AM, Régis B. [email protected] wrote:

Sounds good! Meanwhile: it seems the Jenkins tests are failing because
they were run on a previous version of my PR. Would you mind starting them
again manually please?


Reply to this email directly or view it on GitHub
https://github.com/edx/edx-platform/pull/6082#issuecomment-64807328.

@regisb regisb force-pushed the edx/translate-enrollment-emails branch from 8d9a7f9 to 01bc612 Compare December 1, 2014 08:41
@regisb
Copy link
Contributor Author

regisb commented Dec 1, 2014

It seems that tests are passing: there are just a couple violations but they are due to previous commits. Do you think this PR can be merged?

@sarina
Copy link
Contributor

sarina commented Dec 1, 2014

@regisb - there are quite a few steps that need to follw before this can be merged, please see our contributors documentation. The label on your PR lets you know what state your PR is in, right now it is "product review". We do product review every other week, the next review is this Thursday AM.

We do need a passing build and communication from our legal team that your contributors agreement is in place, as well.

@regisb regisb force-pushed the edx/translate-enrollment-emails branch 2 times, most recently from d631b60 to b2fdadb Compare December 2, 2014 10:05
@sarina sarina removed the product review PR requires product review before merging label Dec 11, 2014
@@ -291,6 +294,9 @@ def send_mail_to_student(student, param_dict):
`is_shib_course`: (a `boolean`)
]

`language` is the language used to render the email. If None the language
currently active will be used.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a little confusing. Maybe, "If None, the language of the currently-logged in user (that is, the user sending the email) will be used."

@sarina
Copy link
Contributor

sarina commented Dec 11, 2014

This looks good. I have a few changes, and I'd like to see an additional test of the default case as well as the override case.

@sarina
Copy link
Contributor

sarina commented Dec 12, 2014

@regisb I cannot verify this on a sandbox - I have a user set to French, and an instructor set to Chinese, with the platform language set to English. When the instructor invites the French user to beta test a course, the French user is still receiving the mail in English.

@sarina
Copy link
Contributor

sarina commented Dec 12, 2014

@regisb - putting this ticket in "waiting on author". I restarted all my services on my sandbox and ran the manual test (French user, Chinese instructor, English platform language) again, and I still can't verify this PR works (student user gets email in English, not French). Can you please tell me how you tested this work manually, so I can try to manually verify this PR works?

I also can't verify the problem you initially stated- you said the user gets the email in the instructor's language. But in my testing on master, I see the user always gets the email in the platform language (set by LANGUAGE_CODE), not the instructor's language.

Also, your PR needs a rebase.

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed community manager review labels Dec 12, 2014
@regisb
Copy link
Contributor Author

regisb commented Dec 13, 2014

Sarina,
I'm currently AWK and will return only on the 21st. Sorry about that :-/

The unit test I wrote was failing before my fix. Perhaps can you try to run it without the rest of my PR?

Régis

Sent from my portable toaster. Please excuse the brevity.

Le 12 décembre 2014 22:16:26 GMT+05:30, Sarina Canelake [email protected] a écrit :

@regisb - putting this ticket in "waiting on author". I restarted all
my services on my sandbox and ran the manual test (French user, Chinese
instructor, English platform language) again, and I still can't verify
this PR works (student user gets email in English, not French). Can you
please tell me how you tested this work manually, so I can try to
manually verify this PR works?

I also can't verify the problem you initially stated- you said the user
gets the email in the instructor's language. But in my testing on
master, I see the user always gets the email in the platform language
(set by LANGUAGE_CODE), not the instructor's language.

Also, your PR needs a rebase.


Reply to this email directly or view it on GitHub:
https://github.com/edx/edx-platform/pull/6082#issuecomment-66798896

@sarina
Copy link
Contributor

sarina commented Jan 14, 2015

Regarding your testing on master: to be clearer, the language used to send the email is the language of the currently-logged in user. So if the instructor's language is Chinese, but you are sending the email with your (English) staff account, then the email will be sent in English. Did you log in as a Chinese user when you tested the feature on the master branch?

Yes, when I tested this on master, I was logged in as a staff user with a Chinese language preference. I will test this again now.

@sarina
Copy link
Contributor

sarina commented Jan 14, 2015

@regisb ah! OK now I am able to validate the fix. Cool! This is a very reasonable fix.

"""

# If language is None we default to the currently active language. Note
# that this differs from the behaviour of override_language.
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this differ from the behavior of override_language?

@sarina
Copy link
Contributor

sarina commented Jan 14, 2015

So, my only nagging question is about the default behavior. I feel that the right thing to do is actually to default to the platform language, not the instructor's language. For example if it is a France-based installation but there is a professor teaching a course in French. But he is from China so he sets his own platform language to be Chinese. I think it is more appropriate to default not to his language but to the platform language. @regisb what do you think about this?

@regisb regisb force-pushed the edx/translate-enrollment-emails branch from 514a3b9 to ce4ad04 Compare January 15, 2015 14:16
@regisb
Copy link
Contributor Author

regisb commented Jan 15, 2015

@sarina Yes, what you are saying about the default behavior makes sense. I amended my PR and added a unit test to test_api_email_localization.py.

@sarina
Copy link
Contributor

sarina commented Jan 15, 2015

@regisb cool! I will test today, and if tests pass & testing looks good, then we will be able to merge it 🎆 🎊 ❗ 😄

@sarina
Copy link
Contributor

sarina commented Jan 15, 2015

@regisb - can you take a look at your test failures? You have a quality issue (run paver run_quality and make sure your quality report is 100%) You also have a failing unit test. I think the bok-choy test is unrelated.

@sarina
Copy link
Contributor

sarina commented Jan 16, 2015

@regisb : just ran a test of your branch and it looks great! Once the tests and quality issues are resolved, this is 👍 to merge.

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed community manager review labels Jan 16, 2015
@regisb regisb force-pushed the edx/translate-enrollment-emails branch from ce4ad04 to 653f922 Compare January 19, 2015 08:53
@regisb
Copy link
Contributor Author

regisb commented Jan 19, 2015

@sarina : great :)

@openedx-webhooks openedx-webhooks added community manager review and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Jan 20, 2015
@sarina
Copy link
Contributor

sarina commented Jan 20, 2015

@regisb eek. I'm very sorry but could I ask you to rebase one more time?

Enrollment, unenrollment and beta role emails should be rendered in the
student's language, and not the instructor's language.
@regisb regisb force-pushed the edx/translate-enrollment-emails branch from 653f922 to f3419bb Compare January 20, 2015 17:08
@sarina
Copy link
Contributor

sarina commented Jan 21, 2015

@regisb awesome, thank you so much! This is a great fix.

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.

3 participants