code cleanup: Use exports for internal references.

When we call functions inside our own modules that use
the `window.foo = exports` pattern, we have always had
a pretty strong preference to call `exports.internal_function`
instead of `foo.internal_functions`.

The stragglers here weren't violating this convention
for any intentional reason.  Some of the places here
probably were part of code moves where somebody
(probably me) moved functions into the modules to avoid
unnecessary indirection, and I missed a spot where I
could change from `presence` to `exports` (or whatever).

And other places are probably just kinda arbitrary
decisions by the original developer, and we just haven't
bothered to clean it up until now.
This commit is contained in:
Steve Howell
2020-06-11 12:32:12 +00:00
committed by Tim Abbott
parent 8c39ddfd28
commit 863660281e
6 changed files with 7 additions and 8 deletions

View File

@@ -131,7 +131,7 @@ exports.insert_local_message = function (message_request, local_id_float) {
waiting_for_id.set(message.local_id, message);
waiting_for_ack.set(message.local_id, message);
message.display_recipient = echo.build_display_recipient(message);
message.display_recipient = exports.build_display_recipient(message);
local_message.insert_message(message);
return message;
};

View File

@@ -699,7 +699,7 @@ exports.save_message_row_edit = function (row) {
echo.edit_locally(message, currently_echoing_messages.get(message_id));
row = current_msg_list.get_row(message_id);
message_edit.end_message_row_edit(row);
exports.end_message_row_edit(row);
}
channel.patch({
@@ -732,7 +732,7 @@ exports.save_message_row_edit = function (row) {
});
row = current_msg_list.get_row(message_id);
if (!message_edit.is_editing(message_id)) {
if (!exports.is_editing(message_id)) {
// Return to the message editing open UI state.
start_edit_maintaining_scroll(row, echo_data.orig_raw_content);
}

View File

@@ -589,7 +589,7 @@ exports.received_messages = function (messages) {
};
exports.send_test_notification = function (content) {
notifications.received_messages([{
exports.received_messages([{
id: Math.random(),
type: "test-notification",
sender_email: "notification-bot@zulip.com",

View File

@@ -248,8 +248,7 @@ exports.last_active_date = function (user_id) {
};
exports.initialize = function (params) {
presence.set_info(params.presences,
params.initial_servertime);
exports.set_info(params.presences, params.initial_servertime);
};
window.presence = exports;

View File

@@ -322,7 +322,7 @@ exports.launch = function () {
hashchange.exit_overlay();
},
});
recent_topics.complete_rerender();
exports.complete_rerender();
$("#recent_topics_search").focus();
};

View File

@@ -213,7 +213,7 @@ exports.setup_upload = function (config) {
if (!compose_state.composing()) {
compose_actions.start('stream');
}
const absolute_uri = upload.make_upload_absolute(uri);
const absolute_uri = exports.make_upload_absolute(uri);
const filename_uri = "[" + filename + "](" + absolute_uri + ")";
compose_ui.replace_syntax(exports.get_translated_status(file), filename_uri, exports.get_item("textarea", config));
compose_ui.autosize_textarea();