From 8ec35babe87ff8139ec23cc10b858b7481f132db Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Thu, 19 Nov 2026 18:15:34 +0100 Subject: refactor(sender)!: align sent Webmention terminology Rename source-list forms, views, helpers, and tests around the Sent Webmentions UI while keeping source documents as the grouping model. BREAKING CHANGE: authenticated outgoing routes move from `/sources` to `/sent`, with corresponding blueprint endpoint and Python module renames. --- webmentions_ssg/forms/sources.py | 81 ---------------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 webmentions_ssg/forms/sources.py (limited to 'webmentions_ssg/forms/sources.py') diff --git a/webmentions_ssg/forms/sources.py b/webmentions_ssg/forms/sources.py deleted file mode 100644 index 04afe77..0000000 --- a/webmentions_ssg/forms/sources.py +++ /dev/null @@ -1,81 +0,0 @@ -# SPDX-FileCopyrightText: 2026 Dennis Fink -# -# SPDX-License-Identifier: BSD-3-Clause - -"""Source document filtering form.""" - -from flask import current_app -from flask_wtf import FlaskForm -from wtforms import ( - DateField, - HiddenField, - IntegerField, - SearchField, - SelectField, - ValidationError, -) -from wtforms.validators import AnyOf, NumberRange, Optional - -from .validators import CanonicalDate - -SOURCE_STATUS_CHOICES = { - "": "All sources", - "failing": "Failing sends", - "retrying": "Awaiting retry", - "deleted": "Deleted sources", -} - - -def default_source_page_size() -> int: - """Use 25 rows unless the configured maximum is lower.""" - return min(25, current_app.config["SOURCES_MAX_PAGE_SIZE"]) - - -class SourceFilterForm(FlaskForm): - """GET filters for the source document list.""" - - status = SelectField("Status", choices=SOURCE_STATUS_CHOICES, default="") - q = SearchField("Path or URL") - date_from = DateField( - "Last seen from (UTC)", validators=[Optional(), CanonicalDate()] - ) - date_to = DateField("Last seen to (UTC)", validators=[Optional(), CanonicalDate()]) - sort = HiddenField( - default="last_seen", - validators=[ - AnyOf( - ( - "path", - "url", - "webmentions", - "revision", - "created", - "last_seen", - "status", - ) - ) - ], - ) - order = HiddenField(default="desc", validators=[AnyOf(("asc", "desc"))]) - per_page = IntegerField( - "Rows per page", - default=default_source_page_size, - validators=[NumberRange(min=1)], - ) - - def validate_per_page(self, field: IntegerField) -> None: - """Enforce the deployment's maximum source-list page size.""" - if ( - field.data is not None - and field.data > current_app.config["SOURCES_MAX_PAGE_SIZE"] - ): - raise ValidationError("Rows per page exceeds the configured maximum.") - - def validate_date_to(self, field: DateField) -> None: - """Require an end date on or after the start date.""" - if ( - self.date_from.data is not None - and field.data is not None - and field.data < self.date_from.data - ): - raise ValidationError("End date must be on or after start date.") -- cgit v1.3.1