-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Update email constants for single release candidate #20170
Update email constants for single release candidate #20170
Conversation
* CAN_SEND_EMAILS is now a platform parameter. This will be switched on for the prod server and off for the other servers. * CAN_SEND_EDITOR_ROLE_EMAILS, CAN_SEND_FEEDBACK_MESSAGE_EMAILS and CAN_SEND_SUBSCRIPTION_EMAILS are replaced with CAN_SEND_TRANSACTIONAL_EMAILS. * DEFAULT_EMAIL_UPDATES_PREFERENCE is set to True in feconf.py and is not configurable per-server. * REQUIRE_EMAIL_ON_MODERATOR_ACTION is set to True and the constant is removed.
Hi @kevintab95, can you complete the following:
|
Hi @vojtechjelinek, @DubeySandeep, @kevintab95, PTAL at this PR, it adds a new cron job. |
Hi @kevintab95 please assign the required reviewer(s) for this PR. Thanks! |
@oppia/release-coordinators please note that for the release containing these changes, the RC must ensure that the CAN_SEND_EMAILS platform parameter is set in production and unset on other servers. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Took a pass.
self.swap_to_always_return( | ||
platform_parameter_services, | ||
'get_platform_parameter_value', | ||
True | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.swap_to_always_return( | |
platform_parameter_services, | |
'get_platform_parameter_value', | |
True | |
) | |
) | |
self.swap_to_always_return( | |
platform_parameter_services, | |
'get_platform_parameter_value', | |
True | |
) | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/domain/feedback_services.py
Outdated
if (can_send_emails and ( | ||
feconf.CAN_SEND_TRANSACTIONAL_EMAILS and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also somehow cleanup this if
at this point it is almost unreadable. At least something like this:
# TODO(#12079): Figure out a better way to avoid sending feedback
# thread emails for contributor dashboard suggestions.
message_changed = len(text) > 0 or old_statuses[index] != new_statuses[index]
if (
can_send_emails and
feconf.CAN_SEND_TRANSACTIONAL_EMAILS and
author_id is not None and
user_services.is_user_registered(author_id)) and
message_changed and
should_send_email
):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Unassigning @vojtechjelinek since the review is done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @seanlip, thanks!
core/tests/test_utils.py
Outdated
@@ -453,10 +453,18 @@ def mock_get_platform_parameter_value( | |||
Returns: | |||
PlatformDataTypes. The value of the platform parameter if the | |||
parameter is present in the platform_parameter_names list. | |||
|
|||
Raises: | |||
Exception. If the parameter_name is not present in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
core/tests/test_utils.py
Outdated
""" | ||
platform_parameter_name_value_dict = dict( | ||
(x.value, y) for x, y in platform_parameter_name_value_tuples | ||
) | ||
if parameter_name not in platform_parameter_name_value_dict: | ||
raise Exception( | ||
'Unknown platform parameter name: %s' % parameter_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Regarding the second question, this is true if the test uses the decorator i.e. if a test uses the decorator, it will need to exhaustively define all the platform parameter that it requires or it will throw the error above. There may still be tests that rely on calling the actual procedure (not mocking) and/or there may be other tests that mocks the method a different way (e.g. always return xxx).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Unassigning @vojtechjelinek since they have already approved the PR. |
…intab95/oppia into update-email-constants-for-single-rc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seanlip PTAL, thanks!
core/tests/test_utils.py
Outdated
""" | ||
platform_parameter_name_value_dict = dict( | ||
(x.value, y) for x, y in platform_parameter_name_value_tuples | ||
) | ||
if parameter_name not in platform_parameter_name_value_dict: | ||
raise Exception( | ||
'Unknown platform parameter name: %s' % parameter_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup @kevintab95! Pity about the pylint disables, but I don't have a quick way to fix it, so let's leave them for now and figure it out later.
LGTM!
Hi @kevintab95, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
Overview
Essential Checklist
Please follow the instructions for making a code change.
Testing doc (for PRs with Beam jobs that modify production server data)
Proof that changes are correct
Proof of changes on desktop with slow/throttled network
Proof of changes on mobile phone
Proof of changes in Arabic language
PR Pointers