compose: Fix confusing variable name in preview code path.

This seems to be the root cause of the bug fixed in the last commit.
This commit is contained in:
Tim Abbott 2017-08-27 09:27:50 -07:00
parent eb6d736df3
commit 0f1768d0d1
1 changed files with 7 additions and 7 deletions

View File

@ -651,16 +651,16 @@ exports.initialize = function () {
$("#compose").on("click", "#markdown_preview", function (e) {
e.preventDefault();
var message = $("#new_message_content").val();
var content = $("#new_message_content").val();
$("#new_message_content").hide();
$("#markdown_preview").hide();
$("#undo_markdown_preview").show();
$("#preview_message_area").show();
if (message.length === 0) {
if (content.length === 0) {
$("#preview_content").html(i18n.t("Nothing to preview"));
} else {
if (markdown.contains_backend_only_syntax(message)) {
if (markdown.contains_backend_only_syntax(content)) {
var spinner = $("#markdown_preview_spinner").expectOne();
loading.make_indicator(spinner);
} else {
@ -672,22 +672,22 @@ exports.initialize = function () {
// accurate; if the `markdown.contains_backend_only_syntax` logic is
// incorrect wrong, users will see a brief flicker).
var message_obj = {
raw_content: message,
raw_content: content,
};
$("#preview_content").html(markdown.apply_markdown(message_obj));
}
channel.post({
url: '/json/messages/render',
idempotent: true,
data: {content: message},
data: {content: content},
success: function (response_data) {
if (markdown.contains_backend_only_syntax(message)) {
if (markdown.contains_backend_only_syntax(content)) {
loading.destroy_indicator($("#markdown_preview_spinner"));
}
$("#preview_content").html(response_data.rendered);
},
error: function () {
if (markdown.contains_backend_only_syntax(message)) {
if (markdown.contains_backend_only_syntax(content)) {
loading.destroy_indicator($("#markdown_preview_spinner"));
}
$("#preview_content").html(i18n.t("Failed to generate preview"));