mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
electron_bridge: Use getter and setter interface to mutable properties.
This exists in all versions of the desktop app that we still support, and will eventually let us delete a bit of annoying compatibility code from the desktop app’s injected JavaScript. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
25c5856988
commit
e701f20861
@@ -868,14 +868,14 @@ run_test('electron_bridge', () => {
|
|||||||
assert.equal(activity.compute_active_status(), activity.ACTIVE);
|
assert.equal(activity.compute_active_status(), activity.ACTIVE);
|
||||||
|
|
||||||
window.electron_bridge = {
|
window.electron_bridge = {
|
||||||
idle_on_system: true,
|
get_idle_on_system: () => true,
|
||||||
};
|
};
|
||||||
assert.equal(activity.compute_active_status(), activity.IDLE);
|
assert.equal(activity.compute_active_status(), activity.IDLE);
|
||||||
activity.client_is_active = false;
|
activity.client_is_active = false;
|
||||||
assert.equal(activity.compute_active_status(), activity.IDLE);
|
assert.equal(activity.compute_active_status(), activity.IDLE);
|
||||||
|
|
||||||
window.electron_bridge = {
|
window.electron_bridge = {
|
||||||
idle_on_system: false,
|
get_idle_on_system: () => false,
|
||||||
};
|
};
|
||||||
assert.equal(activity.compute_active_status(), activity.ACTIVE);
|
assert.equal(activity.compute_active_status(), activity.ACTIVE);
|
||||||
activity.client_is_active = true;
|
activity.client_is_active = true;
|
||||||
|
|||||||
@@ -272,11 +272,11 @@ exports.compute_active_status = function () {
|
|||||||
// * For the electron desktop app, we also know whether the
|
// * For the electron desktop app, we also know whether the
|
||||||
// user is active or idle elsewhere on their system.
|
// user is active or idle elsewhere on their system.
|
||||||
//
|
//
|
||||||
// The check for `idle_on_system === undefined` is feature
|
// The check for `get_idle_on_system === undefined` is feature
|
||||||
// detection; older desktop app releases never set that property.
|
// detection; older desktop app releases never set that property.
|
||||||
if (window.electron_bridge !== undefined
|
if (window.electron_bridge !== undefined
|
||||||
&& window.electron_bridge.idle_on_system !== undefined) {
|
&& window.electron_bridge.get_idle_on_system !== undefined) {
|
||||||
if (window.electron_bridge.idle_on_system) {
|
if (window.electron_bridge.get_idle_on_system()) {
|
||||||
return exports.IDLE;
|
return exports.IDLE;
|
||||||
}
|
}
|
||||||
return exports.ACTIVE;
|
return exports.ACTIVE;
|
||||||
|
|||||||
@@ -271,7 +271,9 @@ if (window.electron_bridge !== undefined) {
|
|||||||
// is often referred to as inline reply feature. This is done so desktop app doesn't
|
// is often referred to as inline reply feature. This is done so desktop app doesn't
|
||||||
// have to depend on channel.post for setting crsf_token and narrow.by_topic
|
// have to depend on channel.post for setting crsf_token and narrow.by_topic
|
||||||
// to narrow to the message being sent.
|
// to narrow to the message being sent.
|
||||||
window.electron_bridge.send_notification_reply_message_supported = true;
|
if (window.electron_bridge.set_send_notification_reply_message_supported !== undefined) {
|
||||||
|
window.electron_bridge.set_send_notification_reply_message_supported(true);
|
||||||
|
}
|
||||||
window.electron_bridge.on_event('send_notification_reply_message', function (message_id, reply) {
|
window.electron_bridge.on_event('send_notification_reply_message', function (message_id, reply) {
|
||||||
const message = message_store.get(message_id);
|
const message = message_store.get(message_id);
|
||||||
const data = {
|
const data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user