mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
Preparatory changes to Tornado server for receiving a single stream's messages
Doesn't yet add the API for actually doing so. (imported from commit a2062d71544441256a41f817388bb0c7ea6891ff)
This commit is contained in:
@@ -168,10 +168,21 @@ def do_send_message(message, no_log=False):
|
||||
# doesn't have to.
|
||||
message.to_dict(apply_markdown=True)
|
||||
message.to_dict(apply_markdown=False)
|
||||
requests.post(settings.TORNADO_SERVER + '/notify_new_message', data=dict(
|
||||
data = dict(
|
||||
secret = settings.SHARED_SECRET,
|
||||
message = message.id,
|
||||
users = simplejson.dumps([str(user.id) for user in recipients])))
|
||||
users = simplejson.dumps([str(user.id) for user in recipients]))
|
||||
if message.recipient.type == Recipient.STREAM:
|
||||
# Note: This is where authorization for single-stream
|
||||
# get_updates happens! We only attach stream data to the
|
||||
# notify_new_message request if it's a public stream,
|
||||
# ensuring that in the tornado server, non-public stream
|
||||
# messages are only associated to their subscribed users.
|
||||
stream = Stream.objects.get(id=message.recipient.type_id)
|
||||
if stream.is_public():
|
||||
data['realm_id'] = stream.realm.id
|
||||
data['stream_name'] = stream.name
|
||||
requests.post(settings.TORNADO_SERVER + '/notify_new_message', data=data)
|
||||
|
||||
def create_stream_if_needed(realm, stream_name):
|
||||
(stream, created) = Stream.objects.get_or_create(
|
||||
|
||||
Reference in New Issue
Block a user