~sircmpwn/lists.sr.ht

ref: b0a92975f11afb7487f6af43b364ce44647ed7d1 lists.sr.ht/listssrht/templates/thread.html -rw-r--r-- 6.8 KiB View raw
b0a92975Drew DeVault Add contrib/reclassify-patches 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
{% extends "list.html" %}
{% block title %}
<title>
  {{ thread.subject }} &mdash; {{ cfg("sr.ht", "site-name") }} lists
</title>
{% endblock %}
{% block head %}
<link rel="alternate" type="application/mbox" href="{{ url_for('archives.mbox',
    owner_name=owner.canonical_name, list_name=ml.name,
    message_id=thread.message_id) }}">
{% endblock %}
{% block content %}
<div class="container">
  <div class="row">
    <div class="col-md-12">
      {% macro display_message(msg) %}
      {% set stripped_subject =
        msg.subject[4:] if (msg.subject
          .upper().startswith("RE: ")) else msg.subject %}
      {% if msg == thread %}
      <small class="text-muted pull-right" style="line-height: 2">
        {% if msg.nreplies > 0 %}
        <span>{{icon("reply")}} {{msg.nreplies}}</span>
        {% endif %}
        {% if msg.nparticipants > 1 %}
        <span>{{icon("user")}} {{msg.nparticipants}}</span>
        {% endif %}
      </small>
      <h3>
        {{ msg.subject }}
      </h3>
      {% elif stripped_subject != thread.subject %}
      <h3>{{ msg.subject }}</h3>
      {% endif %}
      <div>
        <div class="message-header">
          <div class="from">
            {% set from_hdr = msg.parsed()['From'] %}
            {% set from = parseaddr(from_hdr) %}
            {% if msg.sender != None %}
            <a href="/{{ msg.sender.canonical_name }}">{{from[0]}}</a>
            {% else %}
            {{from[0]}}
            {% endif %}
            {% if current_user %}
            <a href="{{reply_to(msg)}}">&lt;{{ from[1] }}&gt;</a>
            {% endif %}
          </div>
          {% set dkim_status, dkim_explain =
            parse_auth_result(msg.parsed(), "dkim") %}
          <details>
            <summary>Details</summary>
            <div>
              <dl>
                <dt>Message ID</dt>
                <dd><code>{{ msg.message_id }}</code></dd>
                {% if msg.parent_id %}
                <dt>In-Reply-To</dt>
                <dd>
                  <code>
                    {{ msg.parent.message_id }}
                  </code>
                  <a href="#{{msg.parent.message_id}}">(view parent)</a>
                </dd>
                <dd>
                {% endif %}
                {% if msg.message_date %}
                <dt>Sender timestamp</dt>
                <dd>{{"{:.0f}".format(msg.message_date.timestamp())}}</dd>
                {% endif %}
                <dt>DKIM signature</dt>
                <dd>
                  {% if dkim_status == None %}
                  missing
                  {% else %}
                  <span
                    {% if dkim_status == "pass" %}
                    class="text-success"
                    {% elif dkim_status == "neutral" %}
                    {% else %}
                    class="text-danger"
                    {% endif %}
                    title="{{dkim_explain}}"
                  >
                    {% if dkim_status == "pass" %}
                    {{icon('check')}}
                    {% elif dkim_status == "neutral" %}
                    {% else %}
                    {{icon('times')}}
                    {% endif %}
                    {{dkim_status}}
                    {% if dkim_status not in ["pass", "neutral"]
                      and ml.mirror_id %}
                    (DKIM failures on mirrored lists are common)
                    {% endif %}
                  </span>
                  {% endif %}
                </dd>
              </dl>
              <a href="{{ url_for(".raw",
                  owner_name=ml.owner.canonical_name,
                  list_name=ml.name,
                  message_id=msg.message_id
                ) }}" target="_blank">Download raw message</a>
              {% if current_user and current_user.id == ml.owner_id %}
              <h4 style="margin-top: 1rem">Moderation tools</h4>
              <form
                method="POST"
                action="{{url_for("archives.remove_message",
                  owner_name=ml.owner.canonical_name, list_name=ml.name,
                  message_id=msg.message_id)}}"
              >
                {{csrf_token()}}
                <button class="btn btn-danger">
                  Remove message from the archives
                  {{icon('caret-right')}}
                </button>
              </form>
              {% endif %}
            </div>
          </details>
          <div class="date">
            <a
              id="{{ msg.message_id }}"
              href="#{{ msg.message_id }}"
              class="text-muted"
            >{{ msg.created | date }}</a>
          </div>
          <div class="msg-info">
            {% if msg.is_patch %}
            <span class="info">
              {% set stats = diffstat(msg) %}
              Patch:
              <span class="text-success">+{{stats.added}}</span>
              <span class="text-danger">-{{stats.removed}}</span>
            </span>
            {% endif %}
            {#
              permerror issues are inaccurate for as-of-yet unknown reasons.
              See thread on opendkim-users 2019-03-04
            #}
            {% if dkim_status != None and dkim_status != "pass"
              and dkim_status != "permerror"
              and not ml.mirror_id %}
            <span class="info" title="{{ dkim_explain }}">
              DKIM signature:
              <span class="text-danger">
                {{icon("times")}} {{dkim_status}}
              </span>
            </span>
            {% endif %}
          </div>
        </div>
        <pre class="message-body">{{ format_body(msg) }}</pre>
      </div>
      {% endmacro %}

      {{ display_message(thread) }}
      {% for msg in messages %}
      {{ display_message(msg) }}
      {% endfor %}
    </div>
  </div>
  <div class="row">
    <div class="col-md-6 offset-md-6">
      <div class="form-group">
        {% if thread.patchset_id %}
        <a class="btn btn-success btn-block" href="{{ url_for('patches.patchset',
          owner_name=owner.canonical_name, list_name=ml.name,
          patchset_id=thread.patchset_id) }}"
        >Review patch {{icon('caret-right')}}</a>
        {% if current_user %}
        <a class="btn btn-default btn-block"
          href="{{reply_to(thread.replies[-1] if thread.replies else thread)}}"
        >Reply to thread {{icon('caret-right')}}</a>
        {% endif %}
        {% else %}
        {% if current_user %}
        <a class="btn btn-primary btn-block"
          href="{{reply_to(thread.replies[-1] if thread.replies else thread)}}"
        >Reply to thread {{icon('caret-right')}}</a>
        {% endif %}
        {% endif %}
        <a class="btn btn-default btn-block" href="{{ url_for('archives.mbox',
          owner_name=owner.canonical_name, list_name=ml.name,
          message_id=thread.message_id) }}"
        >Export thread (mbox) {{icon('caret-right')}}</a>
      </div>
    </div>
  </div>
</div>
{% endblock %}