diff --git a/hypha/apply/activity/messaging.py b/hypha/apply/activity/messaging.py index 4a08bb273fc2cd8669aea98e3299726baec85c0c..944532c958d333b4c6fa9f495278155764469b39 100644 --- a/hypha/apply/activity/messaging.py +++ b/hypha/apply/activity/messaging.py @@ -716,10 +716,8 @@ class SlackAdapter(AdapterBase): def send_message(self, message, recipient, source, **kwargs): target_rooms = self.slack_channels(source, **kwargs) - if not self.destination or not any(target_rooms) or not settings.SLACK_TOKEN: + if not any(target_rooms) or not settings.SLACK_TOKEN: errors = list() - if not self.destination: - errors.append('Destination URL') if not target_rooms: errors.append('Room ID') if not settings.SLACK_TOKEN: diff --git a/hypha/apply/activity/tests/test_messaging.py b/hypha/apply/activity/tests/test_messaging.py index 99cc3281f5864754f5a0307524a2433160f62457..b2cdac2811efa76762e9b802e6c8cb21cef2a94a 100644 --- a/hypha/apply/activity/tests/test_messaging.py +++ b/hypha/apply/activity/tests/test_messaging.py @@ -349,18 +349,6 @@ class TestSlackAdapter(AdapterMixin, TestCase): messages = adapter.send_message('my message', '', source=submission) self.assertEqual(messages, error_message) - @override_settings( - SLACK_ENDPOINT_URL=None, - SLACK_DESTINATION_ROOM=target_room, - SLACK_BACKEND=backend, - SLACK_TOKEN=token, - ) - def test_cant_send_with_no_url(self): - error_message = "Missing configuration: Destination URL" - adapter = SlackAdapter() - submission = ApplicationSubmissionFactory() - messages = adapter.send_message('my message', '', source=submission) - self.assertEqual(messages, error_message) @override_settings( SLACK_ENDPOINT_URL=target_url, diff --git a/hypha/settings/base.py b/hypha/settings/base.py index ba35678a1a8997b1d9e60328d09b65fef8140fa3..f8a2e68a151ca72646cf4638c34067f3ef206269 100644 --- a/hypha/settings/base.py +++ b/hypha/settings/base.py @@ -522,9 +522,9 @@ SEND_READY_FOR_REVIEW = env.bool('SEND_READY_FOR_REVIEW', True) # Django Slack settings SLACK_TOKEN = env.str('SLACK_TOKEN', None) -SLACK_USERNAME = env.str('SLACK_USERNAME', 'bot') +SLACK_USERNAME = env.str('SLACK_USERNAME', 'Hypha') SLACK_BACKEND = 'django_slack.backends.CeleryBackend' # UrllibBackend can be used for sync -SLACK_ENDPOINT_URL = env.str('SLACK_ENDPOINT_URL', None) +SLACK_ENDPOINT_URL = env.str('SLACK_ENDPOINT_URL', 'https://slack.com/api/chat.postMessage') # Slack settings SLACK_DESTINATION_ROOM = env.str('SLACK_DESTINATION_ROOM', None)