<commit_before>{% load tags %}
{% load foia_tags %}

{% if communication %}
<section class="{% if not communication.response %}blue{% endif %} collapsable communication textbox {% if communication.autogenerated %}collapsed{% endif %}" id="{{ communication.anchor }}">
    <header class="textbox__header communication-header">
        <p class="from">From: {{ communication.from_who }}</p>
        <div class="actionables nocollapse">
            {% if foia_url %}
            <a href="#{{ communication.anchor }}" class="permalink">
            {% else %}
            <a href="{{communication.foia.get_absolute_url}}#{{communication.anchor}}" class="permalink">
            {% endif %}
                <time datetime="{{ communication.date|date:'c' }}" class="date">{{ communication.date | date:"m/d/Y" }}</time>
            </a>
            {% if not hide_options %}
            {% if request.user.is_staff %}
            <div class="options dropdown">
                <span class="dropdown-trigger">
                    {% include 'lib/component/icon/options.svg' %}
                </span>
                <ul class="options dropdown-list">
                    {% if comm.rawemail %}<li><a href="{% url 'foia-raw' idx=comm.pk %}" class="option dropdown-list-item">Raw Email</a></li>{% endif %}
                    {% if comm.fax_id %}<li><a href="https://console.phaxio.com/viewFax?faxId={{comm.fax_id}}" class="option dropdown-list-item">Phaxio</a></li>{% endif %}
                    <li><a href="#status-{{comm.pk}}-form" class="option dropdown-list-item">Status</a></li>
                    <li><a href="#move-{{comm.pk}}-form" class="option dropdown-list-item">Move</a></li>
                    <li><a href="#resend-{{comm.pk}}-form" class="option dropdown-list-item">Resend</a></li>
                    <li><a href="#delete-{{comm.pk}}-form" class="option dropdown-list-item">Delete</a></li>
                </ul>
            </div>
            {% elif request.user.profile.is_advanced and comm.rawemail.raw_email %}
            <div class="options dropdown">
                <span class="dropdown-trigger">
                    {% include 'lib/component/icon/options.svg' %}
                </span>
                <ul class="options dropdown-list">
                    <li><a href="{% url 'foia-raw' idx=comm.pk %}" class="option">Raw Email</a></li>
                </ul>
            </div>
            {% endif %}
            {% endif %}
        </div>
    </header>
    <section class="textbox__section communication-metadata">
    {% if communication.subject %}
        <p class="small subject">Subject: {{ communication.subject }}</p>
    {% else %}
        <p class="small subject">Subject: None</p>
    {% endif %}
    <span>
    {% if communication.status and request.user.is_staff %}
        <span class="small badge {{communication.status|classify_status}}">{{communication.get_status_display}}</span>
    {% endif %}
    {% if communication.delivered and request.user.is_staff %}
        <span class="small badge">{{communication.delivered|capfirst}}</span>
    {% endif %}
    </span>
    </section>
    {% if communication.communication %}
    <section class="textbox__section communication-body">
        {% if communication.full_html %}
        {{ communication.communication|redact_emails|safe }}
        {% else %}
        {{ communication.communication|redact_emails|urlize|linebreaks }}
        {% endif %}
    </section>
    {% endif %}
    {% if communication.files %}
    <ul class="files">
    {% with foia_url=communication.foia.get_absolute_url %}
    {% with files=communication.files.all|slice:":50" %}
    {% for file in files %}
        <li>{% include 'lib/file.html' with hide_id=True %}</li>
    {% endfor %}
    {% endwith %}
    {% endwith %}
    </ul>
    {% if communication.files|length > 50 %}
    <span class="notification warning">
        <span class="symbol">{% include 'lib/component/icon/warning.svg' %}</span>
        <span class="text">
            <p>There are too many files to display on this communication. <a class="action" href="{% url 'foia-files' jurisdiction=foia.jurisdiction.slug jidx=foia.jurisdiction.pk idx=foia.id slug=foia.slug %}">See all files</a></p>
        </span><commit_msg>show warning if too many files to show<commit_after>{% load tags %}
{% load foia_tags %}

{% if communication %}
<section class="{% if not communication.response %}blue{% endif %} collapsable communication textbox {% if communication.autogenerated %}collapsed{% endif %}" id="{{ communication.anchor }}">
    <header class="textbox__header communication-header">
        <p class="from">From: {{ communication.from_who }}</p>
        <div class="actionables nocollapse">
            {% if foia_url %}
            <a href="#{{ communication.anchor }}" class="permalink">
            {% else %}
            <a href="{{communication.foia.get_absolute_url}}#{{communication.anchor}}" class="permalink">
            {% endif %}
                <time datetime="{{ communication.date|date:'c' }}" class="date">{{ communication.date | date:"m/d/Y" }}</time>
            </a>
            {% if not hide_options %}
            {% if request.user.is_staff %}
            <div class="options dropdown">
                <span class="dropdown-trigger">
                    {% include 'lib/component/icon/options.svg' %}
                </span>
                <ul class="options dropdown-list">
                    {% if comm.rawemail %}<li><a href="{% url 'foia-raw' idx=comm.pk %}" class="option dropdown-list-item">Raw Email</a></li>{% endif %}
                    {% if comm.fax_id %}<li><a href="https://console.phaxio.com/viewFax?faxId={{comm.fax_id}}" class="option dropdown-list-item">Phaxio</a></li>{% endif %}
                    <li><a href="#status-{{comm.pk}}-form" class="option dropdown-list-item">Status</a></li>
                    <li><a href="#move-{{comm.pk}}-form" class="option dropdown-list-item">Move</a></li>
                    <li><a href="#resend-{{comm.pk}}-form" class="option dropdown-list-item">Resend</a></li>
                    <li><a href="#delete-{{comm.pk}}-form" class="option dropdown-list-item">Delete</a></li>
                </ul>
            </div>
            {% elif request.user.profile.is_advanced and comm.rawemail.raw_email %}
            <div class="options dropdown">
                <span class="dropdown-trigger">
                    {% include 'lib/component/icon/options.svg' %}
                </span>
                <ul class="options dropdown-list">
                    <li><a href="{% url 'foia-raw' idx=comm.pk %}" class="option">Raw Email</a></li>
                </ul>
            </div>
            {% endif %}
            {% endif %}
        </div>
    </header>
    <section class="textbox__section communication-metadata">
    {% if communication.subject %}
        <p class="small subject">Subject: {{ communication.subject }}</p>
    {% else %}
        <p class="small subject">Subject: None</p>
    {% endif %}
    <span>
    {% if communication.status and request.user.is_staff %}
        <span class="small badge {{communication.status|classify_status}}">{{communication.get_status_display}}</span>
    {% endif %}
    {% if communication.delivered and request.user.is_staff %}
        <span class="small badge">{{communication.delivered|capfirst}}</span>
    {% endif %}
    </span>
    </section>
    {% if communication.communication %}
    <section class="textbox__section communication-body">
        {% if communication.full_html %}
        {{ communication.communication|redact_emails|safe }}
        {% else %}
        {{ communication.communication|redact_emails|urlize|linebreaks }}
        {% endif %}
    </section>
    {% endif %}
    {% if communication.files %}
    <ul class="files">
    {% with foia_url=communication.foia.get_absolute_url %}
    {% with files=communication.files.all|slice:":50" %}
    {% for file in files %}
        <li>{% include 'lib/file.html' with hide_id=True %}</li>
    {% endfor %}
    {% endwith %}
    {% endwith %}
    </ul>
    {% if communication.files.all|length > 50 %}
    <span class="notification warning">
        <span class="symbol">{% include 'lib/component/icon/warning.svg' %}</span>
        <span class="text">
            <p>There are too many files to display on this communication. <a class="action" href="{% url 'foia-files' jurisdiction=foia.jurisdiction.slug jidx=foia.jurisdiction.pk idx=foia.id slug=foia.slug %}">See all files</a></p>
        </span>
{'fraction_non_alphanumeric': 0.1750087914664166, 'fraction_numerical': 0.0009377564177704841, 'mean_word_length': 2.475356415478615, 'pattern_counts': {'":': 2, '<': 161, '<?xml version=': 0, '>': 163, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '662497', 'n_tokens_mistral': 2695, 'n_tokens_neox': 2384, 'n_words': 484}