From a3b6758315f40444c8003b4ab7184336742f1de2 Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Mon, 20 May 2013 16:52:03 -0400 Subject: [PATCH] Give a placeholder subject when users don't supply one. (imported from commit ac6f0f7029c6a96c4c20562b02bee656436c70b2) --- zephyr/static/js/compose.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index 58f9ef232f..0b19212109 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -4,6 +4,7 @@ var exports = {}; var is_composing_message = false; var faded_to; var message_snapshot; +var empty_subject_placeholder = "(no subject)"; // This function resets an input type="file". Pass in the // jquery object. @@ -254,10 +255,19 @@ exports.cancel = function () { $(document).trigger($.Event('compose_canceled.zephyr')); }; +exports.empty_subject_placeholder = function() { + return empty_subject_placeholder; +}; + function create_message_object() { + // Subjects are optional, and we provide a placeholder if one isn't given. + var subject = compose.subject(); + if (subject === "") { + subject = compose.empty_subject_placeholder(); + } var message = {client: 'website', type: compose.composing(), - subject: compose.subject(), + subject: subject, stream: compose.stream_name(), private_message_recipient: compose.recipient(), content: compose.message_content()}; @@ -500,11 +510,6 @@ function validate_stream_message() { return false; } - if (exports.subject() === "") { - compose_error("Please specify a subject", $("#subject")); - return false; - } - var response; if (!subs.have(stream_name)) {