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

fix: legacy reported content will send email based on discussion settings #34006

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lms/djangoapps/discussion/rest_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from lms.djangoapps.courseware.courses import get_course_with_access
from lms.djangoapps.courseware.exceptions import CourseAccessRedirect
from lms.djangoapps.discussion.toggles import ENABLE_DISCUSSIONS_MFE, ENABLE_LEARNERS_TAB_IN_DISCUSSIONS_MFE
from lms.djangoapps.discussion.toggles_utils import reported_content_email_notification_enabled
from lms.djangoapps.discussion.views import is_privileged_user
from openedx.core.djangoapps.discussions.models import (
DiscussionsConfiguration,
Expand Down Expand Up @@ -1367,8 +1366,7 @@ def _handle_abuse_flagged_field(form_value, user, cc_content, request):
if form_value:
cc_content.flagAbuse(user, cc_content)
track_discussion_reported_event(request, course, cc_content)
if ENABLE_DISCUSSIONS_MFE.is_enabled(course_key) and reported_content_email_notification_enabled(
course_key):
if ENABLE_DISCUSSIONS_MFE.is_enabled(course_key):
if cc_content.type == 'thread':
thread_flagged.send(sender='flag_abuse_for_thread', user=user, post=cc_content)
else:
Expand Down
3 changes: 3 additions & 0 deletions lms/djangoapps/discussion/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from six.moves.urllib.parse import urljoin

from lms.djangoapps.discussion.toggles import ENABLE_DISCUSSIONS_MFE
from lms.djangoapps.discussion.toggles_utils import reported_content_email_notification_enabled
from openedx.core.djangoapps.discussions.url_helpers import get_discussions_mfe_url
from xmodule.modulestore.django import modulestore

Expand Down Expand Up @@ -98,6 +99,8 @@ def send_ace_message(context): # lint-amnesty, pylint: disable=missing-function
def send_ace_message_for_reported_content(context): # lint-amnesty, pylint: disable=missing-function-docstring
context['course_id'] = CourseKey.from_string(context['course_id'])
context['course_name'] = modulestore().get_course(context['course_id']).display_name
if not reported_content_email_notification_enabled(context['course_id']):
return

moderators = get_users_with_moderator_roles(context)
context['site'] = Site.objects.get(id=context['site_id'])
Expand Down
Loading