mirror of https://github.com/zulip/zulip.git
subject -> topic: Fix subject in opts.
It's kinda difficult to track down all the interactions with the opts that go through compose_actions.start(), but I think I got everything.
This commit is contained in:
parent
057ee6633a
commit
35b904b184
|
@ -940,7 +940,7 @@ run_test('initialize', () => {
|
|||
page_params.narrow_topic = 'testing';
|
||||
|
||||
reset_jquery();
|
||||
set_up_compose_start_mock({subject: 'testing'});
|
||||
set_up_compose_start_mock({topic: 'testing'});
|
||||
|
||||
compose.initialize();
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ run_test('start', () => {
|
|||
global.narrow_state.set_compose_defaults = function () {
|
||||
var opts = {};
|
||||
opts.stream = 'stream1';
|
||||
opts.subject = 'topic1';
|
||||
opts.topic = 'topic1';
|
||||
return opts;
|
||||
};
|
||||
|
||||
|
@ -311,10 +311,10 @@ run_test('get_focus_area', () => {
|
|||
assert.equal(get_focus_area('stream', {stream: 'fun'}),
|
||||
'#stream_message_recipient_topic');
|
||||
assert.equal(get_focus_area('stream', {stream: 'fun',
|
||||
subject: 'more'}),
|
||||
topic: 'more'}),
|
||||
'#compose-textarea');
|
||||
assert.equal(get_focus_area('stream', {stream: 'fun',
|
||||
subject: 'more',
|
||||
topic: 'more',
|
||||
trigger: 'new topic button'}),
|
||||
'#stream_message_recipient_topic');
|
||||
});
|
||||
|
|
|
@ -68,7 +68,7 @@ var legacy_draft = {
|
|||
|
||||
var compose_args_for_legacy_draft = {
|
||||
stream: "stream",
|
||||
subject: "lunch",
|
||||
topic: "lunch",
|
||||
type: "stream",
|
||||
content: "whatever",
|
||||
};
|
||||
|
|
|
@ -142,7 +142,7 @@ run_test('set_compose_defaults', () => {
|
|||
|
||||
var stream_and_subject = narrow_state.set_compose_defaults();
|
||||
assert.equal(stream_and_subject.stream, 'Foo');
|
||||
assert.equal(stream_and_subject.subject, 'Bar');
|
||||
assert.equal(stream_and_subject.topic, 'Bar');
|
||||
|
||||
set_filter([['pm-with', 'foo@bar.com']]);
|
||||
var pm_test = narrow_state.set_compose_defaults();
|
||||
|
|
|
@ -1007,7 +1007,7 @@ exports.initialize = function () {
|
|||
|
||||
if (page_params.narrow !== undefined) {
|
||||
if (page_params.narrow_topic !== undefined) {
|
||||
compose_actions.start("stream", {subject: page_params.narrow_topic});
|
||||
compose_actions.start("stream", {topic: page_params.narrow_topic});
|
||||
} else {
|
||||
compose_actions.start("stream", {});
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ function hide_box() {
|
|||
|
||||
function get_focus_area(msg_type, opts) {
|
||||
// Set focus to "Topic" when narrowed to a stream+topic and "New topic" button clicked.
|
||||
if (msg_type === 'stream' && opts.stream && !opts.subject) {
|
||||
if (msg_type === 'stream' && opts.stream && !opts.topic) {
|
||||
return '#stream_message_recipient_topic';
|
||||
} else if (msg_type === 'stream' && opts.stream
|
||||
|| msg_type === 'private' && opts.private_message_recipient) {
|
||||
|
@ -172,7 +172,7 @@ function fill_in_opts_from_current_narrowed_view(msg_type, opts) {
|
|||
var default_opts = {
|
||||
message_type: msg_type,
|
||||
stream: '',
|
||||
subject: '',
|
||||
topic: '',
|
||||
private_message_recipient: '',
|
||||
trigger: 'unknown',
|
||||
};
|
||||
|
@ -188,7 +188,7 @@ function same_recipient_as_before(msg_type, opts) {
|
|||
return compose_state.get_message_type() === msg_type &&
|
||||
(msg_type === "stream" &&
|
||||
opts.stream === compose_state.stream_name() &&
|
||||
opts.subject === compose_state.topic() ||
|
||||
opts.topic === compose_state.topic() ||
|
||||
msg_type === "private" &&
|
||||
opts.private_message_recipient === compose_state.recipient());
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ exports.start = function (msg_type, opts) {
|
|||
if (opts.trigger === "compose_hotkey" ||
|
||||
opts.trigger === "new topic button" ||
|
||||
opts.trigger === "sidebar stream actions") {
|
||||
opts.subject = '';
|
||||
opts.topic = '';
|
||||
opts.private_message_recipient = '';
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ exports.start = function (msg_type, opts) {
|
|||
}
|
||||
|
||||
compose_state.stream_name(opts.stream);
|
||||
compose_state.topic(opts.subject);
|
||||
compose_state.topic(opts.topic);
|
||||
|
||||
// Set the recipients with a space after each comma, so it looks nice.
|
||||
compose_state.recipient(opts.private_message_recipient.replace(/,\s*/g, ", "));
|
||||
|
@ -243,7 +243,7 @@ exports.cancel = function () {
|
|||
|
||||
if (page_params.narrow !== undefined) {
|
||||
// Never close the compose box in narrow embedded windows, but
|
||||
// at least clear the subject and unfade.
|
||||
// at least clear the topic and unfade.
|
||||
compose_fade.clear_compose();
|
||||
if (page_params.narrow_topic !== undefined) {
|
||||
compose_state.topic(page_params.narrow_topic);
|
||||
|
@ -326,7 +326,7 @@ exports.respond_to_message = function (opts) {
|
|||
} else {
|
||||
msg_type = message.type;
|
||||
}
|
||||
exports.start(msg_type, {stream: stream, subject: topic,
|
||||
exports.start(msg_type, {stream: stream, topic: topic,
|
||||
private_message_recipient: pm_recipient,
|
||||
trigger: opts.trigger});
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ exports.restore_message = function (draft) {
|
|||
compose_args = {
|
||||
type: 'stream',
|
||||
stream: draft.stream,
|
||||
subject: util.get_draft_topic(draft),
|
||||
topic: util.get_draft_topic(draft),
|
||||
content: draft.content,
|
||||
};
|
||||
|
||||
|
@ -158,7 +158,7 @@ exports.restore_draft = function (draft_id) {
|
|||
narrow.activate(
|
||||
[
|
||||
{operator: "stream", operand: compose_args.stream},
|
||||
{operator: "topic", operand: compose_args.subject},
|
||||
{operator: "topic", operand: compose_args.topic},
|
||||
],
|
||||
{trigger: "restore draft"}
|
||||
);
|
||||
|
@ -179,7 +179,7 @@ exports.restore_draft = function (draft_id) {
|
|||
compose.clear_preview_area();
|
||||
|
||||
if (draft.type === "stream" && draft.stream === "") {
|
||||
compose_args.subject = "";
|
||||
compose_args.topic = "";
|
||||
}
|
||||
compose_actions.start(compose_args.type, compose_args);
|
||||
compose_ui.autosize_textarea();
|
||||
|
|
|
@ -89,7 +89,7 @@ exports.set_compose_defaults = function () {
|
|||
}
|
||||
|
||||
if (single.has('topic')) {
|
||||
opts.subject = single.get('topic');
|
||||
opts.topic = single.get('topic');
|
||||
}
|
||||
|
||||
if (single.has('pm-with')) {
|
||||
|
|
|
@ -134,7 +134,7 @@ exports.initialize = function () {
|
|||
var topic = util.get_reload_topic(vars);
|
||||
|
||||
compose_actions.start(vars.msg_type, {stream: vars.stream || '',
|
||||
subject: topic || '',
|
||||
topic: topic || '',
|
||||
private_message_recipient: vars.recipient || '',
|
||||
content: vars.msg || ''});
|
||||
if (send_now) {
|
||||
|
|
Loading…
Reference in New Issue