When hiding the sender email address, only hide the element that was previously shown

(imported from commit 527f58aff4f2ec65d7ffe693bc20298b4563ff4e)
This commit is contained in:
Zev Benjamin
2012-11-16 13:35:56 -05:00
parent 90e0fc6259
commit 39aab741c8

View File

@@ -23,8 +23,12 @@ exports.focus_on = function (field_id) {
because we want to reserve space for the email address. This avoids
things jumping around slightly when the email address is shown. */
var current_email_elem;
function hide_email() {
$('.sender_email').addClass('invisible');
if (current_email_elem !== undefined) {
current_email_elem.addClass('invisible');
current_email_elem = undefined;
}
}
function show_email(message_row) {
@@ -32,7 +36,9 @@ function show_email(message_row) {
while (!message_row.hasClass('include-sender')) {
message_row = message_row.prev();
}
message_row.find('.sender_email').removeClass('invisible');
var elem = message_row.find('.sender_email');
elem.removeClass('invisible');
current_email_elem = elem;
}
exports.report_message = function (response, status_box, cls) {