mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
Add typing notifications front end.
Send typing notification events when user types in the compose box. Listen for these events and display a notification. Sending notifications: Notifications are throttled, so that start notifications are sent every 10 seconds of active typing, and stop notifications are sent 5 seconds after active typing stops or when the compose box is closed. Displaying notifications: When a typing notification is received, if the current narrow is private messages or is: pm-with and the user is not the sender, "Othello is typing..." is displayed underneath the last message. This notification is removed after 15 seconds. If another notification is received during this period, the expiration is extended. When a stop notification is received the notification is removed. Internally, a list of users currently typing is maintained for each conversation (in a dict). When an event is received the list (for the appropriate conversation) is updated and the notifications template is re-rendered based on the narrow information. This template is also re-rendered when the narrow changes. Significantly modified by tabbott for clarity. Fixes #150.
This commit is contained in:
committed by
Tim Abbott
parent
25488b550f
commit
e073220e21
@@ -234,6 +234,20 @@ function dispatch_normal_event(event) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'typing':
|
||||
if (event.sender.user_id === page_params.user_id) {
|
||||
// typing notifications are sent to the user who is typing
|
||||
// as well as recipients; we ignore such self-generated events.
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.op === 'start') {
|
||||
typing.display_notification(event);
|
||||
} else if (event.op === 'stop') {
|
||||
typing.hide_notification(event);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update_display_settings':
|
||||
if (event.setting_name === 'twenty_four_hour_time') {
|
||||
page_params.twenty_four_hour_time = event.setting;
|
||||
|
||||
Reference in New Issue
Block a user