aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/views.py
diff options
context:
space:
mode:
authorDennis Fink2026-08-21 13:13:23 +0200
committerDennis Fink2026-08-21 13:13:23 +0200
commit75d22f618b22de6d26ed66bd9a15bf7a66e97af9 (patch)
treebe4b29d9c761b79d6ac476adda00dfb9f31b415e /webmentions_ssg/views.py
parent66ad7fefff6edc1d993f5c347430a28d63727988 (diff)
downloadwebmentions-ssg-75d22f618b22de6d26ed66bd9a15bf7a66e97af9.tar.gz
webmentions-ssg-75d22f618b22de6d26ed66bd9a15bf7a66e97af9.zip
feat(sender): paginate sent webmention details
Load sent Webmentions with database-backed pagination instead of eagerly loading the full relationship for each source. Condense delivery, revision, and activity metadata in the source detail table and add pagination controls for large Webmention sets.
Diffstat (limited to 'webmentions_ssg/views.py')
-rw-r--r--webmentions_ssg/views.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/webmentions_ssg/views.py b/webmentions_ssg/views.py
index 2235735..543a44c 100644
--- a/webmentions_ssg/views.py
+++ b/webmentions_ssg/views.py
@@ -220,16 +220,19 @@ def sent_source(source_identifier: uuid.UUID) -> ResponseReturnValue:
:return: Rendered source details page.
"""
source = db.session.scalar(
- sa.select(Source)
- .options(selectinload(Source.sent_webmentions))
- .where(Source.uuid == source_identifier)
+ sa.select(Source).where(Source.uuid == source_identifier)
)
+
if source is None:
return abort(404)
- webmentions = sorted(
- source.sent_webmentions, key=lambda webmention: webmention.target
+ webmentions = db.paginate(
+ sa.select(SentWebmention)
+ .where(SentWebmention.source_id == source.uuid)
+ .order_by(SentWebmention.target, SentWebmention.uuid),
+ per_page=25,
)
+
return render_template(
"sent_source.html",
title="Sent Webmentions",