mirror of https://github.com/zulip/zulip.git
Add compose_actions.start() shim.
This commit is contained in:
parent
35d38d62f3
commit
faa9446e64
|
@ -34,6 +34,7 @@
|
|||
"loading": false,
|
||||
"typing": false,
|
||||
"compose": false,
|
||||
"compose_actions": false,
|
||||
"compose_fade": false,
|
||||
"modals": false,
|
||||
"subs": false,
|
||||
|
|
|
@ -134,8 +134,8 @@ function stubbing(func_name_to_stub, test_function) {
|
|||
assert_mapping('A', 'navigate.cycle_stream');
|
||||
assert_mapping('D', 'navigate.cycle_stream');
|
||||
|
||||
assert_mapping('c', 'compose.start');
|
||||
assert_mapping('C', 'compose.start');
|
||||
assert_mapping('c', 'compose_actions.start');
|
||||
assert_mapping('C', 'compose_actions.start');
|
||||
assert_mapping('v', 'narrow.by');
|
||||
|
||||
// Next, test keys that only work on a selected message.
|
||||
|
|
|
@ -589,8 +589,9 @@ function maybe_select_person(e) {
|
|||
// undefined if there are no results
|
||||
var email = people.get_person_from_user_id(topPerson).email;
|
||||
narrow.by('pm-with', email, {select_first_unread: true, trigger: 'user sidebar'});
|
||||
compose.start('private',
|
||||
{trigger: 'sidebar enter key', private_message_recipient: email});
|
||||
compose_actions.start('private', {
|
||||
trigger: 'sidebar enter key',
|
||||
private_message_recipient: email});
|
||||
}
|
||||
// Clear the user filter
|
||||
exports.escape_search();
|
||||
|
|
|
@ -314,18 +314,18 @@ $(function () {
|
|||
|
||||
|
||||
$('.compose_stream_button').click(function () {
|
||||
compose.start('stream', {trigger: 'new topic button'});
|
||||
compose_actions.start('stream', {trigger: 'new topic button'});
|
||||
});
|
||||
$('.compose_private_button').click(function () {
|
||||
compose.start('private');
|
||||
compose_actions.start('private');
|
||||
});
|
||||
|
||||
$('.empty_feed_compose_stream').click(function (e) {
|
||||
compose.start('stream', {trigger: 'empty feed message'});
|
||||
compose_actions.start('stream', {trigger: 'empty feed message'});
|
||||
e.preventDefault();
|
||||
});
|
||||
$('.empty_feed_compose_private').click(function (e) {
|
||||
compose.start('private', {trigger: 'empty feed message'});
|
||||
compose_actions.start('private', {trigger: 'empty feed message'});
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
|
@ -369,14 +369,16 @@ $(function () {
|
|||
// Keep these 2 feedback bot triggers separate because they have to
|
||||
// propagate the event differently.
|
||||
$('.feedback').click(function () {
|
||||
compose.start('private', {private_message_recipient: 'feedback@zulip.com',
|
||||
compose_actions.start('private', {
|
||||
private_message_recipient: 'feedback@zulip.com',
|
||||
trigger: 'feedback menu item'});
|
||||
|
||||
});
|
||||
$('#feedback_button').click(function (e) {
|
||||
e.stopPropagation();
|
||||
popovers.hide_all();
|
||||
compose.start('private', {private_message_recipient: 'feedback@zulip.com',
|
||||
compose_actions.start('private', {
|
||||
private_message_recipient: 'feedback@zulip.com',
|
||||
trigger: 'feedback button'});
|
||||
|
||||
});
|
||||
|
|
|
@ -633,7 +633,7 @@ exports.respond_to_message = function (opts) {
|
|||
} else {
|
||||
msg_type = message.type;
|
||||
}
|
||||
compose.start(msg_type, {stream: stream, subject: subject,
|
||||
compose_actions.start(msg_type, {stream: stream, subject: subject,
|
||||
private_message_recipient: pm_recipient,
|
||||
replying_to_message: message,
|
||||
trigger: opts.trigger});
|
||||
|
@ -1161,7 +1161,7 @@ $(function () {
|
|||
// Urgh, yet another hack to make sure we're "composing"
|
||||
// when text gets added into the composebox.
|
||||
if (!compose.composing()) {
|
||||
compose.start('stream');
|
||||
compose_actions.start('stream');
|
||||
}
|
||||
|
||||
var uri = make_upload_absolute(response.uri);
|
||||
|
@ -1212,7 +1212,7 @@ $(function () {
|
|||
rawDrop: function (contents) {
|
||||
var textbox = $("#new_message_content");
|
||||
if (!compose.composing()) {
|
||||
compose.start('stream');
|
||||
compose_actions.start('stream');
|
||||
}
|
||||
textbox.val(textbox.val() + contents);
|
||||
exports.autosize_textarea();
|
||||
|
@ -1221,9 +1221,9 @@ $(function () {
|
|||
|
||||
if (page_params.narrow !== undefined) {
|
||||
if (page_params.narrow_topic !== undefined) {
|
||||
compose.start("stream", {subject: page_params.narrow_topic});
|
||||
compose_actions.start("stream", {subject: page_params.narrow_topic});
|
||||
} else {
|
||||
compose.start("stream", {});
|
||||
compose_actions.start("stream", {});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ exports.restore_draft = function (draft_id) {
|
|||
if (draft.type === "stream" && draft.stream === "") {
|
||||
draft_copy.subject = "";
|
||||
}
|
||||
compose.start(draft_copy.type, draft_copy);
|
||||
compose_actions.start(draft_copy.type, draft_copy);
|
||||
compose.autosize_textarea();
|
||||
$("#new_message_content").data("draft-id", draft_id);
|
||||
};
|
||||
|
|
|
@ -476,10 +476,10 @@ exports.process_hotkey = function (e, hotkey) {
|
|||
// Shortcuts that don't require a message
|
||||
switch (event_name) {
|
||||
case 'compose': // 'c': compose
|
||||
compose.start('stream', {trigger: "compose_hotkey"});
|
||||
compose_actions.start('stream', {trigger: "compose_hotkey"});
|
||||
return true;
|
||||
case 'compose_private_message':
|
||||
compose.start('private', {trigger: "compose_hotkey"});
|
||||
compose_actions.start('private', {trigger: "compose_hotkey"});
|
||||
return true;
|
||||
case 'narrow_private':
|
||||
return do_narrow_action(function (target, opts) {
|
||||
|
|
|
@ -357,9 +357,9 @@ exports.activate = function (raw_operators, opts) {
|
|||
|
||||
if (!had_message_content && opts.trigger === 'sidebar' && exports.narrowed_by_reply()) {
|
||||
if (exports.narrowed_to_topic()) {
|
||||
compose.start('stream');
|
||||
compose_actions.start('stream');
|
||||
} else {
|
||||
compose.start('private');
|
||||
compose_actions.start('private');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -486,13 +486,13 @@ exports.register_click_handlers = function () {
|
|||
var email = people.get_person_from_user_id(user_id).email;
|
||||
popovers.hide_user_sidebar_popover();
|
||||
|
||||
compose.start('private', {private_message_recipient: email, trigger: 'sidebar user actions'});
|
||||
compose_actions.start('private', {private_message_recipient: email, trigger: 'sidebar user actions'});
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
$('body').on('click', '.user_popover .mention_user', function (e) {
|
||||
var user_id = $(e.target).parents('ul').attr('data-user-id');
|
||||
compose.start('stream', {trigger: 'sidebar user actions'});
|
||||
compose_actions.start('stream', {trigger: 'sidebar user actions'});
|
||||
var name = people.get_person_from_user_id(user_id).full_name;
|
||||
var textarea = $("#new_message_content");
|
||||
textarea.val('@**' + name + '** ');
|
||||
|
|
|
@ -98,7 +98,7 @@ exports.initialize = function reload__initialize() {
|
|||
var send_now = parseInt(vars.send_after_reload, 10);
|
||||
|
||||
// TODO: preserve focus
|
||||
compose.start(vars.msg_type, {stream: vars.stream || '',
|
||||
compose_actions.start(vars.msg_type, {stream: vars.stream || '',
|
||||
subject: vars.subject || '',
|
||||
private_message_recipient: vars.recipient || '',
|
||||
content: vars.msg || ''});
|
||||
|
|
|
@ -8,3 +8,6 @@ that still refer to the old name.
|
|||
|
||||
var narrow_state = {}; // global, should be made into module
|
||||
narrow_state.set_compose_defaults = narrow.set_compose_defaults;
|
||||
|
||||
var compose_actions = {};
|
||||
compose_actions.start = compose.start;
|
||||
|
|
|
@ -203,7 +203,7 @@ exports.register_stream_handlers = function () {
|
|||
$('body').on('click', '.compose_to_stream', function (e) {
|
||||
var sub = stream_popover_sub(e);
|
||||
exports.hide_stream_popover();
|
||||
compose.start('stream', {stream: sub.name, trigger: 'sidebar stream actions'});
|
||||
compose_actions.start('stream', {stream: sub.name, trigger: 'sidebar stream actions'});
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue