get_displayed_email_data_for_thread = function(email_data) {
        var displayed_email_data = email_data;

        var threads = displayed_email_data.threads;
        var total_threads = displayed_email_data.total_threads;

        var hash = window.location.hash.split("#")[1] || "";
        var is_in_trash = (hash.indexOf("trash") === 0);

        for (var id in threads) {
            var email = threads[id];
            var keep_email = (is_in_trash) ? email.is_deleted : !email.is_deleted;

            if (!keep_email) {
                delete threads[id];
                total_threads.splice(total_threads.indexOf(id), 1);
                displayed_email_data.total_emails--;
                // TODO: remove people involved only in this email.
            }
        }
        return displayed_email_data;
    }
Re-renders the UI using the available data.

This method does _not_ cause Gmail to fetch new data. This method is useful
in circumstances where Gmail has data available but does not immediately
render it. `observe.after` may be used to detect when Gmail has fetched the
relevant data. For instance, to refresh a conversation after Gmail fetches
its data:

    gmail.observe.after("refresh", function(url, body, data, xhr) {
      if (url.view === "cv") {
        gmail.tools.rerender();
      }
    });

If a callback is passed, it will be invoked after re-rendering is complete.