send_message: Don't create streams automatically on send.

(imported from commit 7be1b72c5fdf9a21167d2be3948cf1febf8da8ed)
This commit is contained in:
Tim Abbott 2012-10-30 15:02:28 -04:00
parent 2c577d70b3
commit 4e9df28c12
1 changed files with 4 additions and 1 deletions

View File

@ -633,7 +633,10 @@ def send_message_backend(request, user_profile, sender, client_name=None):
# if not valid_stream_name(subject_name): # if not valid_stream_name(subject_name):
# return json_error("Invalid subject name") # return json_error("Invalid subject name")
stream = create_stream_if_needed(user_profile.realm, stream_name) try:
stream = Stream.objects.get(realm=user_profile.realm, name__iexact=stream_name)
except Stream.DoesNotExist:
return json_error("Stream does not exist")
recipient = Recipient.objects.get(type_id=stream.id, type=Recipient.STREAM) recipient = Recipient.objects.get(type_id=stream.id, type=Recipient.STREAM)
elif message_type_name == 'personal': elif message_type_name == 'personal':
if "recipient" not in request.POST: if "recipient" not in request.POST: