Give a placeholder subject when users don't supply one.

(imported from commit ac6f0f7029c6a96c4c20562b02bee656436c70b2)
This commit is contained in:
Jessica McKellar 2013-05-20 16:52:03 -04:00
parent 17842cebd7
commit a3b6758315
1 changed files with 11 additions and 6 deletions

View File

@ -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)) {