<commit_before>{% extends "questions/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% from "upload/attachments.html" import attachments_form, attachment %}
{% from "includes/common_macros.html" import content_editor with context %}
{% from "wiki/includes/flag_form.html" import flag_form with context %}
{% from "questions/includes/questions.html" import troubleshooting_info %}
{% from "questions/includes/macros.html" import mark_spam_form, unmark_spam_form with context %}

{% set classes = 'answers' %}

{% set product_title = pgettext('DB: products.Product.title', product.title) if product else _('All Products') %}

{# L10n: {q} is the title of the question. #}
{% set title = _('{q} | {product} Support Forum')|f(q=question.title, product=product_title) %}

{% set crumbs = [(url('questions.home'), _('Support Forum')),
                 (url('questions.list', question.product_slug), product_title),
                 (None, question.title)] %}

{% set canonical_url = unlocalized_url('questions.details', question.id) %}

{% if answers.number > 1 %}
  {% set canonical_url = canonical_url|urlparams(page=answers.number) %}
{% endif %}

{% if robots_noindex %}
  {% set meta = (('robots', 'noindex'),) %}
{% endif %}

{% block above_main %}
  <h1>{{ _('Support Forum') }}</h1>

  {% if question.is_taken and question.taken_by != request.user %}
    <div class="taken-notice">
      {{ _('{user} is currently working on this problem.')|f(user=question.taken_by) }}
      <a href="#question-reply">{{ _('Post a reply') }}</a> |
      <a href="{{ url('questions.list', question.product.slug) }}">{{ _('View other questions that need attention.') }}</a>
    </div>
  {% endif %}
{% endblock %}

{% block content %}
  <article>
    <div id="question-{{ question.id }}" class="question grid_9" itemscope itemtype="http://schema.org/Question">
      {% if question.is_locked or question.is_archived %}
        <div class="notice">
          {% if question.is_locked and not question.is_archived %}
            {{ _('This thread was closed.') }}
          {% elif not question.is_locked and question.is_archived %}
            {{ _('This thread was archived.') }}
          {% else %}
            {{ _('This thread was closed and archived.') }}
          {% endif %}

          <a href="{{ url('kitsune.questions.views.aaq') }}">
            {{ _('Please ask a new question if you need help.') }}
          </a>
        </div>
      {% endif %}

      <h2 class="summary" itemprop="headline">{{ question.title }}</h2>

      <div class="question-meta">
        <ul class="cf">
          <li>
            {% if question.num_answers > 0 %}
              {# L10n: {n} is the number of replies. #}
              {{ ngettext('1 reply', '{n} replies', question.num_answers)|f(n=question.num_answers) }}
            {% else %}
              {{ _('No replies') }}
            {% endif %}
          </li>
          <li class="have-problem">
            {{ question.num_votes }}
            {% trans count=question.num_votes %}
              has this problem
              {% pluralize %}
              have this problem
            {% endtrans %}
          </li>
          {% if question.num_visits %}
            <li class="visits">
              {% trans count=question.num_visits %}
                {{count}} view
              {% pluralize %}
                {{count}} views
              {% endtrans %}
            </li>
          {% endif %}
          {% if question.last_answer %}
            <li>
              <a href="{{ question.last_answer.get_absolute_url() }}">
                {{ _('Last reply by {user}')|f(user=display_name(question.last_answer.creator)) }}
              </a>
              <span class="last-answer-date">
                <time itemprop="dateModified" datetime="{{ question.last_answer.created }}">{{ question.last_answer.created|timesince }}</time>
              </span>
            </li>
          {% endif %}
          {% if question.is_spam %}
            <li class="marked-as-spam">
              {% trans marked_by=question.marked_as_spam_by, marked_time=question.marked_as_spam %}
                Marked as spam by {{ marked_by }} at {{ marked_time }}
              {% endtrans %}
            </li>
          {% endif %}
        </ul>
      </div>

      <div class="user-meta">
        <div class="avatar">
          <a href="{{ profile_url(question.creator, request.user == question.creator) }}">
            <img src="{{ profile_avatar(question.creator) }}" height="48" width="48" alt="{{ display_name(question.creator) }}"/>
          </a>
        </div>
        <div class="asked-by">
          <a class="author-name" href="{{ profile_url(question.creator, request.user == question.creator) }}">{{ display_name(question.creator) }}</a>
        </div>
        <div class="asked-on">
          {{ _('Posted') }}<br>
          <time itemprop="dateCreated" datetime="{{ question.created }}">{{ datetimeformat(question.created) }}</time>
        </div>
      </div>

      <div class="main-content">
        <div itemprop="text">{{ question.content_parsed|safe }}</div>
        {# Note: this is not vulnerable to injection because Jinja autoescapes the strings. #}
        <div class="content-raw">{{ question.content }}</div>

        {% if question.images.count() %}
          <div class="attachments-title">
            {{ _('Attached screenshots') }}
          </div>
          <div class="question-attachments attachments-list">
          {% for image in question.images.all() %}
            {{ attachment(image, user, False) }}
          {% endfor %}
          </div>
        {% endif %}<commit_msg>Avoid extra count query in question details template<commit_after>{% extends "questions/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% from "upload/attachments.html" import attachments_form, attachment %}
{% from "includes/common_macros.html" import content_editor with context %}
{% from "wiki/includes/flag_form.html" import flag_form with context %}
{% from "questions/includes/questions.html" import troubleshooting_info %}
{% from "questions/includes/macros.html" import mark_spam_form, unmark_spam_form with context %}

{% set classes = 'answers' %}

{% set product_title = pgettext('DB: products.Product.title', product.title) if product else _('All Products') %}

{# L10n: {q} is the title of the question. #}
{% set title = _('{q} | {product} Support Forum')|f(q=question.title, product=product_title) %}

{% set crumbs = [(url('questions.home'), _('Support Forum')),
                 (url('questions.list', question.product_slug), product_title),
                 (None, question.title)] %}

{% set canonical_url = unlocalized_url('questions.details', question.id) %}

{% if answers.number > 1 %}
  {% set canonical_url = canonical_url|urlparams(page=answers.number) %}
{% endif %}

{% if robots_noindex %}
  {% set meta = (('robots', 'noindex'),) %}
{% endif %}

{% block above_main %}
  <h1>{{ _('Support Forum') }}</h1>

  {% if question.is_taken and question.taken_by != request.user %}
    <div class="taken-notice">
      {{ _('{user} is currently working on this problem.')|f(user=question.taken_by) }}
      <a href="#question-reply">{{ _('Post a reply') }}</a> |
      <a href="{{ url('questions.list', question.product.slug) }}">{{ _('View other questions that need attention.') }}</a>
    </div>
  {% endif %}
{% endblock %}

{% block content %}
  <article>
    <div id="question-{{ question.id }}" class="question grid_9" itemscope itemtype="http://schema.org/Question">
      {% if question.is_locked or question.is_archived %}
        <div class="notice">
          {% if question.is_locked and not question.is_archived %}
            {{ _('This thread was closed.') }}
          {% elif not question.is_locked and question.is_archived %}
            {{ _('This thread was archived.') }}
          {% else %}
            {{ _('This thread was closed and archived.') }}
          {% endif %}

          <a href="{{ url('kitsune.questions.views.aaq') }}">
            {{ _('Please ask a new question if you need help.') }}
          </a>
        </div>
      {% endif %}

      <h2 class="summary" itemprop="headline">{{ question.title }}</h2>

      <div class="question-meta">
        <ul class="cf">
          <li>
            {% if question.num_answers > 0 %}
              {# L10n: {n} is the number of replies. #}
              {{ ngettext('1 reply', '{n} replies', question.num_answers)|f(n=question.num_answers) }}
            {% else %}
              {{ _('No replies') }}
            {% endif %}
          </li>
          <li class="have-problem">
            {{ question.num_votes }}
            {% trans count=question.num_votes %}
              has this problem
              {% pluralize %}
              have this problem
            {% endtrans %}
          </li>
          {% if question.num_visits %}
            <li class="visits">
              {% trans count=question.num_visits %}
                {{count}} view
              {% pluralize %}
                {{count}} views
              {% endtrans %}
            </li>
          {% endif %}
          {% if question.last_answer %}
            <li>
              <a href="{{ question.last_answer.get_absolute_url() }}">
                {{ _('Last reply by {user}')|f(user=display_name(question.last_answer.creator)) }}
              </a>
              <span class="last-answer-date">
                <time itemprop="dateModified" datetime="{{ question.last_answer.created }}">{{ question.last_answer.created|timesince }}</time>
              </span>
            </li>
          {% endif %}
          {% if question.is_spam %}
            <li class="marked-as-spam">
              {% trans marked_by=question.marked_as_spam_by, marked_time=question.marked_as_spam %}
                Marked as spam by {{ marked_by }} at {{ marked_time }}
              {% endtrans %}
            </li>
          {% endif %}
        </ul>
      </div>

      <div class="user-meta">
        <div class="avatar">
          <a href="{{ profile_url(question.creator, request.user == question.creator) }}">
            <img src="{{ profile_avatar(question.creator) }}" height="48" width="48" alt="{{ display_name(question.creator) }}"/>
          </a>
        </div>
        <div class="asked-by">
          <a class="author-name" href="{{ profile_url(question.creator, request.user == question.creator) }}">{{ display_name(question.creator) }}</a>
        </div>
        <div class="asked-on">
          {{ _('Posted') }}<br>
          <time itemprop="dateCreated" datetime="{{ question.created }}">{{ datetimeformat(question.created) }}</time>
        </div>
      </div>

      <div class="main-content">
        <div itemprop="text">{{ question.content_parsed|safe }}</div>
        {# Note: this is not vulnerable to injection because Jinja autoescapes the strings. #}
        <div class="content-raw">{{ question.content }}</div>

        {% set question_images = question.images.all() %}
        {% if question_images %}
          <div class="attachments-title">
            {{ _('Attached screenshots') }}
          </div>
          <div class="question-attachments attachments-list">
          {% for image in question_images %}
            {{ attachment(image, user, False) }}
          {% endfor %}
          </div>
        {% endif %}
{'fraction_non_alphanumeric': 0.16858271171566477, 'fraction_numerical': 0.0028082492321193507, 'mean_word_length': 2.3012746234067207, 'pattern_counts': {'":': 0, '<': 125, '<?xml version=': 0, '>': 129, 'https://': 0, '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': '2888364', 'n_tokens_mistral': 3586, 'n_tokens_neox': 3263, 'n_words': 750}