Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Activate conversations when they are created
Browse files Browse the repository at this point in the history
  • Loading branch information
justinvdm committed Apr 23, 2015
1 parent 61dc9aa commit 675c038
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions go/conversation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 4 additions & 2 deletions go/conversation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 675c038

Please sign in to comment.