aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/views
diff options
context:
space:
mode:
authorDennis Fink2026-11-15 21:18:19 +0100
committerDennis Fink2026-11-15 21:18:19 +0100
commit9b00526ab79257b65cedd71595848f09ecf84279 (patch)
treef9dfc5c0934499d47499bf083bd864f72947958c /webmentions_ssg/views
parent509d93b2976e353d29441a7a7b7e78ca466dc4fd (diff)
downloadwebmentions-ssg-9b00526ab79257b65cedd71595848f09ecf84279.tar.gz
webmentions-ssg-9b00526ab79257b65cedd71595848f09ecf84279.zip
refactor(core)!: clarify Webmention domain terminology
Rename ambiguous models, statuses, task modules, fields, and helpers so names reflect source documents, verification, endpoint discovery, and delivery state. Migrate persisted status values and database identifiers without losing existing Webmention data. BREAKING CHANGE: persisted status values and database schema names have changed, and several public Python names have been renamed.
Diffstat (limited to 'webmentions_ssg/views')
-rw-r--r--webmentions_ssg/views/admin.py20
-rw-r--r--webmentions_ssg/views/endpoint.py9
2 files changed, 15 insertions, 14 deletions
diff --git a/webmentions_ssg/views/admin.py b/webmentions_ssg/views/admin.py
index 9b7c418..23abe65 100644
--- a/webmentions_ssg/views/admin.py
+++ b/webmentions_ssg/views/admin.py
@@ -15,10 +15,10 @@ from sqlalchemy.orm import selectinload
from .. import forms
from ..extensions import db
-from ..models import ReceivedWebmention, SentWebmention, Source
-from ..tasks.receiver import verify_webmention
+from ..models import ReceivedWebmention, SentWebmention, SourceDocument
from ..tasks.scanner import manual_scan_sources
from ..tasks.sender import send_webmention
+from ..tasks.verification import verify_webmention
from .blueprint import webmentions_bp
@@ -80,7 +80,7 @@ def reverify_received_webmention(webmention_uuid: uuid.UUID) -> ResponseReturnVa
webmention = db.get_or_404(ReceivedWebmention, webmention_uuid)
- webmention.reset_for_verification()
+ webmention.reopen_verification()
db.session.commit()
@@ -101,9 +101,9 @@ def source_list() -> ResponseReturnValue:
:returns: Rendered page containing the paginated source list.
"""
sources = db.paginate(
- sa.select(Source)
- .options(selectinload(Source.sent_webmentions))
- .order_by(Source.last_seen_at.desc()),
+ sa.select(SourceDocument)
+ .options(selectinload(SourceDocument.sent_webmentions))
+ .order_by(SourceDocument.last_seen_at.desc()),
per_page=25,
)
return render_template(
@@ -138,11 +138,11 @@ def source_detail(source_uuid: uuid.UUID) -> ResponseReturnValue:
:param source_uuid: UUID of the source to display.
:returns: Rendered source details page.
"""
- source = db.get_or_404(Source, source_uuid)
+ source = db.get_or_404(SourceDocument, source_uuid)
webmentions = db.paginate(
sa.select(SentWebmention)
- .where(SentWebmention.source_id == source.uuid)
+ .where(SentWebmention.source_uuid == source.uuid)
.order_by(SentWebmention.target, SentWebmention.uuid),
per_page=25,
)
@@ -177,13 +177,13 @@ def resend_webmention(
webmention = db.get_or_404(SentWebmention, webmention_uuid)
- if webmention.source_id != source_uuid:
+ if webmention.source_uuid != source_uuid:
abort(HTTPStatus.NOT_FOUND)
# Requeue the existing desired revision instead of inventing a new source
# revision. send_webmention() otherwise exits when this revision has already
# been processed.
- webmention.resend()
+ webmention.clear_result_for_resend()
db.session.commit()
diff --git a/webmentions_ssg/views/endpoint.py b/webmentions_ssg/views/endpoint.py
index be2a9ab..934ffad 100644
--- a/webmentions_ssg/views/endpoint.py
+++ b/webmentions_ssg/views/endpoint.py
@@ -17,8 +17,8 @@ from flask.typing import ResponseReturnValue
from .. import forms
from ..db_helpers import rows_affected
from ..extensions import csrf, db, limiter
-from ..models import ReceivedWebmention, received_url_digest
-from ..tasks.receiver import verify_webmention
+from ..models import ReceivedWebmention, source_target_digest
+from ..tasks.verification import verify_webmention
from .blueprint import webmentions_bp
@@ -37,7 +37,8 @@ def find_received_webmention(source: str, target: str) -> ReceivedWebmention | N
"""
webmention = db.session.execute(
sa.select(ReceivedWebmention).where(
- ReceivedWebmention.url_digest == received_url_digest(source, target)
+ ReceivedWebmention.source_target_digest
+ == source_target_digest(source, target)
)
).scalar_one_or_none()
@@ -92,7 +93,7 @@ def reopen_if_cooldown_elapsed(webmention: ReceivedWebmention) -> bool:
ReceivedWebmention.uuid == webmention.uuid,
ReceivedWebmention.updated_at <= cutoff,
)
- .values(ReceivedWebmention.verification_reset_values(at=now))
+ .values(ReceivedWebmention.reopen_verification_values(at=now))
.execution_options(synchronize_session=False)
)
db.session.commit()