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

Update email constants for single release candidate #20170

Merged

Conversation

kevintab95
Copy link
Member

Overview

  1. This PR fixes https://github.com/oppia/release-scripts/issues/133
  2. This PR does the following:
  • 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.

Essential Checklist

Please follow the instructions for making a code change.

  • I have linked the issue that this PR fixes in the "Development" section of the sidebar.
  • I have checked the "Files Changed" tab and confirmed that the changes are what I want to make.
  • I have written tests for my code.
  • The PR title starts with "Fix #bugnum: " or "Fix part of #bugnum: ...", followed by a short, clear summary of the changes.
  • I have assigned the correct reviewers to this PR (or will leave a comment with the phrase "@{{reviewer_username}} PTAL" if I can't assign them directly).

Testing doc (for PRs with Beam jobs that modify production server data)

  • A testing doc has been written: ... (ADD LINK) ...
  • (To be confirmed by the server admin) All jobs in this PR have been verified on a live server, and the PR is safe to merge.

Proof that changes are correct

can_send_emails

Proof of changes on desktop with slow/throttled network

Proof of changes on mobile phone

Proof of changes in Arabic language

PR Pointers

* 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.
@kevintab95 kevintab95 requested review from a team as code owners April 16, 2024 09:50
Copy link

oppiabot bot commented Apr 16, 2024

Hi @kevintab95, can you complete the following:

  1. The body of this PR is missing the proof that changes are correct section, please update it to include the section.
    Thanks!

Copy link

oppiabot bot commented Apr 16, 2024

Hi @vojtechjelinek, @DubeySandeep, @kevintab95, PTAL at this PR, it adds a new cron job.
Also @kevintab95 It seems you have added or edited a CRON job, if so please request a testing of this CRON job with this server jobs form Please refer to this guide for details.
Thanks!

@oppiabot oppiabot bot added the PR: Affects datastore layer Labels to indicate a PR that changes the datastore layer. label Apr 16, 2024
Copy link

oppiabot bot commented Apr 16, 2024

Hi @kevintab95 please assign the required reviewer(s) for this PR. Thanks!

@kevintab95
Copy link
Member Author

@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.

@kevintab95 kevintab95 changed the title Update email constants for single rc Update email constants for single release candidate Apr 16, 2024
Copy link
Member

@vojtechjelinek vojtechjelinek left a 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.

Comment on lines 248 to 253
self.swap_to_always_return(
platform_parameter_services,
'get_platform_parameter_value',
True
)
)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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
)
)

Copy link
Member

Choose a reason for hiding this comment

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

ditto below

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Comment on lines 389 to 390
if (can_send_emails and (
feconf.CAN_SEND_TRANSACTIONAL_EMAILS and
Copy link
Member

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
    ):

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link

oppiabot bot commented Apr 16, 2024

Unassigning @vojtechjelinek since the review is done.

@seanlip seanlip removed their assignment May 29, 2024
Copy link
Member Author

@kevintab95 kevintab95 left a comment

Choose a reason for hiding this comment

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

PTAL @seanlip, thanks!

@@ -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
Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

"""
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
Copy link
Member Author

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).

@kevintab95 kevintab95 assigned seanlip and kevintab95 and unassigned kevintab95 and seanlip May 31, 2024
Copy link
Member

@vojtechjelinek vojtechjelinek left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

oppiabot bot commented May 31, 2024

Unassigning @vojtechjelinek since they have already approved the PR.

Copy link
Member Author

@kevintab95 kevintab95 left a comment

Choose a reason for hiding this comment

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

@seanlip PTAL, thanks!

"""
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
Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@kevintab95 kevintab95 assigned seanlip and unassigned kevintab95 Jun 4, 2024
Copy link
Member

@seanlip seanlip left a 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!

@seanlip seanlip enabled auto-merge June 4, 2024 15:05
@seanlip seanlip assigned kevintab95 and unassigned seanlip Jun 4, 2024
@oppiabot oppiabot bot added the PR: LGTM label Jun 4, 2024
Copy link

oppiabot bot commented Jun 4, 2024

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!

@seanlip seanlip added this pull request to the merge queue Jun 4, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 4, 2024
@seanlip seanlip added this pull request to the merge queue Jun 4, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 4, 2024
@kevintab95 kevintab95 added this pull request to the merge queue Jun 4, 2024
Merged via the queue into oppia:develop with commit ea72509 Jun 4, 2024
81 checks passed
@kevintab95 kevintab95 deleted the update-email-constants-for-single-rc branch June 4, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Affects datastore layer Labels to indicate a PR that changes the datastore layer. PR: LGTM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants