mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
activity: Refactor logic for sending active status.
This is a preparatory refactor for extending this logic to interact with the desktop app as well.
This commit is contained in:
@@ -262,15 +262,25 @@ exports.update_huddles = function () {
|
||||
};
|
||||
|
||||
function send_presence_to_server(want_redraw) {
|
||||
var status;
|
||||
if (reload_state.is_in_progress()) {
|
||||
blueslip.log("Skipping querying presence because reload in progress");
|
||||
return;
|
||||
}
|
||||
|
||||
if (exports.client_is_active) {
|
||||
status = exports.ACTIVE;
|
||||
} else {
|
||||
status = exports.IDLE;
|
||||
}
|
||||
|
||||
channel.post({
|
||||
url: '/json/users/me/presence',
|
||||
data: {status: exports.client_is_active ? exports.ACTIVE : exports.IDLE,
|
||||
ping_only: !want_redraw,
|
||||
new_user_input: exports.new_user_input},
|
||||
data: {
|
||||
status: status,
|
||||
ping_only: !want_redraw,
|
||||
new_user_input: exports.new_user_input,
|
||||
},
|
||||
idempotent: true,
|
||||
success: function (data) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user