Commit f60b4fc2 authored by JC Brand's avatar JC Brand

`auto_away` shouldn't change the user's status if it's set to `dnd`

Fixes #620
parent 9779e839
......@@ -57,6 +57,7 @@
[muc_show_join_leave](https://conversejs.org/docs/html/configuration.html#muc-show-join-leave)
- #366 Show the chat room occupant's JID in the tooltip (if you're allowed to see it). [jcbrand]
- #610, #785 Add presence priority handling [w3host, jcbrand]
- #620 `auto_away` shouldn't change the user's status if it's set to `dnd`. [jcbrand]
- #694 The `notification_option` wasn't being used consistently. [jcbrand]
- #745 New config option [priority](https://conversejs.org/docs/html/configuration.html#priority) [jcbrand]
- #770 Allow setting contact attrs on chats.open [Ape]
......
......@@ -96,13 +96,31 @@
_converse.auto_xa = 6;
expect(_converse.xmppstatus.getStatus()).toBe('online');
while (i <= _converse.auto_away) {
_converse.onEverySecond(); i++;
}
expect(_converse.auto_changed_status).toBe(true);
while (i <= _converse.auto_xa) {
expect(_converse.xmppstatus.getStatus()).toBe('away');
_converse.onEverySecond();
i++;
}
expect(_converse.xmppstatus.getStatus()).toBe('xa');
expect(_converse.auto_changed_status).toBe(true);
_converse.onUserActivity();
expect(_converse.xmppstatus.getStatus()).toBe('online');
expect(_converse.auto_changed_status).toBe(false);
// Check that it also works for the chat feature
_converse.xmppstatus.setStatus('chat');
i = 0;
while (i <= _converse.auto_away) {
_converse.onEverySecond();
i++;
}
expect(_converse.auto_changed_status).toBe(true);
while (i <= _converse.auto_xa) {
expect(_converse.xmppstatus.getStatus()).toBe('away');
_converse.onEverySecond();
......@@ -115,10 +133,26 @@
expect(_converse.xmppstatus.getStatus()).toBe('online');
expect(_converse.auto_changed_status).toBe(false);
// Reset values
_converse.auto_away = 0;
_converse.auto_xa = 0;
_converse.auto_changed_status = false;
// Check that it doesn't work for 'dnd'
_converse.xmppstatus.setStatus('dnd');
i = 0;
while (i <= _converse.auto_away) {
_converse.onEverySecond();
i++;
}
expect(_converse.xmppstatus.getStatus()).toBe('dnd');
expect(_converse.auto_changed_status).toBe(false);
while (i <= _converse.auto_xa) {
expect(_converse.xmppstatus.getStatus()).toBe('dnd');
_converse.onEverySecond();
i++;
}
expect(_converse.xmppstatus.getStatus()).toBe('dnd');
expect(_converse.auto_changed_status).toBe(false);
_converse.onUserActivity();
expect(_converse.xmppstatus.getStatus()).toBe('dnd');
expect(_converse.auto_changed_status).toBe(false);
}));
});
......
......@@ -350,11 +350,12 @@
}
if (_converse.auto_away > 0 &&
_converse.idle_seconds > _converse.auto_away &&
stat !== 'away' && stat !== 'xa') {
stat !== 'away' && stat !== 'xa' && stat !== 'dnd') {
_converse.auto_changed_status = true;
_converse.xmppstatus.setStatus('away');
} else if (_converse.auto_xa > 0 &&
_converse.idle_seconds > _converse.auto_xa && stat !== 'xa') {
_converse.idle_seconds > _converse.auto_xa &&
stat !== 'xa' && stat !== 'dnd') {
_converse.auto_changed_status = true;
_converse.xmppstatus.setStatus('xa');
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment