<commit_before><% do_parent ||= false %>
  <%= message_header(@thread, m, first: first, do_parent: do_parent, tree: false, show_editor: true) %>

  <%= render 'votes_accept', m: m %>

  <div class="posting-content">
    <%= m.to_html(self) %>
  </div>

  <% if not m.flags['flagged'].blank? and not current_user.blank? and current_user.moderate?(current_forum) %>
    <div class="flagged-message">
      <p>
        <%= t('plugins.flag_plugin.message_is_flagged', reason: t('messages.close_vote.' + m.flags['flagged'])) %>
        <% if m.flags['flagged'] == 'custom' %>
          <br><%= t('messages.close_vote.' + m.flags['flagged']) %>: <%= m.flags['custom_reason'] %>
        <% end %>
        <% if m.flags['flagged'] == 'duplicate' %>
          <%= link_to t('plugins.flag_plugin.duplicate_message'), m.flags['flagged_dup_url'] %>
        <% end %>
      </p>
    </div>
  <% end %>


  <div class="message-links">
    <% if not m.flags['flattr_id'].blank? %>
      <%= t('layout.flattr_author') %>
      <%= link_to "https://flattr.com/submit/auto?user_id=" + CGI.escape(m.flags['flattr_id']) +
      "&url=" + CGI.escape(cf_message_url(@thread, m)) +
      "&title=" + CGI.escape(m.subject) do %>
      <img src="https://flattr.com/_img/icons/flattr_logo_16.png"
           alt=""
           title=""
           width="16"
           height="16">&nbsp;Flattr this!
    <% end %>
    <% end %>

    <p>
      <% if m.open? and @thread.forum.write?(current_user) %>
        <% if may_answer(m) %>
          <%= link_to t("messages.new_answer"), new_cf_message_path(@thread, m, 'quote_old_message' => 'yes'), class: 'cf-btn', rel: 'nofollow' %>
          <%= link_to t("messages.new_answer_wo_quote"), new_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow' %>
        <% end %>

        <% if current_user and m.user_id %>
          <%= link_to(t("mails.new_mail"),
                      new_mail_path(cf_priv_message: {recipient_id: m.user_id,
                                                      subject: t('mails.regarding_message',
                                                                 subject: m.subject,
                                                                 time: l(m.created_at, format: date_format("date_format_post")))}),
                      class: 'cf-btn', rel: 'nofollow') %>
        <% end %>

        <% if may?(RightsHelper::RETAG) and not check_editable(@thread, m, false) %>
          <%= link_to t('messages.retag'), retag_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow' %>
        <% end %>

        <% if m.flags['flagged'].blank? %>
          <%= link_to('', flag_cf_message_path(@thread, m),
                      class: 'cf-btn icon-flag-message',
                      title: t('plugins.flag_plugin.flag_message'), rel: 'nofollow') %>
        <% elsif current_user and current_user.moderate?(current_forum) %>
          <%= link_to('', unflag_cf_message_path(@thread, m),
                      method: :delete,
                      class: 'cf-btn icon-flag-message active',
                      title: t('plugins.flag_plugin.unflag_message'), rel: 'nofollow') %>
        <% end %>

      <% else %>
        <% if current_user and m.user_id %>
          <%= link_to(t("mails.new_mail"),
                      new_mail_path(cf_priv_message: {recipient_id: m.user_id,
                                                      subject: t('mails.regarding_message',
                                                                 subject: m.subject,
                                                                 time: l(m.created_at, format: date_format("date_format_post")))}),
                      class: 'cf-btn', rel: 'nofollow') %>
        <% end %>
      <% end %>

      <% if check_editable(@thread, m, false) %>
        <%= link_to t('messages.edit_message'), edit_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow' %>
      <% end %>

      <% if may?(RightsHelper::CREATE_CLOSE_REOPEN_VOTE) and
        m.flags['no-answer-admin'] != 'yes' %>
        <%
        # allow close vote if
          # - message is not closed
          # - message hasn't got a close vote already
          if m.open? and m.close_vote.blank?
        %>
          <%= link_to(t('messages.close_vote.close_message_button'),
                      close_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow') %>
        <% end %>
        <%
        # allow open vote if
          # - message is closed
          # - message hasn't got an open vote already
          if not m.open? and m.open_vote.blank?
        %>
          <%= link_to(t('messages.close_vote.open_message_button'),
                      open_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow') %>
        <% end %>
      <% end %>
    </p>

    <% unless m.close_vote.blank? %>
      <%= render 'close_vote', m: m %>
    <% end %>

    <% unless m.open_vote.blank? %>
      <%= render 'open_vote', m: m %>
    <% end %>
  </div>

  <% if m.message_id == @thread.message.message_id and not @thread.accepted.blank? %>
    <h3><%= t('messages.accepted_answers') %></h3>

    <div class="accepted">
      <% @thread.accepted.each do |m| %>
        <article class="thread threadlist"><%= message_header(@thread, m, first: false, do_parent: false, show_votes: true, id_prefix: 'accepted-', subject: false) %></article>
      <% end %>
    </div>
  <% end %>


  <div class="forum-links">
    <nav>
      <ul>
        <li><%= link_to t('layout.home'), root_path %></li>
        <li><%= link_to t('forums.all_forums'), redirect_to_page_path(nil, @thread) %></li>
        <% if current_forum %>
          <li><%= link_to current_forum.name, redirect_to_page_path(current_forum, @thread) %></li>
        <% end %>

        <% if current_user.blank? %>
          <li><%= link_to(t('layout.login'), new_user_session_path, rel: 'nofollow') %></li>
          <li><%= link_to t("layout.register"), new_user_registration_path, rel: 'nofollow' %></li>
        <% end %>

        <% if current_user and current_user.moderate?(current_forum) %>
          <% if @view_all %>
            <li><%= link_to t("forums.normal_view"), cf_message_path(@thread, @message, view_all: nil), rel: 'nofollow' %></li>
          <% else %>
            <li><%= link_to t("forums.admin_view"), cf_message_path(@thread, @message, view_all: true), rel: 'nofollow' %></li>
          <% end %>
        <% end %>
      </ul>
    </nav>
  </div><commit_msg>fix: `deactivate admin view` now links to the forum when current message is deleted<commit_after><% do_parent ||= false %>
  <%= message_header(@thread, m, first: first, do_parent: do_parent, tree: false, show_editor: true) %>

  <%= render 'votes_accept', m: m %>

  <div class="posting-content">
    <%= m.to_html(self) %>
  </div>

  <% if not m.flags['flagged'].blank? and not current_user.blank? and current_user.moderate?(current_forum) %>
    <div class="flagged-message">
      <p>
        <%= t('plugins.flag_plugin.message_is_flagged', reason: t('messages.close_vote.' + m.flags['flagged'])) %>
        <% if m.flags['flagged'] == 'custom' %>
          <br><%= t('messages.close_vote.' + m.flags['flagged']) %>: <%= m.flags['custom_reason'] %>
        <% end %>
        <% if m.flags['flagged'] == 'duplicate' %>
          <%= link_to t('plugins.flag_plugin.duplicate_message'), m.flags['flagged_dup_url'] %>
        <% end %>
      </p>
    </div>
  <% end %>


  <div class="message-links">
    <% if not m.flags['flattr_id'].blank? %>
      <%= t('layout.flattr_author') %>
      <%= link_to "https://flattr.com/submit/auto?user_id=" + CGI.escape(m.flags['flattr_id']) +
      "&url=" + CGI.escape(cf_message_url(@thread, m)) +
      "&title=" + CGI.escape(m.subject) do %>
      <img src="https://flattr.com/_img/icons/flattr_logo_16.png"
           alt=""
           title=""
           width="16"
           height="16">&nbsp;Flattr this!
    <% end %>
    <% end %>

    <p>
      <% if m.open? and @thread.forum.write?(current_user) %>
        <% if may_answer(m) %>
          <%= link_to t("messages.new_answer"), new_cf_message_path(@thread, m, 'quote_old_message' => 'yes'), class: 'cf-btn', rel: 'nofollow' %>
          <%= link_to t("messages.new_answer_wo_quote"), new_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow' %>
        <% end %>

        <% if current_user and m.user_id %>
          <%= link_to(t("mails.new_mail"),
                      new_mail_path(cf_priv_message: {recipient_id: m.user_id,
                                                      subject: t('mails.regarding_message',
                                                                 subject: m.subject,
                                                                 time: l(m.created_at, format: date_format("date_format_post")))}),
                      class: 'cf-btn', rel: 'nofollow') %>
        <% end %>

        <% if may?(RightsHelper::RETAG) and not check_editable(@thread, m, false) %>
          <%= link_to t('messages.retag'), retag_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow' %>
        <% end %>

        <% if m.flags['flagged'].blank? %>
          <%= link_to('', flag_cf_message_path(@thread, m),
                      class: 'cf-btn icon-flag-message',
                      title: t('plugins.flag_plugin.flag_message'), rel: 'nofollow') %>
        <% elsif current_user and current_user.moderate?(current_forum) %>
          <%= link_to('', unflag_cf_message_path(@thread, m),
                      method: :delete,
                      class: 'cf-btn icon-flag-message active',
                      title: t('plugins.flag_plugin.unflag_message'), rel: 'nofollow') %>
        <% end %>

      <% else %>
        <% if current_user and m.user_id %>
          <%= link_to(t("mails.new_mail"),
                      new_mail_path(cf_priv_message: {recipient_id: m.user_id,
                                                      subject: t('mails.regarding_message',
                                                                 subject: m.subject,
                                                                 time: l(m.created_at, format: date_format("date_format_post")))}),
                      class: 'cf-btn', rel: 'nofollow') %>
        <% end %>
      <% end %>

      <% if check_editable(@thread, m, false) %>
        <%= link_to t('messages.edit_message'), edit_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow' %>
      <% end %>

      <% if may?(RightsHelper::CREATE_CLOSE_REOPEN_VOTE) and
        m.flags['no-answer-admin'] != 'yes' %>
        <%
        # allow close vote if
          # - message is not closed
          # - message hasn't got a close vote already
          if m.open? and m.close_vote.blank?
        %>
          <%= link_to(t('messages.close_vote.close_message_button'),
                      close_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow') %>
        <% end %>
        <%
        # allow open vote if
          # - message is closed
          # - message hasn't got an open vote already
          if not m.open? and m.open_vote.blank?
        %>
          <%= link_to(t('messages.close_vote.open_message_button'),
                      open_cf_message_path(@thread, m), class: 'cf-btn', rel: 'nofollow') %>
        <% end %>
      <% end %>
    </p>

    <% unless m.close_vote.blank? %>
      <%= render 'close_vote', m: m %>
    <% end %>

    <% unless m.open_vote.blank? %>
      <%= render 'open_vote', m: m %>
    <% end %>
  </div>

  <% if m.message_id == @thread.message.message_id and not @thread.accepted.blank? %>
    <h3><%= t('messages.accepted_answers') %></h3>

    <div class="accepted">
      <% @thread.accepted.each do |m| %>
        <article class="thread threadlist"><%= message_header(@thread, m, first: false, do_parent: false, show_votes: true, id_prefix: 'accepted-', subject: false) %></article>
      <% end %>
    </div>
  <% end %>


  <div class="forum-links">
    <nav>
      <ul>
        <li><%= link_to t('layout.home'), root_path %></li>
        <li><%= link_to t('forums.all_forums'), redirect_to_page_path(nil, @thread) %></li>
        <% if current_forum %>
          <li><%= link_to current_forum.name, redirect_to_page_path(current_forum, @thread) %></li>
        <% end %>

        <% if current_user.blank? %>
          <li><%= link_to(t('layout.login'), new_user_session_path, rel: 'nofollow') %></li>
          <li><%= link_to t("layout.register"), new_user_registration_path, rel: 'nofollow' %></li>
        <% end %>

        <% if current_user and current_user.moderate?(current_forum) %>
          <% if @view_all %>
            <li>
              <% if @message.deleted? %>
                <%= link_to t("forums.normal_view"), cf_forum_path(current_forum, view_all: nil), rel: 'nofollow' %>
              <% else %>
                <%= link_to t("forums.normal_view"), cf_message_path(@thread, @message, view_all: nil), rel: 'nofollow' %>
              <% end %>
            </li>
          <% else %>
            <li><%= link_to t("forums.admin_view"), cf_message_path(@thread, @message, view_all: true), rel: 'nofollow' %></li>
          <% end %>
        <% end %>
      </ul>
    </nav>
  </div>
{'fraction_non_alphanumeric': 0.17427730394746774, 'fraction_numerical': 0.0012076383123254585, 'mean_word_length': 2.053699008988246, 'pattern_counts': {'":': 0, '<': 241, '<?xml version=': 0, '>': 243, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '658167', 'n_tokens_mistral': 4549, 'n_tokens_neox': 4136, 'n_words': 799}