mirror of https://github.com/zulip/zulip.git
get_updates: Replace the "mirror" argument with checking "client".
(imported from commit bd84c2c7a456de8ea7ec35eaf76b5bf8647ca61a)
This commit is contained in:
parent
a6841c7f12
commit
a1d8e9d30f
|
@ -540,8 +540,7 @@ def humbug_to_zephyr(options):
|
|||
logger.info("Starting syncing messages.")
|
||||
while True:
|
||||
try:
|
||||
humbug_client.call_on_each_message(maybe_forward_to_zephyr,
|
||||
options={"mirror": 'zephyr_mirror'})
|
||||
humbug_client.call_on_each_message(maybe_forward_to_zephyr)
|
||||
except Exception:
|
||||
logger.exception("Error syncing messages:")
|
||||
time.sleep(1)
|
||||
|
|
|
@ -294,7 +294,7 @@ def get_old_messages_backend(request, anchor = POST(converter=to_non_negative_in
|
|||
def json_get_updates(request, user_profile, handler):
|
||||
client_id = request.session.session_key
|
||||
return get_updates_backend(request, user_profile, handler, client_id,
|
||||
apply_markdown=True)
|
||||
client=request._client, apply_markdown=True)
|
||||
|
||||
@asynchronous
|
||||
@authenticated_api_view
|
||||
|
@ -303,13 +303,13 @@ def api_get_messages(request, user_profile, handler, client_id=POST(default=None
|
|||
apply_markdown=POST(default=False, converter=simplejson.loads)):
|
||||
return get_updates_backend(request, user_profile, handler, client_id,
|
||||
apply_markdown=apply_markdown,
|
||||
mirror=request.POST.get("mirror"))
|
||||
client=request._client)
|
||||
|
||||
def format_updates_response(messages=[], apply_markdown=True,
|
||||
user_profile=None, new_pointer=None,
|
||||
mirror=None, update_types=[]):
|
||||
if mirror is not None:
|
||||
messages = [m for m in messages if m.sending_client.name != mirror]
|
||||
client=None, update_types=[]):
|
||||
if client is not None and client.name.endswith("_mirror"):
|
||||
messages = [m for m in messages if m.sending_client.name != client.name]
|
||||
ret = {'messages': [message.to_dict(apply_markdown) for message in messages],
|
||||
"result": "success",
|
||||
"msg": "",
|
||||
|
@ -357,9 +357,9 @@ def return_messages_immediately(user_profile, client_id, last,
|
|||
# to forward is one that was sent via the mirroring, the API
|
||||
# client will end up in an endless loop requesting more data from
|
||||
# us.
|
||||
if "mirror" in kwargs:
|
||||
if "client" in kwargs and kwargs["client"].name.endswith("_mirror"):
|
||||
messages = [m for m in messages if
|
||||
m.sending_client.name != kwargs["mirror"]]
|
||||
m.sending_client.name != kwargs["client"].name]
|
||||
|
||||
update_types = []
|
||||
if messages:
|
||||
|
|
Loading…
Reference in New Issue