subject -> topic: Rename compose fields.

The stream/topic edit areas now have these ids:

        #stream_message_recipient_stream
        #stream_message_recipient_topic

They are pretty verbose, but being able to grep
for these without noise does have some value.
This commit is contained in:
Steve Howell 2018-11-13 16:16:02 +00:00 committed by Tim Abbott
parent ba46dc83c6
commit d7c2577ffb
17 changed files with 118 additions and 79 deletions

View File

@ -240,6 +240,16 @@ exports.then_send_message = function (type, params) {
exports.pm_recipient.set(params.recipient); exports.pm_recipient.set(params.recipient);
delete params.recipient; delete params.recipient;
if (params.stream) {
params.stream_message_recipient_stream = params.stream;
delete params.stream;
}
if (params.subject) {
params.stream_message_recipient_topic = params.subject;
delete params.subject;
}
casper.fill('form[action^="/json/messages"]', params); casper.fill('form[action^="/json/messages"]', params);
exports.turn_off_press_enter_to_send(); exports.turn_off_press_enter_to_send();

View File

@ -39,10 +39,22 @@ casper.then(function () {
casper.page.sendEvent('keypress', "c"); casper.page.sendEvent('keypress', "c");
}); });
function check_compose_is_cleared() {
common.check_form(
'#send_message_form',
{
stream_message_recipient_stream: '',
stream_message_recipient_topic: '',
},
"Stream empty on new compose"
);
}
casper.then(function () { casper.then(function () {
casper.waitUntilVisible('#compose', function () { casper.waitUntilVisible('#compose', function () {
casper.test.assertVisible('#stream-message', 'Stream input box visible'); casper.test.assertVisible('#stream-message', 'Stream input box visible');
common.check_form('#send_message_form', {stream: '', subject: ''}, "Stream empty on new compose"); check_compose_is_cleared();
casper.click('body'); casper.click('body');
casper.page.sendEvent('keypress', "x"); casper.page.sendEvent('keypress', "x");
}); });
@ -58,7 +70,7 @@ casper.then(function () {
casper.then(function () { casper.then(function () {
casper.waitUntilVisible('#stream-message', function () { casper.waitUntilVisible('#stream-message', function () {
common.check_form('#send_message_form', {stream: '', subject: ''}, "Stream empty on new compose"); check_compose_is_cleared();
// Check that when you reply to a message it pre-populates the stream and subject fields // Check that when you reply to a message it pre-populates the stream and subject fields
casper.click('body'); casper.click('body');
@ -73,7 +85,14 @@ casper.then(function () {
casper.then(function () { casper.then(function () {
casper.waitUntilVisible('#stream-message', function () { casper.waitUntilVisible('#stream-message', function () {
common.check_form('#send_message_form', {stream: "Verona", subject: "Reply test"}, "Stream populated after reply by click"); common.check_form(
'#send_message_form',
{
stream_message_recipient_stream: "Verona",
stream_message_recipient_topic: "Reply test",
},
"Stream populated after reply by click"
);
// Or recipient field // Or recipient field
casper.click('body'); casper.click('body');
casper.clickLabel("And reply to this message"); casper.clickLabel("And reply to this message");
@ -92,7 +111,14 @@ casper.then(function () {
casper.then(function () { casper.then(function () {
casper.waitUntilVisible('#stream-message', function () { casper.waitUntilVisible('#stream-message', function () {
common.check_form('#send_message_form', {stream: "Verona", subject: "Reply test"}, "Stream populated after reply with `r`"); common.check_form(
'#send_message_form',
{
stream_message_recipient_stream: "Verona",
stream_message_recipient_topic: "Reply test",
},
"Stream populated after reply with `r`"
);
// Test "closing" the compose box // Test "closing" the compose box
casper.click('body'); casper.click('body');
@ -124,7 +150,7 @@ casper.waitUntilVisible('li[data-user-ids-string="3"].expanded_private_message.a
casper.then(function () { casper.then(function () {
casper.waitUntilVisible('#compose', function () { casper.waitUntilVisible('#compose', function () {
casper.test.assertEval(function () { casper.test.assertEval(function () {
return document.activeElement === $('.compose_table #stream')[0]; return document.activeElement === $('.compose_table #stream_message_recipient_stream')[0];
}, 'Stream box focused after narrowing to PMs with a user and pressing `c`'); }, 'Stream box focused after narrowing to PMs with a user and pressing `c`');
}); });
}); });

View File

@ -9,8 +9,8 @@ casper.waitUntilVisible('#zhome', function () {
casper.then(function () { casper.then(function () {
casper.fill('form[action^="/json/messages"]', { casper.fill('form[action^="/json/messages"]', {
stream: 'Verona', stream_message_recipient_stream: 'Verona',
subject: 'Test mention all', stream_message_recipient_topic: 'Test mention all',
}); });
}); });
common.select_item_via_typeahead('#compose-textarea', '@**all**', 'all'); common.select_item_via_typeahead('#compose-textarea', '@**all**', 'all');

View File

@ -49,8 +49,8 @@ casper.then(function () {
casper.page.sendEvent('keypress', "c"); casper.page.sendEvent('keypress', "c");
casper.waitUntilVisible('#stream-message', function () { casper.waitUntilVisible('#stream-message', function () {
casper.fill('form#send_message_form', { casper.fill('form#send_message_form', {
stream: 'all', stream_message_recipient_stream: 'all',
subject: 'tests', stream_message_recipient_topic: 'tests',
content: 'Test Stream Message', content: 'Test Stream Message',
}, false); }, false);
casper.click("#compose_close"); casper.click("#compose_close");
@ -107,8 +107,8 @@ casper.then(function () {
casper.test.assertVisible('#stream-message', 'Stream Message Box Restored'); casper.test.assertVisible('#stream-message', 'Stream Message Box Restored');
casper.test.assertNotVisible('#preview_message_area', 'Preview Was Hidden'); casper.test.assertNotVisible('#preview_message_area', 'Preview Was Hidden');
common.check_form('form#send_message_form', { common.check_form('form#send_message_form', {
stream: 'all', stream_message_recipient_stream: 'all',
subject: 'tests', stream_message_recipient_topic: 'tests',
content: 'Test Stream Message', content: 'Test Stream Message',
}, "Stream message box filled with draft content"); }, "Stream message box filled with draft content");
casper.test.assertSelectorHasText('title', 'tests - Zulip Dev - Zulip', 'Narrowed to topic'); casper.test.assertSelectorHasText('title', 'tests - Zulip Dev - Zulip', 'Narrowed to topic');
@ -118,8 +118,8 @@ casper.then(function () {
casper.then(function () { casper.then(function () {
casper.test.info('Editing Stream Message Draft'); casper.test.info('Editing Stream Message Draft');
casper.fill('form#send_message_form', { casper.fill('form#send_message_form', {
stream: 'all', stream_message_recipient_stream: 'all',
subject: 'tests', stream_message_recipient_topic: 'tests',
content: 'Updated Stream Message', content: 'Updated Stream Message',
}, false); }, false);
casper.click("#compose_close"); casper.click("#compose_close");

View File

@ -116,7 +116,7 @@ run_test('validate_stream_message_address_info', () => {
stream_data.add_sub('social', sub); stream_data.add_sub('social', sub);
assert(compose.validate_stream_message_address_info('social')); assert(compose.validate_stream_message_address_info('social'));
$('#stream').select(noop); $('#stream_message_recipient_stream').select(noop);
assert(!compose.validate_stream_message_address_info('foobar')); assert(!compose.validate_stream_message_address_info('foobar'));
assert.equal($('#compose-error-msg').html(), "translated: <p>The stream <b>foobar</b> does not exist.</p><p>Manage your subscriptions <a href='#streams/all'>on your Streams page</a>.</p>"); assert.equal($('#compose-error-msg').html(), "translated: <p>The stream <b>foobar</b> does not exist.</p><p>Manage your subscriptions <a href='#streams/all'>on your Streams page</a>.</p>");
@ -253,14 +253,14 @@ run_test('validate', () => {
compose_state.set_message_type('stream'); compose_state.set_message_type('stream');
compose_state.stream_name(''); compose_state.stream_name('');
$("#stream").select(noop); $("#stream_message_recipient_stream").select(noop);
assert(!compose.validate()); assert(!compose.validate());
assert.equal($('#compose-error-msg').html(), i18n.t('Please specify a stream')); assert.equal($('#compose-error-msg').html(), i18n.t('Please specify a stream'));
compose_state.stream_name('Denmark'); compose_state.stream_name('Denmark');
page_params.realm_mandatory_topics = true; page_params.realm_mandatory_topics = true;
compose_state.topic(''); compose_state.topic('');
$("#subject").select(noop); $("#stream_message_recipient_topic").select(noop);
assert(!compose.validate()); assert(!compose.validate());
assert.equal($('#compose-error-msg').html(), i18n.t('Please specify a topic')); assert.equal($('#compose-error-msg').html(), i18n.t('Please specify a topic'));
}); });
@ -949,7 +949,7 @@ run_test('initialize', () => {
}); });
run_test('update_fade', () => { run_test('update_fade', () => {
var selector = '#stream,#subject,#private_message_recipient'; var selector = '#stream_message_recipient_stream,#stream_message_recipient_topic,#private_message_recipient';
var keyup_handler_func = $(selector).get_on_handler('keyup'); var keyup_handler_func = $(selector).get_on_handler('keyup');
var set_focused_recipient_checked = false; var set_focused_recipient_checked = false;
@ -1213,7 +1213,7 @@ run_test('on_events', () => {
// !sub will result false here and we check the failure code path. // !sub will result false here and we check the failure code path.
blueslip.set_test_data('warn', 'Stream no longer exists: no-stream'); blueslip.set_test_data('warn', 'Stream no longer exists: no-stream');
$('#stream').val('no-stream'); $('#stream_message_recipient_stream').val('no-stream');
container.data = function (field) { container.data = function (field) {
assert.equal(field, 'useremail'); assert.equal(field, 'useremail');
return 'foo@bar.com'; return 'foo@bar.com';
@ -1232,7 +1232,7 @@ run_test('on_events', () => {
// !sub will result in true here and we check the success code path. // !sub will result in true here and we check the success code path.
stream_data.add_sub('test', subscription); stream_data.add_sub('test', subscription);
$('#stream').val('test'); $('#stream_message_recipient_stream').val('test');
var all_invite_children_called = false; var all_invite_children_called = false;
$("#compose_invite_users").children = function () { $("#compose_invite_users").children = function () {
all_invite_children_called = true; all_invite_children_called = true;
@ -1292,7 +1292,7 @@ run_test('on_events', () => {
assert(compose_not_subscribed_called); assert(compose_not_subscribed_called);
stream_data.add_sub('test', subscription); stream_data.add_sub('test', subscription);
$('#stream').val('test'); $('#stream_message_recipient_stream').val('test');
$("#compose-send-status").show(); $("#compose-send-status").show();
handler(event); handler(event);
@ -1582,8 +1582,8 @@ run_test('create_message_object', () => {
stream_data.add_sub('social', sub); stream_data.add_sub('social', sub);
var page = { var page = {
'#stream': 'social', '#stream_message_recipient_stream': 'social',
'#subject': 'lunch', '#stream_message_recipient_topic': 'lunch',
'#compose-textarea': 'burrito', '#compose-textarea': 'burrito',
}; };

View File

@ -129,8 +129,8 @@ run_test('start', () => {
assert_visible('#stream-message'); assert_visible('#stream-message');
assert_hidden('#private-message'); assert_hidden('#private-message');
assert.equal($('#stream').val(), 'stream1'); assert.equal($('#stream_message_recipient_stream').val(), 'stream1');
assert.equal($('#subject').val(), 'topic1'); assert.equal($('#stream_message_recipient_topic').val(), 'topic1');
assert.equal(compose_state.get_message_type(), 'stream'); assert.equal(compose_state.get_message_type(), 'stream');
assert(compose_state.composing()); assert(compose_state.composing());
@ -206,7 +206,7 @@ run_test('respond_to_message', () => {
}; };
respond_to_message(opts); respond_to_message(opts);
assert.equal($('#stream').val(), 'devel'); assert.equal($('#stream_message_recipient_stream').val(), 'devel');
}); });
run_test('reply_with_mention', () => { run_test('reply_with_mention', () => {
@ -229,7 +229,7 @@ run_test('reply_with_mention', () => {
}; };
reply_with_mention(opts); reply_with_mention(opts);
assert.equal($('#stream').val(), 'devel'); assert.equal($('#stream_message_recipient_stream').val(), 'devel');
assert.equal(syntax_to_insert, '@**Bob Roberts**'); assert.equal(syntax_to_insert, '@**Bob Roberts**');
assert(compose_state.has_message_content()); assert(compose_state.has_message_content());
@ -248,7 +248,7 @@ run_test('reply_with_mention', () => {
people.add_in_realm(bob_2); people.add_in_realm(bob_2);
reply_with_mention(opts); reply_with_mention(opts);
assert.equal($('#stream').val(), 'devel'); assert.equal($('#stream_message_recipient_stream').val(), 'devel');
assert.equal(syntax_to_insert, '@**Bob Roberts|40**'); assert.equal(syntax_to_insert, '@**Bob Roberts|40**');
assert(compose_state.has_message_content()); assert(compose_state.has_message_content());
}); });
@ -304,19 +304,19 @@ run_test('quote_and_reply', () => {
}); });
run_test('get_focus_area', () => { run_test('get_focus_area', () => {
assert.equal(get_focus_area('private', {}), 'private_message_recipient'); assert.equal(get_focus_area('private', {}), '#private_message_recipient');
assert.equal(get_focus_area('private', { assert.equal(get_focus_area('private', {
private_message_recipient: 'bob@example.com'}), 'compose-textarea'); private_message_recipient: 'bob@example.com'}), '#compose-textarea');
assert.equal(get_focus_area('stream', {}), 'stream'); assert.equal(get_focus_area('stream', {}), '#stream_message_recipient_stream');
assert.equal(get_focus_area('stream', {stream: 'fun'}), assert.equal(get_focus_area('stream', {stream: 'fun'}),
'subject'); '#stream_message_recipient_topic');
assert.equal(get_focus_area('stream', {stream: 'fun', assert.equal(get_focus_area('stream', {stream: 'fun',
subject: 'more'}), subject: 'more'}),
'compose-textarea'); '#compose-textarea');
assert.equal(get_focus_area('stream', {stream: 'fun', assert.equal(get_focus_area('stream', {stream: 'fun',
subject: 'more', subject: 'more',
trigger: 'new topic button'}), trigger: 'new topic button'}),
'subject'); '#stream_message_recipient_topic');
}); });
run_test('focus_in_empty_compose', () => { run_test('focus_in_empty_compose', () => {

View File

@ -43,13 +43,13 @@ run_test('set_focused_recipient', () => {
global.$ = function (selector) { global.$ = function (selector) {
switch (selector) { switch (selector) {
case '#stream': case '#stream_message_recipient_stream':
return { return {
val: function () { val: function () {
return 'social'; return 'social';
}, },
}; };
case '#subject': case '#stream_message_recipient_topic':
return { return {
val: function () { val: function () {
return 'lunch'; return 'lunch';

View File

@ -384,7 +384,7 @@ run_test('initialize', () => {
var expected_value; var expected_value;
var stream_typeahead_called = false; var stream_typeahead_called = false;
$('#stream').typeahead = function (options) { $('#stream_message_recipient_stream').typeahead = function (options) {
// options.source() // options.source()
// //
var actual_value = options.source(); var actual_value = options.source();
@ -418,14 +418,14 @@ run_test('initialize', () => {
}; };
var subject_typeahead_called = false; var subject_typeahead_called = false;
$('#subject').typeahead = function (options) { $('#stream_message_recipient_topic').typeahead = function (options) {
var topics = ['<&>', 'even more ice', 'furniture', 'ice', 'kronor', 'more ice']; var topics = ['<&>', 'even more ice', 'furniture', 'ice', 'kronor', 'more ice'];
topic_data.get_recent_names = (stream_id) => { topic_data.get_recent_names = (stream_id) => {
assert.equal(stream_id, sweden_stream.stream_id); assert.equal(stream_id, sweden_stream.stream_id);
return topics; return topics;
}; };
$('#stream').val('Sweden'); $('#stream_message_recipient_stream').val('Sweden');
var actual_value = options.source(); var actual_value = options.source();
// Topics should be sorted alphabetically, not by addition order. // Topics should be sorted alphabetically, not by addition order.
var expected_value = topics; var expected_value = topics;
@ -818,8 +818,8 @@ run_test('initialize', () => {
page_params.enter_sends = false; page_params.enter_sends = false;
// We manually specify it the first time because the click_func // We manually specify it the first time because the click_func
// doesn't exist yet. // doesn't exist yet.
$("#stream").select(noop); $("#stream_message_recipient_stream").select(noop);
$("#subject").select(noop); $("#stream_message_recipient_topic").select(noop);
$("#private_message_recipient").select(noop); $("#private_message_recipient").select(noop);
ct.initialize(); ct.initialize();
@ -833,7 +833,7 @@ run_test('initialize', () => {
preventDefault: noop, preventDefault: noop,
}; };
$('#subject').data = function () { $('#stream_message_recipient_topic').data = function () {
return { typeahead: { shown: true }}; return { typeahead: { shown: true }};
}; };
$('form#send_message_form').keydown(event); $('form#send_message_form').keydown(event);
@ -841,8 +841,8 @@ run_test('initialize', () => {
var stub_typeahead_hidden = function () { var stub_typeahead_hidden = function () {
return { typeahead: { shown: false }}; return { typeahead: { shown: false }};
}; };
$('#subject').data = stub_typeahead_hidden; $('#stream_message_recipient_topic').data = stub_typeahead_hidden;
$('#stream').data = stub_typeahead_hidden; $('#stream_message_recipient_stream').data = stub_typeahead_hidden;
$('#private_message_recipient').data = stub_typeahead_hidden; $('#private_message_recipient').data = stub_typeahead_hidden;
$('#compose-textarea').data = stub_typeahead_hidden; $('#compose-textarea').data = stub_typeahead_hidden;
$('form#send_message_form').keydown(event); $('form#send_message_form').keydown(event);
@ -914,7 +914,7 @@ run_test('initialize', () => {
preventDefault: noop, preventDefault: noop,
}; };
// We execute .keydown() in order to make nextFocus !== false // We execute .keydown() in order to make nextFocus !== false
$('#subject').data = function () { $('#stream_message_recipient_topic').data = function () {
return { typeahead: { shown: true }}; return { typeahead: { shown: true }};
}; };
$('form#send_message_form').keydown(event); $('form#send_message_form').keydown(event);
@ -929,10 +929,10 @@ run_test('initialize', () => {
// select_on_focus() // select_on_focus()
var focus_handler_called = false; var focus_handler_called = false;
var stream_one_called = false; var stream_one_called = false;
$('#stream').focus = function (f) { $('#stream_message_recipient_stream').focus = function (f) {
// This .one() function emulates the possible infinite recursion that // This .one() function emulates the possible infinite recursion that
// in_handler tries to avoid. // in_handler tries to avoid.
$('#stream').one = function (event, handler) { $('#stream_message_recipient_stream').one = function (event, handler) {
handler({ preventDefault: noop }); handler({ preventDefault: noop });
f(); // This time in_handler will already be true. f(); // This time in_handler will already be true.
stream_one_called = true; stream_one_called = true;

View File

@ -466,16 +466,17 @@ exports.validation_error = function (error_type, stream_name) {
switch (error_type) { switch (error_type) {
case "does-not-exist": case "does-not-exist":
response = i18n.t("<p>The stream <b>__stream_name__</b> does not exist.</p><p>Manage your subscriptions <a href='#streams/all'>on your Streams page</a>.</p>", context); response = i18n.t("<p>The stream <b>__stream_name__</b> does not exist.</p><p>Manage your subscriptions <a href='#streams/all'>on your Streams page</a>.</p>", context);
compose_error(response, $('#stream')); compose_error(response, $('#stream_message_recipient_stream'));
return false; return false;
case "error": case "error":
compose_error(i18n.t("Error checking subscription"), $("#stream")); compose_error(i18n.t("Error checking subscription"),
$("#stream_message_recipient_stream"));
return false; return false;
case "not-subscribed": case "not-subscribed":
var sub = stream_data.get_sub(stream_name); var sub = stream_data.get_sub(stream_name);
var new_row = templates.render("compose_not_subscribed", { var new_row = templates.render("compose_not_subscribed", {
should_display_sub_button: sub.should_display_subscription_button}); should_display_sub_button: sub.should_display_subscription_button});
compose_not_subscribed_error(new_row, $('#stream')); compose_not_subscribed_error(new_row, $('#stream_message_recipient_stream'));
return false; return false;
} }
return true; return true;
@ -493,14 +494,14 @@ exports.validate_stream_message_address_info = function (stream_name) {
function validate_stream_message() { function validate_stream_message() {
var stream_name = compose_state.stream_name(); var stream_name = compose_state.stream_name();
if (stream_name === "") { if (stream_name === "") {
compose_error(i18n.t("Please specify a stream"), $("#stream")); compose_error(i18n.t("Please specify a stream"), $("#stream_message_recipient_stream"));
return false; return false;
} }
if (page_params.realm_mandatory_topics) { if (page_params.realm_mandatory_topics) {
var topic = compose_state.topic(); var topic = compose_state.topic();
if (topic === "") { if (topic === "") {
compose_error(i18n.t("Please specify a topic"), $("#subject")); compose_error(i18n.t("Please specify a topic"), $("#stream_message_recipient_topic"));
return false; return false;
} }
} }
@ -689,8 +690,8 @@ exports.needs_subscribe_warning = function (email) {
exports.initialize = function () { exports.initialize = function () {
$('#stream,#subject,#private_message_recipient').on('keyup', update_fade); $('#stream_message_recipient_stream,#stream_message_recipient_topic,#private_message_recipient').on('keyup', update_fade);
$('#stream,#subject,#private_message_recipient').on('change', update_fade); $('#stream_message_recipient_stream,#stream_message_recipient_topic,#private_message_recipient').on('change', update_fade);
$('#compose-textarea').on('keydown', function (event) { $('#compose-textarea').on('keydown', function (event) {
exports.handle_keydown(event, $("#compose-textarea").expectOne()); exports.handle_keydown(event, $("#compose-textarea").expectOne());
}); });
@ -775,7 +776,7 @@ exports.initialize = function () {
$("#compose-send-status").on('click', '.sub_unsub_button', function (event) { $("#compose-send-status").on('click', '.sub_unsub_button', function (event) {
event.preventDefault(); event.preventDefault();
var stream_name = $('#stream').val(); var stream_name = $('#stream_message_recipient_stream').val();
if (stream_name === undefined) { if (stream_name === undefined) {
return; return;
} }

View File

@ -4,7 +4,7 @@ var exports = {};
function update_lock_icon_for_stream(stream_name) { function update_lock_icon_for_stream(stream_name) {
var icon = $("#compose-lock-icon"); var icon = $("#compose-lock-icon");
var streamfield = $("#stream"); var streamfield = $("#stream_message_recipient_stream");
if (stream_data.get_invite_only(stream_name)) { if (stream_data.get_invite_only(stream_name)) {
icon.show(); icon.show();
streamfield.addClass("lock-padding"); streamfield.addClass("lock-padding");
@ -32,19 +32,19 @@ function hide_box() {
function get_focus_area(msg_type, opts) { function get_focus_area(msg_type, opts) {
// Set focus to "Topic" when narrowed to a stream+topic and "New topic" button clicked. // 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.subject) {
return 'subject'; return '#stream_message_recipient_topic';
} else if (msg_type === 'stream' && opts.stream } else if (msg_type === 'stream' && opts.stream
|| msg_type === 'private' && opts.private_message_recipient) { || msg_type === 'private' && opts.private_message_recipient) {
if (opts.trigger === "new topic button") { if (opts.trigger === "new topic button") {
return 'subject'; return '#stream_message_recipient_topic';
} }
return 'compose-textarea'; return '#compose-textarea';
} }
if (msg_type === 'stream') { if (msg_type === 'stream') {
return 'stream'; return '#stream_message_recipient_stream';
} }
return 'private_message_recipient'; return '#private_message_recipient';
} }
// Export for testing // Export for testing
exports._get_focus_area = get_focus_area; exports._get_focus_area = get_focus_area;
@ -57,7 +57,7 @@ exports.set_focus = function (msg_type, opts) {
if (window.getSelection().toString() === "" || if (window.getSelection().toString() === "" ||
opts.trigger !== "message click") { opts.trigger !== "message click") {
var elt = $('#' + focus_area); var elt = $(focus_area);
elt.focus().select(); elt.focus().select();
} }
}; };

View File

@ -21,8 +21,8 @@ exports.set_focused_recipient = function (msg_type) {
}; };
if (focused_recipient.type === "stream") { if (focused_recipient.type === "stream") {
var stream_name = $('#stream').val(); var stream_name = $('#stream_message_recipient_stream').val();
focused_recipient.subject = $('#subject').val(); focused_recipient.subject = $('#stream_message_recipient_topic').val();
focused_recipient.stream = stream_name; focused_recipient.stream = stream_name;
var sub = stream_data.get_sub(stream_name); var sub = stream_data.get_sub(stream_name);
if (sub) { if (sub) {

View File

@ -40,8 +40,8 @@ function get_or_set(fieldname, keep_leading_whitespace) {
} }
// TODO: Break out setters and getter into their own functions. // TODO: Break out setters and getter into their own functions.
exports.stream_name = get_or_set('stream'); exports.stream_name = get_or_set('stream_message_recipient_stream');
exports.topic = get_or_set('subject'); exports.topic = get_or_set('stream_message_recipient_topic');
// We can't trim leading whitespace in `compose_textarea` because // We can't trim leading whitespace in `compose_textarea` because
// of the indented syntax for multi-line code blocks. // of the indented syntax for multi-line code blocks.
exports.message_content = get_or_set('compose-textarea', true); exports.message_content = get_or_set('compose-textarea', true);

View File

@ -146,8 +146,8 @@ function handle_keydown(e) {
} }
// If no typeaheads are shown... // If no typeaheads are shown...
if (!($("#subject").data().typeahead.shown || if (!($("#stream_message_recipient_topic").data().typeahead.shown ||
$("#stream").data().typeahead.shown || $("#stream_message_recipient_stream").data().typeahead.shown ||
$("#private_message_recipient").data().typeahead.shown || $("#private_message_recipient").data().typeahead.shown ||
$("#compose-textarea").data().typeahead.shown)) { $("#compose-textarea").data().typeahead.shown)) {
@ -540,8 +540,8 @@ exports.initialize_compose_typeahead = function (selector) {
}; };
exports.initialize = function () { exports.initialize = function () {
select_on_focus("stream"); select_on_focus("stream_message_recipient_stream");
select_on_focus("subject"); select_on_focus("stream_message_recipient_topic");
select_on_focus("private_message_recipient"); select_on_focus("private_message_recipient");
// These handlers are at the "form" level so that they are called after typeahead // These handlers are at the "form" level so that they are called after typeahead
@ -573,7 +573,7 @@ exports.initialize = function () {
} }
// limit number of items so the list doesn't fall off the screen // limit number of items so the list doesn't fall off the screen
$("#stream").typeahead({ $("#stream_message_recipient_stream").typeahead({
source: function () { source: function () {
return stream_data.subscribed_streams(); return stream_data.subscribed_streams();
}, },
@ -590,7 +590,7 @@ exports.initialize = function () {
}, },
}); });
$("#subject").typeahead({ $("#stream_message_recipient_topic").typeahead({
source: function () { source: function () {
var stream_name = compose_state.stream_name(); var stream_name = compose_state.stream_name();
return exports.topics_seen_for(stream_name); return exports.topics_seen_for(stream_name);

View File

@ -166,7 +166,9 @@ function initialize_kitchen_sink_stuff() {
$(this).removeClass("active"); $(this).removeClass("active");
}); });
$("#stream").on('blur', function () { compose_actions.decorate_stream_bar(this.value); }); $("#stream_message_recipient_stream").on('blur', function () {
compose_actions.decorate_stream_bar(this.value);
});
$(window).on('blur', function () { $(window).on('blur', function () {
$(document.body).addClass('window_blurred'); $(document.body).addClass('window_blurred');

View File

@ -334,7 +334,7 @@ textarea.new_message_textarea:focus,
-webkit-box-shadow: none; -webkit-box-shadow: none;
} }
#stream.recipient_box:focus { #stream_message_recipient_stream.recipient_box:focus {
border-left: none; border-left: none;
} }
@ -344,20 +344,20 @@ input.recipient_box {
border-radius: 3px; border-radius: 3px;
} }
#stream.recipient_box { #stream_message_recipient_stream.recipient_box {
width: 20%; width: 20%;
border-radius: 0px 3px 3px 0px; border-radius: 0px 3px 3px 0px;
border-left: 0px; border-left: 0px;
min-width: 120px; min-width: 120px;
} }
#subject.recipient_box { #stream_message_recipient_topic.recipient_box {
width: calc(20% - -14px); width: calc(20% - -14px);
min-width: 140px; min-width: 140px;
max-width: 165px; max-width: 165px;
} }
#stream.recipient_box.lock-padding { #stream_message_recipient_stream.recipient_box.lock-padding {
padding-left: 18px; padding-left: 18px;
} }

View File

@ -326,7 +326,7 @@
} }
@media (max-width: 370px) { @media (max-width: 370px) {
#subject.recipient_box { #stream_message_recipient_topic.recipient_box {
width: calc(100% - 175px); width: calc(100% - 175px);
min-width: 95px; min-width: 95px;
} }

View File

@ -68,9 +68,9 @@
<span id="compose-lock-icon"> <span id="compose-lock-icon">
<i class="fa fa-lock" title="{{ _('This is a private stream') }}" aria-hidden="true"></i> <i class="fa fa-lock" title="{{ _('This is a private stream') }}" aria-hidden="true"></i>
</span> </span>
<input type="text" class="recipient_box" name="stream" id="stream" maxlength="30" value="" placeholder="{{ _('Stream') }}" autocomplete="off" tabindex="0" aria-label="{{ _('Stream') }}" /> <input type="text" class="recipient_box" name="stream_message_recipient_stream" id="stream_message_recipient_stream" maxlength="30" value="" placeholder="{{ _('Stream') }}" autocomplete="off" tabindex="0" aria-label="{{ _('Stream') }}" />
<i class="fa fa-angle-right" aria-hidden="true"></i> <i class="fa fa-angle-right" aria-hidden="true"></i>
<input type="text" class="recipient_box" name="subject" id="subject" maxlength="60" value="" placeholder="{{ _('Topic') }}" autocomplete="off" tabindex="0" aria-label="{{ _('Topic') }}" /> <input type="text" class="recipient_box" name="stream_message_recipient_topic" id="stream_message_recipient_topic" maxlength="60" value="" placeholder="{{ _('Topic') }}" autocomplete="off" tabindex="0" aria-label="{{ _('Topic') }}" />
</div> </div>
</div> </div>
<div id="private-message"> <div id="private-message">