Skip to content

Commit 34fcf4b

Browse files
josaphatimamaninyumu1
authored andcommitted
Fix selenium tests
1 parent b10344e commit 34fcf4b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

modules/smtp/site.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -391,21 +391,23 @@ function smtpSettingsPageHandler() {
391391
}
392392

393393
$(function() {
394-
var scheduled_msg_count = 0;
395-
var sendScheduledMessages = function() {
396-
Hm_Ajax.request(
397-
[{'name': 'hm_ajax_hook', 'value': 'ajax_send_scheduled_messages'}],
398-
function(res) {
399-
scheduled_msg_count = res.scheduled_msg_count;
400-
},
401-
);
402-
}
403-
404-
sendScheduledMessages();
405-
setInterval(sendScheduledMessages, 60000);
406-
window.onbeforeunload = (e) => {
407-
if (scheduled_msg_count > 0 && e.currentTarget.location.hostname !== document.location.hostname) {
408-
return sprintf(hm_trans("You have %d scheduled messages that won\'t be executed if you quit"), scheduled_msg_count);
394+
if (hm_is_logged()) {
395+
var scheduled_msg_count = 0;
396+
var sendScheduledMessages = function() {
397+
Hm_Ajax.request(
398+
[{'name': 'hm_ajax_hook', 'value': 'ajax_send_scheduled_messages'}],
399+
function(res) {
400+
scheduled_msg_count = res.scheduled_msg_count;
401+
},
402+
);
409403
}
410-
};
404+
405+
sendScheduledMessages();
406+
setInterval(sendScheduledMessages, 60000);
407+
window.onbeforeunload = (e) => {
408+
if (scheduled_msg_count > 0 && e.currentTarget.location.hostname !== document.location.hostname) {
409+
return sprintf(hm_trans("You have %d scheduled messages that won\'t be executed if you quit"), scheduled_msg_count);
410+
}
411+
};
412+
}
411413
});

0 commit comments

Comments
 (0)