mirror of https://github.com/zulip/zulip.git
Clean up the update_pointer tornado notification code path.
(imported from commit 94997dea54e6cc8e5b5a314a95d6114773462608)
This commit is contained in:
parent
0507b1bb06
commit
167b883c38
|
@ -1497,11 +1497,8 @@ def do_update_pointer(user_profile, pointer, update_flags=False):
|
||||||
flags=~UserMessage.flags.read) \
|
flags=~UserMessage.flags.read) \
|
||||||
.update(flags=F('flags').bitor(UserMessage.flags.read))
|
.update(flags=F('flags').bitor(UserMessage.flags.read))
|
||||||
|
|
||||||
if settings.TORNADO_SERVER:
|
event = dict(type='pointer', pointer=pointer)
|
||||||
tornado_callbacks.send_notification(dict(
|
send_event(event, [user_profile.id])
|
||||||
type = 'pointer_update',
|
|
||||||
user = user_profile.id,
|
|
||||||
new_pointer = pointer))
|
|
||||||
|
|
||||||
def do_update_message_flags(user_profile, operation, flag, messages, all):
|
def do_update_message_flags(user_profile, operation, flag, messages, all):
|
||||||
flagattr = getattr(UserMessage.flags, flag)
|
flagattr = getattr(UserMessage.flags, flag)
|
||||||
|
|
|
@ -25,12 +25,6 @@ import datetime
|
||||||
# after they are idle for 1 hour
|
# after they are idle for 1 hour
|
||||||
NOTIFY_AFTER_IDLE_HOURS = 1
|
NOTIFY_AFTER_IDLE_HOURS = 1
|
||||||
|
|
||||||
def update_pointer(user_profile_id, new_pointer):
|
|
||||||
event = dict(type='pointer', pointer=new_pointer)
|
|
||||||
for client in get_client_descriptors_for_user(user_profile_id):
|
|
||||||
if client.accepts_event(event):
|
|
||||||
client.add_event(event.copy())
|
|
||||||
|
|
||||||
def build_offline_notification_event(user_profile_id, message_id):
|
def build_offline_notification_event(user_profile_id, message_id):
|
||||||
return {"user_profile_id": user_profile_id,
|
return {"user_profile_id": user_profile_id,
|
||||||
"message_id": message_id,
|
"message_id": message_id,
|
||||||
|
@ -222,8 +216,6 @@ def process_notification(data):
|
||||||
process_new_message(data)
|
process_new_message(data)
|
||||||
elif data['type'] == 'update_message':
|
elif data['type'] == 'update_message':
|
||||||
process_update_message(data)
|
process_update_message(data)
|
||||||
elif data['type'] == 'pointer_update':
|
|
||||||
update_pointer(data['user'], data['new_pointer'])
|
|
||||||
else:
|
else:
|
||||||
raise JsonableError('bad notification type ' + data['type'])
|
raise JsonableError('bad notification type ' + data['type'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue