activity.js: Add setter for new_user_input.

After migration to an ES6 module, `new_user_input` would no longer be
mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-04 02:22:44 -04:00 committed by Tim Abbott
parent ff8351fb71
commit 30d7090621
4 changed files with 6 additions and 4 deletions

View File

@ -15,8 +15,6 @@
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
set_global("activity", {});
set_global("navigator", {
platform: "",
});
@ -36,6 +34,7 @@ emoji.initialize({
emoji_codes,
});
zrequire("activity");
const hotkey = zrequire("hotkey");
zrequire("common");

View File

@ -29,6 +29,9 @@ exports.client_is_active = document.hasFocus && document.hasFocus();
// if this was a server-initiated-reload to avoid counting a
// server-initiated reload as user activity.
exports.new_user_input = true;
exports.set_new_user_input = function (value) {
exports.new_user_input = value;
};
function update_pm_count_in_dom(count_span, value_span, count) {
const li = count_span.parents("li");

View File

@ -860,7 +860,7 @@ exports.process_hotkey = function (e, hotkey) {
instead just let keypress go for it. */
exports.process_keydown = function (e) {
activity.new_user_input = true;
activity.set_new_user_input(true);
const hotkey = exports.get_keydown_hotkey(e);
if (!hotkey) {
return false;

View File

@ -167,7 +167,7 @@ exports.initialize = function () {
page_params.initial_narrow_offset = narrow_offset;
}
activity.new_user_input = false;
activity.set_new_user_input(false);
hashchange.changehash(vars.oldhash);
};