aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/templates/received_detail.html
blob: 623ab7326fad402940dbd295d5e45a0a31afff22 (plain) (blame)
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
<!--
SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me>

SPDX-License-Identifier: BSD-3-Clause
-->
{% extends "base.html" %}

{% from "includes/failure_guidance.html" import render_failure %}
{% set status_presentation = {
  "received": {
    "badge": "text-bg-info",
    "label": "Pending"
  },
  "verifying": {
    "badge": "text-bg-warning",
    "label": "Verifying"
  },
  "verified": {
    "badge": "text-bg-success",
    "label": "Verified"
  },
  "failed": {
    "badge": "text-bg-danger",
    "label": "Declined (failed)"
  },
  "source_removed": {
    "badge": "text-bg-danger",
    "label": "Declined (source removed)"
  }
} %}

{% block styles %}
  {{ super() }}
  <link rel="stylesheet"
        href="{{ url_for('static', filename='styles/style.css') }}">
{% endblock %}

{% block content %}
  <div class="mb-3">
    <a href="{{ url_for('webmentions.received_list', page=page, **filters) }}">← Back to received Webmentions</a>
  </div>
  <div class="d-flex flex-wrap justify-content-between align-items-center gap-2 mb-4">
    <h1 class="mb-0">Received Webmention</h1>
    {% set style = status_presentation.get(webmention.status, {"badge": "text-bg-secondary", "label": "Unknown"}) %}
    <span class="badge fs-6 {{ style.badge }}">{{ style.label }}</span>
  </div>
  <section aria-labelledby="mention-details-heading" class="card mb-4">
    <div class="card-body">
      <h2 id="mention-details-heading" class="h4 card-title mb-3">Details</h2>
      <dl class="row mb-0">
        <dt class="col-md-3">Source</dt>
        <dd class="col-md-9 text-break">
          <a href="{{ webmention.source }}">{{ webmention.source }}</a>
        </dd>
        <dt class="col-md-3">Target</dt>
        <dd class="col-md-9 text-break">
          <a href="{{ webmention.target }}">{{ webmention.target }}</a>
        </dd>
        <dt class="col-md-3">Received</dt>
        <dd class="col-md-9">
          <time datetime="{{ webmention.created_at | utc_isoformat }}"
                title="{{ webmention.created_at | utc_timestamp }}">
            {{ webmention.created_at | relative_time }}
          </time>
        </dd>
        <dt class="col-md-3">Last updated</dt>
        <dd class="col-md-9">
          <time datetime="{{ webmention.updated_at | utc_isoformat }}"
                title="{{ webmention.updated_at | utc_timestamp }}">
            {{ webmention.updated_at | relative_time }}
          </time>
        </dd>
        <dt class="col-md-3">Recovery attempts</dt>
        <dd class="col-md-9">
          {{ webmention.recovery_attempts }} <span class="text-body-secondary small">(automatic stale-verification recoveries; resets when verification is explicitly reopened)</span>
        </dd>
        <dt class="col-md-3">Webmention ID</dt>
        <dd class="col-md-9">
          <code class="text-break">{{ webmention.uuid }}</code>
        </dd>
        <dt class="col-md-3">Public status</dt>
        <dd class="col-md-9">
          <a href="{{ url_for('webmentions.webmention_status', identifier=webmention.uuid, _external=True) }}">View public status page</a>
        </dd>
        <dt class="col-md-3">Failure reason</dt>
        <dd class="col-md-9">
          {% if webmention.failure_reason %}
            {{ render_failure(webmention.failure_reason) }}
          {% else %}
            <span class="text-body-secondary">None</span>
          {% endif %}
        </dd>
      </dl>
    </div>
  </section>
  <div class="d-flex flex-wrap gap-2 mb-4" aria-label="Webmention actions">
    <button type="button"
            class="btn btn-sm btn-primary"
            data-bs-toggle="modal"
            data-bs-target="#confirmation-modal"
            data-action="{{ url_for('webmentions.reverify_received_webmention', webmention_uuid=webmention.uuid, return_to='detail', page=page, **filters) }}"
            data-title="Reverify webmention?"
            data-message="The webmention will be fetched and verified again."
            data-confirm-label="Reverify"
            data-confirm-class="btn-primary">Reverify</button>
    <button type="button"
            class="btn btn-sm btn-warning"
            data-bs-toggle="modal"
            data-bs-target="#confirmation-modal"
            data-action="{{ url_for('webmentions.block_received_source', webmention_uuid=webmention.uuid, return_to='detail', page=page, **filters) }}"
            data-title="Block this source domain?"
            data-message="Future Webmentions from this source hostname and its subdomains will be rejected."
            data-confirm-label="Block domain"
            data-confirm-class="btn-warning">Block this domain</button>
    <button type="button"
            class="btn btn-sm btn-danger"
            data-bs-toggle="modal"
            data-bs-target="#confirmation-modal"
            data-action="{{ url_for('webmentions.delete_received_webmention', webmention_uuid=webmention.uuid, page=page, **filters) }}"
            data-title="Delete webmention?"
            data-message="This permanently deletes the webmention and cannot be undone."
            data-confirm-label="Delete"
            data-confirm-class="btn-danger">Delete</button>
  </div>
  <section aria-labelledby="status-history-heading">
    <h2 class="h4 mb-3" id="status-history-heading">Status history</h2>
    {% if history %}
      <ol class="list-group list-group-numbered mb-3">
        {% for event in history %}
          {% set event_style = status_presentation.get(event.status, {"badge": "text-bg-secondary", "label": "Unknown"}) %}
          <li class="list-group-item d-flex gap-2">
            <div class="flex-grow-1" style="min-width: 0;">
              <div class="d-flex flex-wrap align-items-center gap-2 mb-1">
                <span class="badge {{ event_style.badge }}">{{ event_style.label }}</span>
                <strong>{{ event.action }}</strong>
                <time class="ms-auto text-body-secondary small"
                      datetime="{{ event.occurred_at | utc_isoformat }}"
                      title="{{ event.occurred_at | utc_timestamp }}">
                  {{ event.occurred_at | relative_time }}
                </time>
              </div>
              <div class="small text-body-secondary">Recovery attempts: {{ event.recovery_attempts }}</div>
              {% if event.failure_reason %}
                <div class="mt-2">{{ render_failure(event.failure_reason) }}</div>
              {% endif %}
            </div>
          </li>
        {% endfor %}
      </ol>
    {% else %}
      <p class="text-body-secondary">No historical transitions were recorded for this Webmention. Its current status appears above.</p>
    {% endif %}
  </section>
  {% include "includes/confirmation_modal.html" %}
{% endblock %}

{% block scripts %}
  {{ super() }}
  <script src="{{ url_for('static', filename='js/confirmation-modal.js') }}"></script>
{% endblock %}