Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
f52f0914
Commit
f52f0914
authored
Dec 06, 2017
by
sandroroux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed enable_forum_notifications
parent
b3bbc159
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
40 deletions
+0
-40
lms/djangoapps/discussion/signals/handlers.py
+0
-11
lms/djangoapps/discussion/tests/test_signals.py
+0
-25
lms/djangoapps/discussion/tests/test_tasks.py
+0
-4
No files found.
lms/djangoapps/discussion/signals/handlers.py
View file @
f52f0914
...
...
@@ -7,7 +7,6 @@ from django.dispatch import receiver
from
opaque_keys.edx.keys
import
CourseKey
from
django_comment_common
import
signals
from
lms.djangoapps.discussion.config.waffle
import
waffle
,
FORUM_RESPONSE_NOTIFICATIONS
from
lms.djangoapps.discussion
import
tasks
from
openedx.core.djangoapps.site_configuration.models
import
SiteConfiguration
from
openedx.core.djangoapps.theming.helpers
import
get_current_site
...
...
@@ -26,16 +25,6 @@ def send_discussion_email_notification(sender, user, post, **kwargs):
log
.
info
(
'Discussion: No current site, not sending notification about post:
%
s.'
,
post
.
id
)
return
try
:
if
not
current_site
.
configuration
.
get_value
(
ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY
,
False
):
log_message
=
'Discussion: notifications not enabled for site:
%
s. Not sending message about post:
%
s.'
log
.
info
(
log_message
,
current_site
,
post
.
id
)
return
except
SiteConfiguration
.
DoesNotExist
:
log_message
=
'Discussion: No SiteConfiguration for site
%
s. Not sending message about post:
%
s.'
log
.
info
(
log_message
,
current_site
,
post
.
id
)
return
send_message
(
post
,
current_site
)
...
...
lms/djangoapps/discussion/tests/test_signals.py
View file @
f52f0914
...
...
@@ -2,7 +2,6 @@ from django.test import TestCase
import
mock
from
django_comment_common
import
signals
from
lms.djangoapps.discussion.signals.handlers
import
ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY
from
openedx.core.djangoapps.site_configuration.tests.factories
import
SiteFactory
,
SiteConfigurationFactory
from
openedx.core.djangoapps.waffle_utils.testutils
import
override_waffle_flag
...
...
@@ -19,9 +18,6 @@ class SendMessageHandlerTestCase(TestCase):
@mock.patch
(
'lms.djangoapps.discussion.signals.handlers.get_current_site'
)
@mock.patch
(
'lms.djangoapps.discussion.signals.handlers.send_message'
)
def
test_comment_created_signal_sends_message
(
self
,
mock_send_message
,
mock_get_current_site
):
site_config
=
SiteConfigurationFactory
.
create
(
site
=
self
.
site
)
site_config
.
values
[
ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY
]
=
True
site_config
.
save
()
mock_get_current_site
.
return_value
=
self
.
site
signals
.
comment_created
.
send
(
sender
=
self
.
sender
,
user
=
self
.
user
,
post
=
self
.
post
)
...
...
@@ -45,24 +41,3 @@ class SendMessageHandlerTestCase(TestCase):
signals
.
comment_created
.
send
(
sender
=
self
.
sender
,
user
=
self
.
user
,
post
=
self
.
post
)
self
.
assertFalse
(
mock_send_message
.
called
)
@mock.patch
(
'lms.djangoapps.discussion.signals.handlers.get_current_site'
)
@mock.patch
(
'lms.djangoapps.discussion.signals.handlers.send_message'
)
def
test_comment_created_signal_msg_not_sent_without_site_config
(
self
,
mock_send_message
,
mock_get_current_site
):
mock_get_current_site
.
return_value
=
self
.
site
signals
.
comment_created
.
send
(
sender
=
self
.
sender
,
user
=
self
.
user
,
post
=
self
.
post
)
self
.
assertFalse
(
mock_send_message
.
called
)
@mock.patch
(
'lms.djangoapps.discussion.signals.handlers.get_current_site'
)
@mock.patch
(
'lms.djangoapps.discussion.signals.handlers.send_message'
)
def
test_comment_created_signal_msg_not_sent_with_site_config_disabled
(
self
,
mock_send_message
,
mock_get_current_site
):
site_config
=
SiteConfigurationFactory
.
create
(
site
=
self
.
site
)
site_config
.
values
[
ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY
]
=
False
site_config
.
save
()
mock_get_current_site
.
return_value
=
self
.
site
signals
.
comment_created
.
send
(
sender
=
self
.
sender
,
user
=
self
.
user
,
post
=
self
.
post
)
self
.
assertFalse
(
mock_send_message
.
called
)
lms/djangoapps/discussion/tests/test_tasks.py
View file @
f52f0914
...
...
@@ -17,7 +17,6 @@ from django_comment_common.signals import comment_created
from
edx_ace.recipient
import
Recipient
from
edx_ace.renderers
import
EmailRenderer
from
edx_ace.utils
import
date
from
lms.djangoapps.discussion.signals.handlers
import
ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY
from
lms.djangoapps.discussion.tasks
import
_should_send_message
from
openedx.core.djangoapps.content.course_overviews.tests.factories
import
CourseOverviewFactory
from
openedx.core.djangoapps.ace_common.template_context
import
get_base_template_context
...
...
@@ -183,9 +182,6 @@ class TaskTestCase(ModuleStoreTestCase):
user
=
mock
.
Mock
()
comment
=
cc
.
Comment
.
find
(
id
=
self
.
comment
[
'id'
])
.
retrieve
()
site
=
Site
.
objects
.
get_current
()
site_config
=
SiteConfigurationFactory
.
create
(
site
=
site
)
site_config
.
values
[
ENABLE_FORUM_NOTIFICATIONS_FOR_SITE_KEY
]
=
True
site_config
.
save
()
with
mock
.
patch
(
'lms.djangoapps.discussion.signals.handlers.get_current_site'
,
return_value
=
site
):
comment_created
.
send
(
sender
=
None
,
user
=
user
,
post
=
comment
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment