mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
presence: Add slim_presence flag.
This flag affects page_params and the
payload you get back from POSTs to this
url:
users/me/presence
The flag does not yet affect the
presence events that get sent to a
client.
This commit is contained in:
@@ -305,6 +305,7 @@ function send_presence_to_server(want_redraw) {
|
||||
status: exports.compute_active_status(),
|
||||
ping_only: !want_redraw,
|
||||
new_user_input: exports.new_user_input,
|
||||
slim_presence: true,
|
||||
},
|
||||
idempotent: true,
|
||||
success: function (data) {
|
||||
|
||||
@@ -96,27 +96,12 @@ exports.set_info_for_user = function (user_id, info, server_time) {
|
||||
|
||||
exports.set_info = function (presences, server_timestamp) {
|
||||
exports.presence_info = {};
|
||||
_.each(presences, function (info, this_email) {
|
||||
const person = people.get_by_email(this_email);
|
||||
_.each(presences, function (info, user_id_str) {
|
||||
const status = status_from_timestamp(server_timestamp,
|
||||
info);
|
||||
|
||||
if (person === undefined) {
|
||||
if (!(server_events.suspect_offline || reload_state.is_in_progress())) {
|
||||
// If we're online, and we get a user who we don't
|
||||
// know about in the presence data, throw an error.
|
||||
blueslip.error('Unknown email in presence data: ' + this_email);
|
||||
}
|
||||
// Either way, we deal by skipping this user and
|
||||
// rendering everyone else, to avoid disruption.
|
||||
return;
|
||||
}
|
||||
|
||||
const user_id = person.user_id;
|
||||
|
||||
if (user_id) {
|
||||
const status = status_from_timestamp(server_timestamp,
|
||||
info);
|
||||
exports.presence_info[user_id] = status;
|
||||
}
|
||||
const user_id = parseInt(user_id_str, 10);
|
||||
exports.presence_info[user_id] = status;
|
||||
});
|
||||
exports.update_info_for_small_realm();
|
||||
};
|
||||
|
||||
@@ -198,6 +198,7 @@ function get_events(options) {
|
||||
}
|
||||
|
||||
get_events_params.client_gravatar = true;
|
||||
get_events_params.slim_presence = true;
|
||||
|
||||
get_events_timeout = undefined;
|
||||
get_events_xhr = channel.get({
|
||||
|
||||
Reference in New Issue
Block a user