mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +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) {
|
function send_presence_to_server(want_redraw) {
|
||||||
|
var status;
|
||||||
if (reload_state.is_in_progress()) {
|
if (reload_state.is_in_progress()) {
|
||||||
blueslip.log("Skipping querying presence because reload in progress");
|
blueslip.log("Skipping querying presence because reload in progress");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exports.client_is_active) {
|
||||||
|
status = exports.ACTIVE;
|
||||||
|
} else {
|
||||||
|
status = exports.IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
channel.post({
|
channel.post({
|
||||||
url: '/json/users/me/presence',
|
url: '/json/users/me/presence',
|
||||||
data: {status: exports.client_is_active ? exports.ACTIVE : exports.IDLE,
|
data: {
|
||||||
|
status: status,
|
||||||
ping_only: !want_redraw,
|
ping_only: !want_redraw,
|
||||||
new_user_input: exports.new_user_input},
|
new_user_input: exports.new_user_input,
|
||||||
|
},
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user