From 675c03877408d31ab5f19abef0ac372f50c49aae Mon Sep 17 00:00:00 2001 From: justinvdm Date: Thu, 23 Apr 2015 13:36:06 +0200 Subject: [PATCH] Activate conversations when they are created --- go/conversation/tests.py | 15 +++++++++++++++ go/conversation/views.py | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/go/conversation/tests.py b/go/conversation/tests.py index c28536935..a35a4060d 100644 --- a/go/conversation/tests.py +++ b/go/conversation/tests.py @@ -336,6 +336,21 @@ def test_post_new_conversation_default_config(self): 'description': 'a new conversation' }) + def test_post_new_conversation_starting(self): + self.user_helper.add_app_permission(u'gotest.dummy') + + conv_data = { + 'name': 'new conv', + 'conversation_type': 'dummy', + } + + response = self.client.post( + reverse('conversations:new_conversation'), + conv_data) + + [conv] = self.user_helper.user_api.active_conversations() + self.assertTrue(conv.starting()) + class TestConversationViews(BaseConversationViewTestCase): def setUp(self): diff --git a/go/conversation/views.py b/go/conversation/views.py index 081006172..2213c823b 100644 --- a/go/conversation/views.py +++ b/go/conversation/views.py @@ -106,8 +106,10 @@ def new_conversation(request): conv = request.user_api.new_conversation( conversation_type, name=name, description=description, config=config, - extra_endpoints=list(view_def.extra_static_endpoints), - ) + extra_endpoints=list(view_def.extra_static_endpoints)) + conv = request.user_api.wrap_conversation(conv) + conv.start() + messages.info(request, 'Conversation created successfully.') # Get a new view_def with a conversation object in it.