commentail 1.2.0__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {commentail-1.2.0 → commentail-1.3.1}/CHANGELOG.md +45 -0
- {commentail-1.2.0/commentail.egg-info → commentail-1.3.1}/PKG-INFO +15 -4
- {commentail-1.2.0 → commentail-1.3.1}/README.md +14 -3
- {commentail-1.2.0 → commentail-1.3.1}/README.ru.md +14 -3
- commentail-1.3.1/commentail/admin_queries.py +67 -0
- commentail-1.3.1/commentail/admin_settings.py +280 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/admin_views.py +172 -352
- commentail-1.3.1/commentail/admission.py +265 -0
- commentail-1.3.1/commentail/antispam.py +112 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/apps.py +3 -2
- {commentail-1.2.0 → commentail-1.3.1}/commentail/assets.py +1 -0
- commentail-1.3.1/commentail/author_access.py +34 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/avatars.py +5 -1
- {commentail-1.2.0 → commentail-1.3.1}/commentail/background.py +34 -4
- commentail-1.3.1/commentail/captcha_providers.py +129 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/config.py +78 -2
- commentail-1.3.1/commentail/content_checks.py +79 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/detection.py +5 -1
- {commentail-1.2.0 → commentail-1.3.1}/commentail/drafts.py +28 -8
- commentail-1.3.1/commentail/fingerprints.py +33 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/forms.py +4 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/limits.py +48 -8
- commentail-1.3.1/commentail/locale/de/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/locale/de/LC_MESSAGES/django.po +36 -0
- commentail-1.3.1/commentail/locale/es/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/locale/es/LC_MESSAGES/django.po +36 -0
- commentail-1.3.1/commentail/locale/fr/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/locale/fr/LC_MESSAGES/django.po +36 -0
- commentail-1.3.1/commentail/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/locale/pt_BR/LC_MESSAGES/django.po +36 -0
- commentail-1.3.1/commentail/locale/ru/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/locale/ru/LC_MESSAGES/django.po +36 -0
- commentail-1.3.1/commentail/mail_access.py +112 -0
- commentail-1.3.1/commentail/migrations/0016_guest_antispam.py +30 -0
- commentail-1.3.1/commentail/migrations/0017_revision_spam_signals.py +19 -0
- commentail-1.3.1/commentail/migrations/0018_private_fingerprints.py +56 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/models.py +34 -4
- {commentail-1.2.0 → commentail-1.3.1}/commentail/objects.py +73 -35
- {commentail-1.2.0 → commentail-1.3.1}/commentail/outbox.py +132 -175
- {commentail-1.2.0 → commentail-1.3.1}/commentail/page_integration.py +4 -1
- {commentail-1.2.0 → commentail-1.3.1}/commentail/permissions.py +1 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/policies.py +16 -6
- commentail-1.3.1/commentail/presentation.py +126 -0
- commentail-1.3.1/commentail/public.py +327 -0
- commentail-1.3.1/commentail/reading.py +66 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/recent.py +79 -39
- {commentail-1.2.0 → commentail-1.3.1}/commentail/security.py +74 -19
- {commentail-1.2.0 → commentail-1.3.1}/commentail/services.py +70 -25
- {commentail-1.2.0 → commentail-1.3.1}/commentail/signals.py +8 -3
- {commentail-1.2.0 → commentail-1.3.1}/commentail/static/commentail/commentail.js +165 -19
- {commentail-1.2.0 → commentail-1.3.1}/commentail/structured.py +2 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/detail.html +2 -2
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/block.html +1 -1
- commentail-1.3.1/commentail/templates/commentail/form.html +1 -0
- commentail-1.3.1/commentail/templates/commentail/provider-captcha.html +7 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templatetags/commentail_admin.py +8 -3
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templatetags/commentail_tags.py +10 -3
- {commentail-1.2.0 → commentail-1.3.1}/commentail/validation.py +6 -1
- {commentail-1.2.0 → commentail-1.3.1}/commentail/views.py +11 -0
- commentail-1.3.1/commentail/widget.py +441 -0
- {commentail-1.2.0 → commentail-1.3.1/commentail.egg-info}/PKG-INFO +15 -4
- {commentail-1.2.0 → commentail-1.3.1}/commentail.egg-info/SOURCES.txt +28 -0
- commentail-1.3.1/docs/releases/1.3.0.md +78 -0
- commentail-1.3.1/docs/releases/1.3.1.md +78 -0
- commentail-1.3.1/docs/wiki/Callbacks.md +152 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Changelog.md +45 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Configuration.md +13 -2
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Deployment.md +23 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Email-and-worker.md +6 -1
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Example-and-testing.md +37 -7
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Guest-comments.md +14 -4
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Home.md +8 -5
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Installation.md +7 -5
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Object-adapters.md +5 -0
- commentail-1.3.1/docs/wiki/Release-1.3.0.md +78 -0
- commentail-1.3.1/docs/wiki/Release-1.3.1.md +78 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Roadmap.md +22 -0
- commentail-1.3.1/docs/wiki/Security-and-privacy.md +164 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Styling.md +1 -1
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Template-contract.md +6 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Templates.md +5 -1
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/_Sidebar.md +2 -0
- {commentail-1.2.0 → commentail-1.3.1}/pyproject.toml +1 -1
- {commentail-1.2.0 → commentail-1.3.1}/tests/settings.py +5 -1
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_actions.py +17 -7
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_admin_ui.py +480 -186
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_admission.py +6 -2
- commentail-1.3.1/tests/test_antispam.py +490 -0
- commentail-1.3.1/tests/test_background.py +351 -0
- commentail-1.3.1/tests/test_captcha_backend.py +304 -0
- commentail-1.3.1/tests/test_captcha_providers.py +112 -0
- commentail-1.3.1/tests/test_cleanup.py +66 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_concurrency.py +40 -2
- commentail-1.3.1/tests/test_content_checks.py +280 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_email_backends.py +76 -26
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_email_presentation.py +40 -13
- commentail-1.3.1/tests/test_fingerprints.py +257 -0
- commentail-1.3.1/tests/test_form_issuance_limits.py +119 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_inline_edit.py +64 -17
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_input_boundaries.py +21 -9
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_lifecycle.py +12 -4
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_localization.py +155 -49
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_mail_admin.py +12 -5
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_notifications.py +40 -13
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_object_adapters.py +14 -7
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_outbox.py +49 -14
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_performance.py +77 -35
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_presentation_contracts.py +3 -1
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_progressive.js +40 -6
- commentail-1.3.1/tests/test_provider_widgets.js +121 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_public_ui.py +119 -43
- commentail-1.3.1/tests/test_reading_contracts.py +172 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_recent_comments.py +105 -39
- commentail-1.3.1/tests/test_registry_diagnostics.py +89 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_release_gaps.py +14 -1
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_rules_csv.py +3 -3
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_security.py +3 -1
- commentail-1.3.1/tests/test_security_boundaries.py +86 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_smtp_chain.py +14 -7
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_staff_authors.py +74 -26
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_transaction_contracts.py +20 -10
- commentail-1.3.1/tools/benchmark_performance.py +558 -0
- {commentail-1.2.0 → commentail-1.3.1}/tools/check_dist.py +49 -11
- {commentail-1.2.0 → commentail-1.3.1}/tools/check_translations.py +31 -7
- commentail-1.2.0/commentail/admission.py +0 -205
- commentail-1.2.0/commentail/locale/de/LC_MESSAGES/django.mo +0 -0
- commentail-1.2.0/commentail/locale/es/LC_MESSAGES/django.mo +0 -0
- commentail-1.2.0/commentail/locale/fr/LC_MESSAGES/django.mo +0 -0
- commentail-1.2.0/commentail/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- commentail-1.2.0/commentail/locale/ru/LC_MESSAGES/django.mo +0 -0
- commentail-1.2.0/commentail/public.py +0 -767
- commentail-1.2.0/commentail/templates/commentail/form.html +0 -1
- commentail-1.2.0/docs/wiki/Callbacks.md +0 -79
- commentail-1.2.0/docs/wiki/Security-and-privacy.md +0 -59
- commentail-1.2.0/tests/test_background.py +0 -174
- commentail-1.2.0/tests/test_captcha_backend.py +0 -147
- commentail-1.2.0/tests/test_cleanup.py +0 -34
- commentail-1.2.0/tools/benchmark_performance.py +0 -386
- {commentail-1.2.0 → commentail-1.3.1}/LICENSE +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/MANIFEST.in +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/admin_urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/checks.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/group_permissions.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/logging.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/management/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/management/commands/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/management/commands/process_commentail.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/middleware.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0001_initial.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0002_sitegrouppermission_hide_sitegrouppermission_view.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0003_actiontoken_captchachallenge_guestgrant.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0004_submissionrecord.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0005_rateevent.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0006_alter_comment_guest_name_and_more.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0007_actiontoken_nonce_replysubscription_mailjob.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0008_mailjob_revision.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0009_formticket.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0010_captchachallenge_backend_and_more.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0011_discussion_content_type_discussion_object_id_and_more.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0012_formticket_draft.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0013_sitecommentsettings_email_enabled.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0014_reading_indexes.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/0015_sitecommentsettings_highlight_staff.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/migrations/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/panels.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/rules_csv.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/static/commentail/admin.css +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/static/commentail/admin.js +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/static/commentail/commentail.css +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/action.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/action_error.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/base.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/confirm_delete.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/field.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/form.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/group_permission_row.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/group_permissions.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/heading.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/list.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/mail.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/management.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/objects.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/page_panel.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/rules.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/rules_import.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/admin/selection.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/author.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/avatar.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/base.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/captcha.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/comment.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/edit-form.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/base.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/button.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/confirm.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/confirm.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/confirm_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/edit.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/edit.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/edit_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/published.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/published.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/published_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/rejected.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/rejected.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/rejected_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/reply.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/reply.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/emails/reply_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templates/commentail/replies.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/templatetags/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/text.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail/wagtail_hooks.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail.egg-info/dependency_links.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail.egg-info/requires.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/commentail.egg-info/top_level.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/assets/commentail-preview.png +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/assets/support-qr.png +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/releases/0.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/releases/0.1.1.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/releases/0.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/releases/1.0.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/releases/1.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/releases/1.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Moderation.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Performance.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Recent-comments.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Release-0.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Release-0.1.1.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Release-0.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Release-1.0.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Release-1.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Release-1.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Replies-and-editing.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Rules-and-CSV.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Stability.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Structured-data.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Support.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/Troubleshooting.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/docs/wiki/_Footer.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/README.md +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo/settings.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo/urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/comments.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/management/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/management/commands/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/management/commands/bootstrap_demo.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/migrations/0001_initial.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/migrations/0002_product.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/migrations/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/models.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/templates/demo_home/home_page.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/templates/demo_home/product.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/demo_home/views.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/example/manage.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/requirements-test-common.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/requirements-test.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/setup.cfg +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/targets/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/targets/apps.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/targets/migrations/0001_initial.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/targets/migrations/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/targets/models.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/templates/wagtailcore/page.html +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_admin.js +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_avatars.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_capability_access.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_detection.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_extension_contracts.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_group_panel.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_name_limit.js +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_rate_limits.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_reply.js +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_rules_admin.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_structured_data.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/test_submission.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.1}/tests/urls_custom_prefix.py +0 -0
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
Each release records changes relative to the previous version. Upgrade notes
|
|
4
4
|
describe changes that an existing installation needs to review.
|
|
5
5
|
|
|
6
|
+
## [1.3.1] — 2026-10-23 · Security update
|
|
7
|
+
|
|
8
|
+
- Key quota identities and submission actor/payload fingerprints with purpose-scoped
|
|
9
|
+
HMAC; migrate existing records without resetting quotas or accepted retries.
|
|
10
|
+
- Deny Page discussions, protected links and mail outside the saved Site root.
|
|
11
|
+
- Limit form/recovery ticket issuance per Site/IP while preserving reading,
|
|
12
|
+
submitted drafts and existing valid tickets; translate refusal in all UI languages.
|
|
13
|
+
- Report distinct object-adapter validation causes without private exception text.
|
|
14
|
+
- Clean expired CAPTCHA, guest grants, form tickets and rate events in batches
|
|
15
|
+
of at most 500, committing each batch independently and preserving live records.
|
|
16
|
+
|
|
17
|
+
Migration `0018` is irreversible: stop writers and back up database/key/package
|
|
18
|
+
before upgrading. See the [1.3.1 upgrade notes](docs/releases/1.3.1.md).
|
|
19
|
+
|
|
20
|
+
## [1.3.0] — 2026-10-22 · Stable
|
|
21
|
+
|
|
22
|
+
- Keep bundled external CAPTCHA bindings valid for the form lifetime, allowing
|
|
23
|
+
long writing before a fresh provider proof without an extra challenge.
|
|
24
|
+
- Hide routine refresh for external CAPTCHA widgets; offer Retry check after errors,
|
|
25
|
+
while retaining arithmetic-task refresh and editable drafts.
|
|
26
|
+
|
|
27
|
+
- Review recent repeated long guest text and link bursts, including guest edits,
|
|
28
|
+
with per-Site thresholds and private moderation reasons. Use bounded keyed
|
|
29
|
+
fingerprints without scanning old bodies or contacting link destinations.
|
|
30
|
+
|
|
31
|
+
- Keep independent browser forms valid when another tab opens or refreshes a CAPTCHA.
|
|
32
|
+
Preserve server-owned form age across draft recovery/navigation, and avoid
|
|
33
|
+
submitting an incomplete external check.
|
|
34
|
+
- Retain rate-limit events for configured intervals longer than one hour, including
|
|
35
|
+
per-Site overrides, so periodic cleanup cannot reset those limits early.
|
|
36
|
+
- Add opt-in Google reCAPTCHA v2 checkbox and Yandex SmartCaptcha adapters while
|
|
37
|
+
retaining arithmetic/no-JavaScript defaults and custom CAPTCHA backends.
|
|
38
|
+
- Add hidden-field and form-age moderation signals, independent guest attempt
|
|
39
|
+
budgets, adaptive/strict CAPTCHA policy and private moderator explanations.
|
|
40
|
+
- Keep drafts editable when CAPTCHA issuance fails. Bound external verification,
|
|
41
|
+
reject invalid host claims and prevent concurrent challenge use without holding
|
|
42
|
+
the Site quota lock during network requests.
|
|
43
|
+
- Upgrade: run migrations `0016` and `0017`, refresh static assets and review custom form and
|
|
44
|
+
CAPTCHA templates. External providers require matching site-owned keys and
|
|
45
|
+
JavaScript; no service is enabled automatically. Missing/blank browser headers
|
|
46
|
+
can now require CAPTCHA again for remembered guests. See the configuration and
|
|
47
|
+
security guides for thresholds and disabling the form timing signal.
|
|
48
|
+
|
|
6
49
|
## [1.2.0] — 2026-10-22 · Stable
|
|
7
50
|
|
|
8
51
|
- Verify Wagtail 8.0.1 in every Wagtail 8 CI stack while retaining the existing
|
|
@@ -198,4 +241,6 @@ See [0.1.0 release notes](docs/releases/0.1.0.md).
|
|
|
198
241
|
|
|
199
242
|
[1.1.0]: https://github.com/hardcodd/Commentail/compare/v1.0.0...v1.1.0
|
|
200
243
|
|
|
244
|
+
[1.3.1]: https://github.com/hardcodd/Commentail/compare/v1.3.0...v1.3.1
|
|
245
|
+
[1.3.0]: https://github.com/hardcodd/Commentail/compare/v1.2.0...v1.3.0
|
|
201
246
|
[1.2.0]: https://github.com/hardcodd/Commentail/compare/v1.1.0...v1.2.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: commentail
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: Self-hosted Wagtail comments with moderation, verified guests and threaded replies
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Source, https://github.com/hardcodd/Commentail
|
|
@@ -34,7 +34,11 @@ Dynamic: license-file
|
|
|
34
34
|
|
|
35
35
|
Moderated discussions, verified guests and inline replies — styled by your site.
|
|
36
36
|
|
|
37
|
-
**Current release: [1.
|
|
37
|
+
**Current release: [1.3.1](https://github.com/hardcodd/Commentail/releases/tag/v1.3.1)** · [PyPI](https://pypi.org/project/commentail/1.3.1/)
|
|
38
|
+
|
|
39
|
+
[1.3.1 is a security update](docs/releases/1.3.1.md). Upgrading requires an
|
|
40
|
+
irreversible fingerprint data migration; review the backup, downtime and
|
|
41
|
+
form-quota guidance before upgrading.
|
|
38
42
|
|
|
39
43
|
[](https://github.com/hardcodd/Commentail/actions/workflows/tests.yml)
|
|
40
44
|
[](https://djangopackages.org/packages/p/commentail/)
|
|
@@ -147,6 +151,13 @@ Registered users can comment without an email address, but receive no mail. Your
|
|
|
147
151
|
site provides login and registration. No required external CDN or CAPTCHA service.
|
|
148
152
|
See [email setup](docs/wiki/Email-and-worker.md).
|
|
149
153
|
|
|
154
|
+
Guest spam protection includes invisible form checks, attempt limits and review
|
|
155
|
+
signals for repeated long text and multiple links, including guest edits. Google
|
|
156
|
+
reCAPTCHA v2 and Yandex SmartCaptcha are optional adapters; external widgets
|
|
157
|
+
require JavaScript, with no alternative path when a check is required.
|
|
158
|
+
See [setup and custom providers](docs/wiki/Callbacks.md#ready-to-use-providers)
|
|
159
|
+
and [guest protection](docs/wiki/Security-and-privacy.md#low-friction-guest-checks).
|
|
160
|
+
|
|
150
161
|
### Languages
|
|
151
162
|
|
|
152
163
|
English (`en`), Russian (`ru`), German (`de`), French (`fr`), Spanish (`es`)
|
|
@@ -164,11 +175,11 @@ The guides are in English; this README is also [available in Russian](README.ru.
|
|
|
164
175
|
In your existing Wagtail site's virtual environment, install the published release:
|
|
165
176
|
|
|
166
177
|
```sh
|
|
167
|
-
python -m pip install commentail==1.
|
|
178
|
+
python -m pip install commentail==1.3.1
|
|
168
179
|
```
|
|
169
180
|
|
|
170
181
|
For the optional PostgreSQL driver, use
|
|
171
|
-
`python -m pip install 'commentail[postgres]==1.
|
|
182
|
+
`python -m pip install 'commentail[postgres]==1.3.1'`.
|
|
172
183
|
For an existing installation, follow
|
|
173
184
|
the [upgrade guide](docs/wiki/Installation.md#upgrading-and-restoring) for your target version.
|
|
174
185
|
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
Moderated discussions, verified guests and inline replies — styled by your site.
|
|
8
8
|
|
|
9
|
-
**Current release: [1.
|
|
9
|
+
**Current release: [1.3.1](https://github.com/hardcodd/Commentail/releases/tag/v1.3.1)** · [PyPI](https://pypi.org/project/commentail/1.3.1/)
|
|
10
|
+
|
|
11
|
+
[1.3.1 is a security update](docs/releases/1.3.1.md). Upgrading requires an
|
|
12
|
+
irreversible fingerprint data migration; review the backup, downtime and
|
|
13
|
+
form-quota guidance before upgrading.
|
|
10
14
|
|
|
11
15
|
[](https://github.com/hardcodd/Commentail/actions/workflows/tests.yml)
|
|
12
16
|
[](https://djangopackages.org/packages/p/commentail/)
|
|
@@ -119,6 +123,13 @@ Registered users can comment without an email address, but receive no mail. Your
|
|
|
119
123
|
site provides login and registration. No required external CDN or CAPTCHA service.
|
|
120
124
|
See [email setup](docs/wiki/Email-and-worker.md).
|
|
121
125
|
|
|
126
|
+
Guest spam protection includes invisible form checks, attempt limits and review
|
|
127
|
+
signals for repeated long text and multiple links, including guest edits. Google
|
|
128
|
+
reCAPTCHA v2 and Yandex SmartCaptcha are optional adapters; external widgets
|
|
129
|
+
require JavaScript, with no alternative path when a check is required.
|
|
130
|
+
See [setup and custom providers](docs/wiki/Callbacks.md#ready-to-use-providers)
|
|
131
|
+
and [guest protection](docs/wiki/Security-and-privacy.md#low-friction-guest-checks).
|
|
132
|
+
|
|
122
133
|
### Languages
|
|
123
134
|
|
|
124
135
|
English (`en`), Russian (`ru`), German (`de`), French (`fr`), Spanish (`es`)
|
|
@@ -136,11 +147,11 @@ The guides are in English; this README is also [available in Russian](README.ru.
|
|
|
136
147
|
In your existing Wagtail site's virtual environment, install the published release:
|
|
137
148
|
|
|
138
149
|
```sh
|
|
139
|
-
python -m pip install commentail==1.
|
|
150
|
+
python -m pip install commentail==1.3.1
|
|
140
151
|
```
|
|
141
152
|
|
|
142
153
|
For the optional PostgreSQL driver, use
|
|
143
|
-
`python -m pip install 'commentail[postgres]==1.
|
|
154
|
+
`python -m pip install 'commentail[postgres]==1.3.1'`.
|
|
144
155
|
For an existing installation, follow
|
|
145
156
|
the [upgrade guide](docs/wiki/Installation.md#upgrading-and-restoring) for your target version.
|
|
146
157
|
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
Модерация обсуждений, подтверждённые гости и ответы рядом с комментарием — в стиле вашего сайта.
|
|
8
8
|
|
|
9
|
-
**Текущая версия: [1.
|
|
9
|
+
**Текущая версия: [1.3.1](https://github.com/hardcodd/Commentail/releases/tag/v1.3.1)** · [PyPI](https://pypi.org/project/commentail/1.3.1/)
|
|
10
|
+
|
|
11
|
+
[1.3.1 — обновление безопасности](docs/releases/1.3.1.md). Обновление требует
|
|
12
|
+
необратимой миграции отпечатков; заранее проверьте рекомендации о резервной
|
|
13
|
+
копии, остановке записи и лимитах выдачи форм.
|
|
10
14
|
|
|
11
15
|
[](https://github.com/hardcodd/Commentail/actions/workflows/tests.yml)
|
|
12
16
|
[](https://djangopackages.org/packages/p/commentail/)
|
|
@@ -120,6 +124,13 @@ CI определяет все пять пар фреймворков на Pytho
|
|
|
120
124
|
получают писем. Вход и регистрацию предоставляет ваш сайт. Обязательных внешних
|
|
121
125
|
CDN и CAPTCHA-сервисов нет. См. [настройку писем](docs/wiki/Email-and-worker.md).
|
|
122
126
|
|
|
127
|
+
Защита гостей включает скрытые проверки формы, лимиты попыток и сигналы модерации
|
|
128
|
+
для повторяющегося длинного текста и множества ссылок, включая гостевые правки. Google reCAPTCHA v2
|
|
129
|
+
и Яндекс SmartCaptcha подключаются по желанию; внешним виджетам нужен JavaScript,
|
|
130
|
+
запасного сценария без него нет.
|
|
131
|
+
См. [подключение и другие провайдеры](docs/wiki/Callbacks.md#ready-to-use-providers)
|
|
132
|
+
и [защиту гостей](docs/wiki/Security-and-privacy.md#low-friction-guest-checks).
|
|
133
|
+
|
|
123
134
|
### Языки
|
|
124
135
|
|
|
125
136
|
Английский (`en`), русский (`ru`), немецкий (`de`), французский (`fr`),
|
|
@@ -137,11 +148,11 @@ CDN и CAPTCHA-сервисов нет. См. [настройку писем](do
|
|
|
137
148
|
В виртуальном окружении существующего сайта Wagtail установите опубликованный выпуск:
|
|
138
149
|
|
|
139
150
|
```sh
|
|
140
|
-
python -m pip install commentail==1.
|
|
151
|
+
python -m pip install commentail==1.3.1
|
|
141
152
|
```
|
|
142
153
|
|
|
143
154
|
Для необязательного драйвера PostgreSQL используйте
|
|
144
|
-
`python -m pip install 'commentail[postgres]==1.
|
|
155
|
+
`python -m pip install 'commentail[postgres]==1.3.1'`.
|
|
145
156
|
Для существующей установки следуйте [инструкции обновления](docs/wiki/Installation.md#upgrading-and-restoring)
|
|
146
157
|
до нужной версии.
|
|
147
158
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Read-only moderation queries; Site visibility is applied before filters."""
|
|
2
|
+
|
|
3
|
+
from django.contrib.auth import get_user_model
|
|
4
|
+
from django.db.models import Exists, OuterRef, Q, QuerySet
|
|
5
|
+
from django.http import HttpRequest
|
|
6
|
+
from django.utils.dateparse import parse_date
|
|
7
|
+
|
|
8
|
+
from .models import Comment, CommentRevision
|
|
9
|
+
from .permissions import sites_for
|
|
10
|
+
from .validation import valid_identifier
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _comments(request: HttpRequest) -> QuerySet[Comment]:
|
|
14
|
+
"""Restrict every moderation read to Sites the actor may view."""
|
|
15
|
+
return Comment.objects.filter(
|
|
16
|
+
discussion__site__in=sites_for(request.user, "view")
|
|
17
|
+
).select_related(
|
|
18
|
+
"discussion__site", "discussion__page", "discussion__content_type", "user"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def filtered_comments(request: HttpRequest) -> QuerySet[Comment]:
|
|
23
|
+
"""Apply author/text, target and date filters before status tab aggregation.
|
|
24
|
+
|
|
25
|
+
Invalid identifiers/dates return no rows rather than ignoring a filter.
|
|
26
|
+
Account name fields are discovered from the host's configured user model.
|
|
27
|
+
"""
|
|
28
|
+
query = _comments(request).annotate(
|
|
29
|
+
pending_revision=Exists(
|
|
30
|
+
CommentRevision.objects.filter(comment_id=OuterRef("pk"), status="pending")
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
if value := request.GET.get("site"):
|
|
34
|
+
query = (
|
|
35
|
+
query.filter(discussion__site_id=value)
|
|
36
|
+
if valid_identifier(value)
|
|
37
|
+
else query.none()
|
|
38
|
+
)
|
|
39
|
+
if value := request.GET.get("page"):
|
|
40
|
+
query = (
|
|
41
|
+
query.filter(discussion__page_id=value)
|
|
42
|
+
if valid_identifier(value)
|
|
43
|
+
else query.none()
|
|
44
|
+
)
|
|
45
|
+
if value := request.GET.get("q"):
|
|
46
|
+
names = Q()
|
|
47
|
+
for field in (get_user_model().USERNAME_FIELD, "first_name", "last_name"):
|
|
48
|
+
if field in {item.name for item in get_user_model()._meta.fields}:
|
|
49
|
+
names |= Q(**{f"user__{field}__icontains": value})
|
|
50
|
+
query = query.filter(
|
|
51
|
+
names
|
|
52
|
+
| Q(text__icontains=value)
|
|
53
|
+
| Q(guest_name__icontains=value)
|
|
54
|
+
| Q(email__icontains=value)
|
|
55
|
+
| Q(user__email__icontains=value)
|
|
56
|
+
)
|
|
57
|
+
for key, lookup in [
|
|
58
|
+
("from", "created_at__date__gte"),
|
|
59
|
+
("to", "created_at__date__lte"),
|
|
60
|
+
]:
|
|
61
|
+
if value := request.GET.get(key):
|
|
62
|
+
try:
|
|
63
|
+
day = parse_date(value)
|
|
64
|
+
except ValueError:
|
|
65
|
+
day = None
|
|
66
|
+
query = query.filter(**{lookup: day}) if day else query.none()
|
|
67
|
+
return query
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"""Permission-scoped editorial settings, rule interchange and object listings."""
|
|
2
|
+
|
|
3
|
+
from django.core.exceptions import PermissionDenied, ValidationError
|
|
4
|
+
from django.core.paginator import Paginator
|
|
5
|
+
from django.db.models import Q
|
|
6
|
+
from django.http import (
|
|
7
|
+
HttpRequest,
|
|
8
|
+
HttpResponse,
|
|
9
|
+
StreamingHttpResponse,
|
|
10
|
+
)
|
|
11
|
+
from django.shortcuts import get_object_or_404, redirect
|
|
12
|
+
from django.template.response import TemplateResponse
|
|
13
|
+
from django.utils.translation import gettext as _
|
|
14
|
+
from wagtail.admin import messages
|
|
15
|
+
from wagtail.models import Site
|
|
16
|
+
|
|
17
|
+
from .forms import (
|
|
18
|
+
DiscussionSettingsForm,
|
|
19
|
+
RuleCsvImportForm,
|
|
20
|
+
RuleForm,
|
|
21
|
+
SitePermissionForm,
|
|
22
|
+
SiteSettingsForm,
|
|
23
|
+
)
|
|
24
|
+
from .models import (
|
|
25
|
+
Discussion,
|
|
26
|
+
ModerationRule,
|
|
27
|
+
SiteCommentSettings,
|
|
28
|
+
)
|
|
29
|
+
from .permissions import can, sites_for
|
|
30
|
+
from .rules_csv import export_rules, import_rules
|
|
31
|
+
from .validation import valid_identifier
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def settings_view(
|
|
35
|
+
request: HttpRequest, site_id: int, page_id: int | None = None
|
|
36
|
+
) -> HttpResponse:
|
|
37
|
+
"""Edit Site defaults or a writable Page discussion with a settings grant."""
|
|
38
|
+
if not can(request.user, site_id, "settings"):
|
|
39
|
+
return HttpResponse("Permission denied", status=403)
|
|
40
|
+
site = get_object_or_404(Site, pk=site_id)
|
|
41
|
+
if page_id is None:
|
|
42
|
+
instance = SiteCommentSettings.objects.filter(
|
|
43
|
+
site=site
|
|
44
|
+
).first() or SiteCommentSettings(site=site)
|
|
45
|
+
form_class = SiteSettingsForm
|
|
46
|
+
else:
|
|
47
|
+
from wagtail.models import Page
|
|
48
|
+
|
|
49
|
+
page = get_object_or_404(Page, pk=page_id).specific
|
|
50
|
+
if not page.permissions_for_user(request.user).can_edit():
|
|
51
|
+
raise PermissionDenied
|
|
52
|
+
from .detection import has_comments
|
|
53
|
+
|
|
54
|
+
if not has_comments(page, request):
|
|
55
|
+
raise PermissionDenied
|
|
56
|
+
instance = Discussion.objects.filter(
|
|
57
|
+
site=site, page=page
|
|
58
|
+
).first() or Discussion(site=site, page=page)
|
|
59
|
+
form_class = DiscussionSettingsForm
|
|
60
|
+
form = form_class(
|
|
61
|
+
request.POST if request.method == "POST" else None, instance=instance
|
|
62
|
+
)
|
|
63
|
+
if request.method == "POST" and form.is_valid():
|
|
64
|
+
form.save()
|
|
65
|
+
return redirect(request.path)
|
|
66
|
+
return TemplateResponse(
|
|
67
|
+
request,
|
|
68
|
+
"commentail/admin/form.html",
|
|
69
|
+
{
|
|
70
|
+
"form": form,
|
|
71
|
+
"title": _("Discussion settings") if page_id else _("Site settings"),
|
|
72
|
+
"site": site,
|
|
73
|
+
},
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def rules(request: HttpRequest) -> HttpResponse:
|
|
78
|
+
"""List project-wide rules with bounded results and persistent filters."""
|
|
79
|
+
if not sites_for(request.user, "rules").exists():
|
|
80
|
+
raise PermissionDenied
|
|
81
|
+
if identifier := request.GET.get("id"):
|
|
82
|
+
if not valid_identifier(identifier):
|
|
83
|
+
return HttpResponse("Invalid rule identifier", status=400)
|
|
84
|
+
rule = get_object_or_404(ModerationRule, pk=identifier)
|
|
85
|
+
return redirect("commentail_admin:rule_edit", identifier=rule.pk)
|
|
86
|
+
query = ModerationRule.objects.all()
|
|
87
|
+
search = request.GET.get("q", "").strip()
|
|
88
|
+
action = request.GET.get("action", "")
|
|
89
|
+
enabled = request.GET.get("enabled", "")
|
|
90
|
+
if search:
|
|
91
|
+
query = query.filter(phrase__icontains=search)
|
|
92
|
+
if action in ModerationRule.Action.values:
|
|
93
|
+
query = query.filter(action=action)
|
|
94
|
+
if enabled in ("0", "1"):
|
|
95
|
+
query = query.filter(enabled=enabled == "1")
|
|
96
|
+
page = Paginator(query.order_by("phrase", "pk"), 25).get_page(request.GET.get("p"))
|
|
97
|
+
previous = request.GET.copy()
|
|
98
|
+
previous["p"] = str(max(1, page.number - 1))
|
|
99
|
+
following = request.GET.copy()
|
|
100
|
+
following["p"] = str(page.number + 1)
|
|
101
|
+
return TemplateResponse(
|
|
102
|
+
request,
|
|
103
|
+
"commentail/admin/rules.html",
|
|
104
|
+
{
|
|
105
|
+
"rules": page,
|
|
106
|
+
"actions": ModerationRule.Action.choices,
|
|
107
|
+
"search": search,
|
|
108
|
+
"active_action": action,
|
|
109
|
+
"active_enabled": enabled,
|
|
110
|
+
"previous_query": previous.urlencode(),
|
|
111
|
+
"next_query": following.urlencode(),
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def rule_edit(request: HttpRequest, identifier: int | None = None) -> HttpResponse:
|
|
117
|
+
"""Create or update a project-wide rule only with a rules-management grant."""
|
|
118
|
+
if not sites_for(request.user, "rules").exists():
|
|
119
|
+
raise PermissionDenied
|
|
120
|
+
instance = get_object_or_404(ModerationRule, pk=identifier) if identifier else None
|
|
121
|
+
form = RuleForm(
|
|
122
|
+
request.POST if request.method == "POST" else None, instance=instance
|
|
123
|
+
)
|
|
124
|
+
if request.method == "POST" and form.is_valid():
|
|
125
|
+
form.save()
|
|
126
|
+
return redirect("commentail_admin:rules")
|
|
127
|
+
return TemplateResponse(
|
|
128
|
+
request,
|
|
129
|
+
"commentail/admin/form.html",
|
|
130
|
+
{
|
|
131
|
+
"form": form,
|
|
132
|
+
"title": _("Edit rule") if instance else _("Add rule"),
|
|
133
|
+
"back_url": "commentail_admin:rules",
|
|
134
|
+
"back_label": _("Moderation rules"),
|
|
135
|
+
},
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def access(request: HttpRequest) -> HttpResponse:
|
|
140
|
+
"""Edit Site/group grants for superusers; invalid identifiers never reach ORM."""
|
|
141
|
+
if not request.user.is_superuser:
|
|
142
|
+
raise PermissionDenied
|
|
143
|
+
from .models import SiteGroupPermission
|
|
144
|
+
|
|
145
|
+
if request.GET.get("id") and not valid_identifier(request.GET["id"]):
|
|
146
|
+
return HttpResponse("Invalid permission identifier", status=400)
|
|
147
|
+
|
|
148
|
+
instance = (
|
|
149
|
+
get_object_or_404(SiteGroupPermission, pk=request.GET["id"])
|
|
150
|
+
if request.GET.get("id")
|
|
151
|
+
else None
|
|
152
|
+
)
|
|
153
|
+
form = SitePermissionForm(
|
|
154
|
+
request.POST if request.method == "POST" else None, instance=instance
|
|
155
|
+
)
|
|
156
|
+
if request.method == "POST" and form.is_valid():
|
|
157
|
+
form.save()
|
|
158
|
+
return redirect("commentail_admin:access")
|
|
159
|
+
return TemplateResponse(
|
|
160
|
+
request,
|
|
161
|
+
"commentail/admin/form.html",
|
|
162
|
+
{
|
|
163
|
+
"form": form,
|
|
164
|
+
"title": _("Group access by site"),
|
|
165
|
+
"permissions": SiteGroupPermission.objects.select_related("group", "site"),
|
|
166
|
+
},
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def rules_export(request: HttpRequest) -> StreamingHttpResponse:
|
|
171
|
+
if not sites_for(request.user, "rules").exists():
|
|
172
|
+
raise PermissionDenied
|
|
173
|
+
return StreamingHttpResponse(
|
|
174
|
+
export_rules(),
|
|
175
|
+
content_type="text/csv; charset=utf-8",
|
|
176
|
+
headers={"Content-Disposition": 'attachment; filename="commentail-rules.csv"'},
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def rules_import(request: HttpRequest) -> HttpResponse:
|
|
181
|
+
"""Validate the bounded upload before atomically merging rules by phrase."""
|
|
182
|
+
if not sites_for(request.user, "rules").exists():
|
|
183
|
+
raise PermissionDenied
|
|
184
|
+
form = RuleCsvImportForm(
|
|
185
|
+
request.POST if request.method == "POST" else None,
|
|
186
|
+
request.FILES if request.method == "POST" else None,
|
|
187
|
+
)
|
|
188
|
+
if request.method == "POST" and form.is_valid():
|
|
189
|
+
try:
|
|
190
|
+
result = import_rules(form.cleaned_data["file"])
|
|
191
|
+
except ValidationError as error:
|
|
192
|
+
form.add_error("file", error)
|
|
193
|
+
else:
|
|
194
|
+
messages.success(
|
|
195
|
+
request,
|
|
196
|
+
_(
|
|
197
|
+
"CSV imported: %(added)s added, %(updated)s updated, %(unchanged)s unchanged."
|
|
198
|
+
)
|
|
199
|
+
% {
|
|
200
|
+
"added": result.added,
|
|
201
|
+
"updated": result.updated,
|
|
202
|
+
"unchanged": result.unchanged,
|
|
203
|
+
},
|
|
204
|
+
)
|
|
205
|
+
return redirect("commentail_admin:rules")
|
|
206
|
+
return TemplateResponse(
|
|
207
|
+
request, "commentail/admin/rules_import.html", {"form": form}
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def objects_list(request: HttpRequest) -> HttpResponse:
|
|
212
|
+
"""Existing non-Page discussions; Site settings grants bound every row."""
|
|
213
|
+
sites = sites_for(request.user, "settings")
|
|
214
|
+
if not sites.exists():
|
|
215
|
+
raise PermissionDenied
|
|
216
|
+
query = Discussion.objects.filter(site__in=sites, page__isnull=True).select_related(
|
|
217
|
+
"site", "content_type"
|
|
218
|
+
)
|
|
219
|
+
if value := request.GET.get("q", "").strip():
|
|
220
|
+
query = query.filter(
|
|
221
|
+
Q(object_id__icontains=value) | Q(content_type__model__icontains=value)
|
|
222
|
+
)
|
|
223
|
+
if value := request.GET.get("site", ""):
|
|
224
|
+
query = query.filter(site_id=value) if valid_identifier(value) else query.none()
|
|
225
|
+
page = Paginator(
|
|
226
|
+
query.order_by("site_id", "content_type_id", "object_id", "pk"), 25
|
|
227
|
+
).get_page(request.GET.get("p"))
|
|
228
|
+
previous = request.GET.copy()
|
|
229
|
+
previous["p"] = str(max(1, page.number - 1))
|
|
230
|
+
following = request.GET.copy()
|
|
231
|
+
following["p"] = str(page.number + 1)
|
|
232
|
+
return TemplateResponse(
|
|
233
|
+
request,
|
|
234
|
+
"commentail/admin/objects.html",
|
|
235
|
+
{
|
|
236
|
+
"discussions": page,
|
|
237
|
+
"sites": sites,
|
|
238
|
+
"previous_query": previous.urlencode(),
|
|
239
|
+
"next_query": following.urlencode(),
|
|
240
|
+
},
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def object_settings(request: HttpRequest, identifier: int) -> HttpResponse:
|
|
245
|
+
"""Edit stored object settings under the administrative Site grant.
|
|
246
|
+
|
|
247
|
+
Adapter failures return a neutral 503 and preserve settings; visitor access
|
|
248
|
+
is deliberately independent from this administrative authorization."""
|
|
249
|
+
discussion = get_object_or_404(
|
|
250
|
+
Discussion.objects.select_related("site", "content_type"),
|
|
251
|
+
pk=identifier,
|
|
252
|
+
page__isnull=True,
|
|
253
|
+
)
|
|
254
|
+
if not can(request.user, discussion.site_id, "settings"):
|
|
255
|
+
return HttpResponse(_("Permission denied"), status=403)
|
|
256
|
+
# Administrative Site grant controls settings, independently of visitor access.
|
|
257
|
+
# Unavailable adapters must preserve stored settings and show a neutral error.
|
|
258
|
+
from .objects import ObjectAccessError, target_for
|
|
259
|
+
|
|
260
|
+
try:
|
|
261
|
+
target = target_for(discussion)
|
|
262
|
+
except ObjectAccessError:
|
|
263
|
+
return HttpResponse(_("Comments are unavailable."), status=503)
|
|
264
|
+
form = DiscussionSettingsForm(
|
|
265
|
+
request.POST if request.method == "POST" else None, instance=discussion
|
|
266
|
+
)
|
|
267
|
+
if request.method == "POST" and form.is_valid():
|
|
268
|
+
form.save()
|
|
269
|
+
return redirect(request.path)
|
|
270
|
+
return TemplateResponse(
|
|
271
|
+
request,
|
|
272
|
+
"commentail/admin/form.html",
|
|
273
|
+
{
|
|
274
|
+
"form": form,
|
|
275
|
+
"title": _("Discussion settings"),
|
|
276
|
+
"site": discussion.site,
|
|
277
|
+
"target_label": str(target),
|
|
278
|
+
"objects_back": True,
|
|
279
|
+
},
|
|
280
|
+
)
|