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

feat: emit signal for thread, response, and comment created event #33395

Merged

Conversation

Ian2012
Copy link
Contributor

@Ian2012 Ian2012 commented Oct 2, 2023

Description

This PR emits an Open edX signal for forum events.

The signals are specified in the following PR: openedx/openedx-events#273

Testing instructions:

  • Install https://github.com/eduNEXT/platform-plugin-forum-email-notifier.
  • Go to the Discussions page in the demo course.
  • Create a post
  • Comment in the post
  • Answer a comment in the post
  • As this plugin is already listening for the Open edX events signal emitted here, verify an email is created in the LMS pod in tyhe folder /tmp/openedx/emails/. There should be three emails

Dependencies

This PR depends on openedx/openedx-events#273

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 2, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 2, 2023

Thanks for the pull request, @Ian2012! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

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

  • supporting documentation
  • Open edX discussion forum 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 be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@Ian2012 Ian2012 marked this pull request as ready for review October 9, 2023 14:22
@Ian2012 Ian2012 force-pushed the cag/add-signal-for-thread-created-event branch from cdf42dc to df7db7d Compare October 9, 2023 14:28
@@ -406,15 +406,15 @@ def inner(self, default_store, block_count, mongo_calls, sql_queries, *args, **k
return inner

@ddt.data(
(ModuleStoreEnum.Type.split, 3, 8, 42),
(ModuleStoreEnum.Type.split, 3, 8, 43),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One additional for the user.profile.name

@Ian2012 Ian2012 force-pushed the cag/add-signal-for-thread-created-event branch 2 times, most recently from 68ca893 to d855664 Compare October 9, 2023 16:49
@Ian2012 Ian2012 requested a review from mariajgrimaldi October 9, 2023 19:08
@Ian2012
Copy link
Contributor Author

Ian2012 commented Oct 9, 2023

@mariajgrimaldi this is ready for review

requirements/edx/testing.txt Outdated Show resolved Hide resolved
@Ian2012 Ian2012 force-pushed the cag/add-signal-for-thread-created-event branch from d855664 to 779ab75 Compare October 19, 2023 19:46
Copy link
Member

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

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

Some comments left to address. Thanks!

@mariajgrimaldi mariajgrimaldi self-requested a review October 19, 2023 20:21
@Ian2012 Ian2012 force-pushed the cag/add-signal-for-thread-created-event branch 3 times, most recently from 489b734 to 1716c67 Compare October 24, 2023 19:01
@mariajgrimaldi
Copy link
Member

@Ian2012: can we add some testing instructions to the PR cover letter? Thanks!

@Ian2012 Ian2012 force-pushed the cag/add-signal-for-thread-created-event branch from 496c4b1 to a3d7e27 Compare October 25, 2023 13:02
@mariajgrimaldi
Copy link
Member

Thanks! I'll be testing this out. But it's looking good!

@mariajgrimaldi
Copy link
Member

I tested this by:

  1. Installing the test plugin: https://github.com/eduNEXT/platform-plugin-forum-email-notifier. Which creates tasks for sending emails every time:
  • A post is created
  • A comment to a post is created
  • A response to a comment is created
  1. Then, execute each previous actions using the Legacy UI (it's the one I have enabled in my local environment). This is what I got:
    Screenshot from 2023-10-26 13-17-12
    Screenshot from 2023-10-26 13-15-46
    Screenshot from 2023-10-26 13-16-41
    Screenshot from 2023-10-26 13-17-34
    This also works using the discussions MFE since it's the same backend. Right? Could you confirm that?

@Ian2012
Copy link
Contributor Author

Ian2012 commented Oct 26, 2023

Yes, this was tested with the discussions MFE enabled and it was working as expected as the backend is the same:

this is the output from our lms-worker in production environment:
image

2023-10-26 17:35:28,697 INFO 1 [celery.worker.strategy] [user None] [ip None] strategy.py:161 - Task platform_plugin_forum_email_notifier.tasks.notify_users[2666e0a2-e739-428f-8063-f54eb0ea709c] received
2023-10-26 17:35:28,719 INFO 10 [xapi_tracking] [user None] [ip None] transformer_processor.py:55 - {"id": "8bcf8dff-e0a7-5406-a554-5de4a74fc31f", "version": "1.0.3", "actor": {"objectType": "Agent", "account": {"name": "8f6750f0-d220-49bb-90d7-5abd9d7cd744", "homePage": "https://lms.san-sebastian.athena.edunext.link"}}, "verb": {"id": "https://w3id.org/xapi/acrossx/verbs/posted", "display": {"en": "posted"}}, "object": {"id": "https://lms.san-sebastian.athena.edunext.link/api/discussion/v1/threads/653aa3603c8bec0018a519fb", "objectType": "Activity", "definition": {"type": "http://id.tincanapi.com/activitytype/discussion"}}, "timestamp": "2023-10-26T17:35:28.615980+00:00", "context": {"contextActivities": {"parent": [{"id": "https://lms.san-sebastian.athena.edunext.link/course/course-v1:DEMO+H5P+V1", "objectType": "Activity", "definition": {"name": {"en-US": "Partida 12 - h5p"}, "type": "http://adlnet.gov/expapi/activities/course"}}]}, "extensions": {"https://w3id.org/xapi/openedx/extension/transformer-version": "[email protected]", "https://w3id.org/xapi/openedx/extensions/session-id": "5120f75171d363478a2897f9f6486df4", "https://w3id.org/xapi/acrossx/extensions/type": "discussion"}}}
2023-10-26 17:35:28,731 INFO 1 [celery.worker.strategy] [user None] [ip None] strategy.py:161 - Task event_routing_backends.tasks.dispatch_event[76ab6873-15ed-40a4-bf6d-957bbb184fd3] received
2023-10-26 17:35:28,734 INFO 10 [celery.app.trace] [user None] [ip None] trace.py:131 - Task eventtracking.tasks.send_event[800c5afc-db5f-4f4f-ac89-a7dbaf9a8b2a] succeeded in 0.04411794990301132s: None2023-10-26 17:35:28,744 INFO 1 [celery.worker.strategy] [user None] [ip None] strategy.py:161 - Task platform_plugin_forum_email_notifier.tasks.send_email_notification[243b6648-f401-4c11-b84a-286ba52a4ae2] received
2023-10-26 17:35:28,750 INFO 1 [celery.worker.strategy] [user None] [ip None] strategy.py:161 - Task platform_plugin_forum_email_notifier.tasks.handle_digests[43ffb5b4-9103-4979-b771-8b4d606225fa] received
2023-10-26 17:35:28,753 INFO 11 [celery.app.trace] [user None] [ip None] trace.py:131 - Task platform_plugin_forum_email_notifier.tasks.notify_users[2666e0a2-e739-428f-8063-f54eb0ea709c] succeeded in 0.05476642306894064s: None
2023-10-26 17:35:28,974 INFO 11 [celery.app.trace] [user None] [ip None] trace.py:131 - Task platform_plugin_forum_email_notifier.tasks.send_email_notification[243b6648-f401-4c11-b84a-286ba52a4ae2] succeeded in 0.21663694735616446s: None
2023-10-26 17:35:29,000 INFO 11 [celery.app.trace] [user None] [ip None] trace.py:131 - Task platform_plugin_forum_email_notifier.tasks.handle_digests[43ffb5b4-9103-4979-b771-8b4d606225fa] succeeded in 0.022076027002185583s: None

@Ian2012 Ian2012 force-pushed the cag/add-signal-for-thread-created-event branch 4 times, most recently from 1902638 to 11e024b Compare October 26, 2023 18:42
@Ian2012 Ian2012 force-pushed the cag/add-signal-for-thread-created-event branch from 11e024b to 0baac4c Compare October 26, 2023 18:42
Copy link
Member

@mariajgrimaldi mariajgrimaldi left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you so much. I'll post this PR in the #edx-platform slack channel for merging next week (so we don't merge on a Friday).

@mariajgrimaldi
Copy link
Member

I'll merge this now! Look at this thread for more info the merge timing.

@mariajgrimaldi mariajgrimaldi merged commit 9e65024 into openedx:master Oct 30, 2023
64 checks passed
@openedx-webhooks
Copy link

@Ian2012 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants