commentail 1.2.0__tar.gz → 1.3.0__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.0}/CHANGELOG.md +30 -0
- {commentail-1.2.0/commentail.egg-info → commentail-1.3.0}/PKG-INFO +11 -4
- {commentail-1.2.0 → commentail-1.3.0}/README.md +10 -3
- {commentail-1.2.0 → commentail-1.3.0}/README.ru.md +10 -3
- commentail-1.3.0/commentail/admin_queries.py +67 -0
- commentail-1.3.0/commentail/admin_settings.py +280 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/admin_views.py +172 -352
- commentail-1.3.0/commentail/admission.py +255 -0
- commentail-1.3.0/commentail/antispam.py +102 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/apps.py +3 -2
- {commentail-1.2.0 → commentail-1.3.0}/commentail/assets.py +1 -0
- commentail-1.3.0/commentail/author_access.py +34 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/avatars.py +5 -1
- {commentail-1.2.0 → commentail-1.3.0}/commentail/background.py +4 -1
- commentail-1.3.0/commentail/captcha_providers.py +129 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/config.py +74 -2
- commentail-1.3.0/commentail/content_checks.py +79 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/detection.py +5 -1
- {commentail-1.2.0 → commentail-1.3.0}/commentail/drafts.py +28 -8
- {commentail-1.2.0 → commentail-1.3.0}/commentail/forms.py +4 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/limits.py +20 -0
- commentail-1.3.0/commentail/locale/de/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/locale/de/LC_MESSAGES/django.po +33 -0
- commentail-1.3.0/commentail/locale/es/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/locale/es/LC_MESSAGES/django.po +33 -0
- commentail-1.3.0/commentail/locale/fr/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/locale/fr/LC_MESSAGES/django.po +33 -0
- commentail-1.3.0/commentail/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/locale/pt_BR/LC_MESSAGES/django.po +33 -0
- commentail-1.3.0/commentail/locale/ru/LC_MESSAGES/django.mo +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/locale/ru/LC_MESSAGES/django.po +33 -0
- commentail-1.3.0/commentail/mail_access.py +110 -0
- commentail-1.3.0/commentail/migrations/0016_guest_antispam.py +30 -0
- commentail-1.3.0/commentail/migrations/0017_revision_spam_signals.py +19 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/models.py +34 -4
- {commentail-1.2.0 → commentail-1.3.0}/commentail/objects.py +22 -2
- {commentail-1.2.0 → commentail-1.3.0}/commentail/outbox.py +132 -175
- {commentail-1.2.0 → commentail-1.3.0}/commentail/page_integration.py +4 -1
- {commentail-1.2.0 → commentail-1.3.0}/commentail/permissions.py +1 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/policies.py +16 -6
- commentail-1.3.0/commentail/presentation.py +126 -0
- commentail-1.3.0/commentail/public.py +323 -0
- commentail-1.3.0/commentail/reading.py +66 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/recent.py +79 -39
- {commentail-1.2.0 → commentail-1.3.0}/commentail/security.py +74 -19
- {commentail-1.2.0 → commentail-1.3.0}/commentail/services.py +56 -11
- {commentail-1.2.0 → commentail-1.3.0}/commentail/signals.py +8 -3
- {commentail-1.2.0 → commentail-1.3.0}/commentail/static/commentail/commentail.js +165 -19
- {commentail-1.2.0 → commentail-1.3.0}/commentail/structured.py +2 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/detail.html +2 -2
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/block.html +1 -1
- commentail-1.3.0/commentail/templates/commentail/form.html +1 -0
- commentail-1.3.0/commentail/templates/commentail/provider-captcha.html +7 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templatetags/commentail_admin.py +8 -3
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templatetags/commentail_tags.py +10 -3
- {commentail-1.2.0 → commentail-1.3.0}/commentail/validation.py +6 -1
- {commentail-1.2.0 → commentail-1.3.0}/commentail/views.py +11 -0
- commentail-1.3.0/commentail/widget.py +436 -0
- {commentail-1.2.0 → commentail-1.3.0/commentail.egg-info}/PKG-INFO +11 -4
- {commentail-1.2.0 → commentail-1.3.0}/commentail.egg-info/SOURCES.txt +20 -0
- commentail-1.3.0/docs/releases/1.3.0.md +78 -0
- commentail-1.3.0/docs/wiki/Callbacks.md +152 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Changelog.md +30 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Configuration.md +11 -2
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Example-and-testing.md +37 -7
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Guest-comments.md +14 -4
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Home.md +7 -5
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Installation.md +6 -5
- commentail-1.3.0/docs/wiki/Release-1.3.0.md +78 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Roadmap.md +22 -0
- commentail-1.3.0/docs/wiki/Security-and-privacy.md +132 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Styling.md +1 -1
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Template-contract.md +6 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Templates.md +5 -1
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/_Sidebar.md +1 -0
- {commentail-1.2.0 → commentail-1.3.0}/pyproject.toml +1 -1
- {commentail-1.2.0 → commentail-1.3.0}/tests/settings.py +5 -1
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_actions.py +17 -7
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_admin_ui.py +480 -186
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_admission.py +6 -2
- commentail-1.3.0/tests/test_antispam.py +490 -0
- commentail-1.3.0/tests/test_captcha_backend.py +304 -0
- commentail-1.3.0/tests/test_captcha_providers.py +112 -0
- commentail-1.3.0/tests/test_cleanup.py +64 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_concurrency.py +27 -1
- commentail-1.3.0/tests/test_content_checks.py +280 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_email_backends.py +76 -26
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_email_presentation.py +40 -13
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_inline_edit.py +64 -17
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_input_boundaries.py +21 -9
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_lifecycle.py +12 -4
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_localization.py +155 -49
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_mail_admin.py +12 -5
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_notifications.py +40 -13
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_object_adapters.py +14 -7
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_outbox.py +49 -14
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_performance.py +77 -35
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_presentation_contracts.py +3 -1
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_progressive.js +40 -6
- commentail-1.3.0/tests/test_provider_widgets.js +121 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_public_ui.py +119 -43
- commentail-1.3.0/tests/test_reading_contracts.py +172 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_recent_comments.py +105 -39
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_release_gaps.py +14 -1
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_rules_csv.py +3 -3
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_security.py +3 -1
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_smtp_chain.py +14 -7
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_staff_authors.py +74 -26
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_transaction_contracts.py +20 -10
- commentail-1.3.0/tools/benchmark_performance.py +558 -0
- {commentail-1.2.0 → commentail-1.3.0}/tools/check_dist.py +49 -11
- {commentail-1.2.0 → commentail-1.3.0}/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_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.0}/LICENSE +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/MANIFEST.in +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/admin_urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/checks.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/group_permissions.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/logging.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/management/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/management/commands/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/management/commands/process_commentail.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/middleware.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0001_initial.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0002_sitegrouppermission_hide_sitegrouppermission_view.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0003_actiontoken_captchachallenge_guestgrant.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0004_submissionrecord.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0005_rateevent.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0006_alter_comment_guest_name_and_more.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0007_actiontoken_nonce_replysubscription_mailjob.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0008_mailjob_revision.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0009_formticket.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0010_captchachallenge_backend_and_more.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0011_discussion_content_type_discussion_object_id_and_more.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0012_formticket_draft.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0013_sitecommentsettings_email_enabled.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0014_reading_indexes.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/0015_sitecommentsettings_highlight_staff.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/migrations/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/panels.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/rules_csv.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/static/commentail/admin.css +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/static/commentail/admin.js +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/static/commentail/commentail.css +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/action.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/action_error.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/base.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/confirm_delete.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/field.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/form.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/group_permission_row.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/group_permissions.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/heading.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/list.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/mail.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/management.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/objects.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/page_panel.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/rules.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/rules_import.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/admin/selection.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/author.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/avatar.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/base.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/captcha.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/comment.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/edit-form.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/base.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/button.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/confirm.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/confirm.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/confirm_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/edit.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/edit.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/edit_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/published.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/published.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/published_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/rejected.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/rejected.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/rejected_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/reply.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/reply.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/emails/reply_subject.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templates/commentail/replies.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/templatetags/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/text.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail/wagtail_hooks.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail.egg-info/dependency_links.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail.egg-info/requires.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/commentail.egg-info/top_level.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/assets/commentail-preview.png +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/assets/support-qr.png +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/releases/0.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/releases/0.1.1.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/releases/0.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/releases/1.0.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/releases/1.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/releases/1.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Deployment.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Email-and-worker.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Moderation.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Object-adapters.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Performance.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Recent-comments.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Release-0.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Release-0.1.1.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Release-0.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Release-1.0.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Release-1.1.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Release-1.2.0.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Replies-and-editing.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Rules-and-CSV.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Stability.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Structured-data.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Support.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/Troubleshooting.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/docs/wiki/_Footer.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/README.md +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo/settings.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo/urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/comments.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/management/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/management/commands/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/management/commands/bootstrap_demo.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/migrations/0001_initial.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/migrations/0002_product.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/migrations/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/models.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/templates/demo_home/home_page.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/templates/demo_home/product.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/demo_home/views.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/example/manage.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/requirements-test-common.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/requirements-test.txt +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/setup.cfg +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/targets/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/targets/apps.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/targets/migrations/0001_initial.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/targets/migrations/__init__.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/targets/models.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/templates/wagtailcore/page.html +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_admin.js +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_avatars.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_background.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_capability_access.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_detection.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_extension_contracts.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_group_panel.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_name_limit.js +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_rate_limits.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_reply.js +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_rules_admin.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_structured_data.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/test_submission.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/urls.py +0 -0
- {commentail-1.2.0 → commentail-1.3.0}/tests/urls_custom_prefix.py +0 -0
|
@@ -3,6 +3,35 @@
|
|
|
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.0] — 2026-10-22 · Stable
|
|
7
|
+
|
|
8
|
+
- Keep bundled external CAPTCHA bindings valid for the form lifetime, allowing
|
|
9
|
+
long writing before a fresh provider proof without an extra challenge.
|
|
10
|
+
- Hide routine refresh for external CAPTCHA widgets; offer Retry check after errors,
|
|
11
|
+
while retaining arithmetic-task refresh and editable drafts.
|
|
12
|
+
|
|
13
|
+
- Review recent repeated long guest text and link bursts, including guest edits,
|
|
14
|
+
with per-Site thresholds and private moderation reasons. Use bounded keyed
|
|
15
|
+
fingerprints without scanning old bodies or contacting link destinations.
|
|
16
|
+
|
|
17
|
+
- Keep independent browser forms valid when another tab opens or refreshes a CAPTCHA.
|
|
18
|
+
Preserve server-owned form age across draft recovery/navigation, and avoid
|
|
19
|
+
submitting an incomplete external check.
|
|
20
|
+
- Retain rate-limit events for configured intervals longer than one hour, including
|
|
21
|
+
per-Site overrides, so periodic cleanup cannot reset those limits early.
|
|
22
|
+
- Add opt-in Google reCAPTCHA v2 checkbox and Yandex SmartCaptcha adapters while
|
|
23
|
+
retaining arithmetic/no-JavaScript defaults and custom CAPTCHA backends.
|
|
24
|
+
- Add hidden-field and form-age moderation signals, independent guest attempt
|
|
25
|
+
budgets, adaptive/strict CAPTCHA policy and private moderator explanations.
|
|
26
|
+
- Keep drafts editable when CAPTCHA issuance fails. Bound external verification,
|
|
27
|
+
reject invalid host claims and prevent concurrent challenge use without holding
|
|
28
|
+
the Site quota lock during network requests.
|
|
29
|
+
- Upgrade: run migrations `0016` and `0017`, refresh static assets and review custom form and
|
|
30
|
+
CAPTCHA templates. External providers require matching site-owned keys and
|
|
31
|
+
JavaScript; no service is enabled automatically. Missing/blank browser headers
|
|
32
|
+
can now require CAPTCHA again for remembered guests. See the configuration and
|
|
33
|
+
security guides for thresholds and disabling the form timing signal.
|
|
34
|
+
|
|
6
35
|
## [1.2.0] — 2026-10-22 · Stable
|
|
7
36
|
|
|
8
37
|
- Verify Wagtail 8.0.1 in every Wagtail 8 CI stack while retaining the existing
|
|
@@ -198,4 +227,5 @@ See [0.1.0 release notes](docs/releases/0.1.0.md).
|
|
|
198
227
|
|
|
199
228
|
[1.1.0]: https://github.com/hardcodd/Commentail/compare/v1.0.0...v1.1.0
|
|
200
229
|
|
|
230
|
+
[1.3.0]: https://github.com/hardcodd/Commentail/compare/v1.2.0...v1.3.0
|
|
201
231
|
[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.0
|
|
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,7 @@ 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.0](https://github.com/hardcodd/Commentail/releases/tag/v1.3.0)** · [PyPI](https://pypi.org/project/commentail/1.3.0/)
|
|
38
38
|
|
|
39
39
|
[](https://github.com/hardcodd/Commentail/actions/workflows/tests.yml)
|
|
40
40
|
[](https://djangopackages.org/packages/p/commentail/)
|
|
@@ -147,6 +147,13 @@ Registered users can comment without an email address, but receive no mail. Your
|
|
|
147
147
|
site provides login and registration. No required external CDN or CAPTCHA service.
|
|
148
148
|
See [email setup](docs/wiki/Email-and-worker.md).
|
|
149
149
|
|
|
150
|
+
Guest spam protection includes invisible form checks, attempt limits and review
|
|
151
|
+
signals for repeated long text and multiple links, including guest edits. Google
|
|
152
|
+
reCAPTCHA v2 and Yandex SmartCaptcha are optional adapters; external widgets
|
|
153
|
+
require JavaScript, with no alternative path when a check is required.
|
|
154
|
+
See [setup and custom providers](docs/wiki/Callbacks.md#ready-to-use-providers)
|
|
155
|
+
and [guest protection](docs/wiki/Security-and-privacy.md#low-friction-guest-checks).
|
|
156
|
+
|
|
150
157
|
### Languages
|
|
151
158
|
|
|
152
159
|
English (`en`), Russian (`ru`), German (`de`), French (`fr`), Spanish (`es`)
|
|
@@ -164,11 +171,11 @@ The guides are in English; this README is also [available in Russian](README.ru.
|
|
|
164
171
|
In your existing Wagtail site's virtual environment, install the published release:
|
|
165
172
|
|
|
166
173
|
```sh
|
|
167
|
-
python -m pip install commentail==1.
|
|
174
|
+
python -m pip install commentail==1.3.0
|
|
168
175
|
```
|
|
169
176
|
|
|
170
177
|
For the optional PostgreSQL driver, use
|
|
171
|
-
`python -m pip install 'commentail[postgres]==1.
|
|
178
|
+
`python -m pip install 'commentail[postgres]==1.3.0'`.
|
|
172
179
|
For an existing installation, follow
|
|
173
180
|
the [upgrade guide](docs/wiki/Installation.md#upgrading-and-restoring) for your target version.
|
|
174
181
|
|
|
@@ -6,7 +6,7 @@
|
|
|
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.0](https://github.com/hardcodd/Commentail/releases/tag/v1.3.0)** · [PyPI](https://pypi.org/project/commentail/1.3.0/)
|
|
10
10
|
|
|
11
11
|
[](https://github.com/hardcodd/Commentail/actions/workflows/tests.yml)
|
|
12
12
|
[](https://djangopackages.org/packages/p/commentail/)
|
|
@@ -119,6 +119,13 @@ Registered users can comment without an email address, but receive no mail. Your
|
|
|
119
119
|
site provides login and registration. No required external CDN or CAPTCHA service.
|
|
120
120
|
See [email setup](docs/wiki/Email-and-worker.md).
|
|
121
121
|
|
|
122
|
+
Guest spam protection includes invisible form checks, attempt limits and review
|
|
123
|
+
signals for repeated long text and multiple links, including guest edits. Google
|
|
124
|
+
reCAPTCHA v2 and Yandex SmartCaptcha are optional adapters; external widgets
|
|
125
|
+
require JavaScript, with no alternative path when a check is required.
|
|
126
|
+
See [setup and custom providers](docs/wiki/Callbacks.md#ready-to-use-providers)
|
|
127
|
+
and [guest protection](docs/wiki/Security-and-privacy.md#low-friction-guest-checks).
|
|
128
|
+
|
|
122
129
|
### Languages
|
|
123
130
|
|
|
124
131
|
English (`en`), Russian (`ru`), German (`de`), French (`fr`), Spanish (`es`)
|
|
@@ -136,11 +143,11 @@ The guides are in English; this README is also [available in Russian](README.ru.
|
|
|
136
143
|
In your existing Wagtail site's virtual environment, install the published release:
|
|
137
144
|
|
|
138
145
|
```sh
|
|
139
|
-
python -m pip install commentail==1.
|
|
146
|
+
python -m pip install commentail==1.3.0
|
|
140
147
|
```
|
|
141
148
|
|
|
142
149
|
For the optional PostgreSQL driver, use
|
|
143
|
-
`python -m pip install 'commentail[postgres]==1.
|
|
150
|
+
`python -m pip install 'commentail[postgres]==1.3.0'`.
|
|
144
151
|
For an existing installation, follow
|
|
145
152
|
the [upgrade guide](docs/wiki/Installation.md#upgrading-and-restoring) for your target version.
|
|
146
153
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Модерация обсуждений, подтверждённые гости и ответы рядом с комментарием — в стиле вашего сайта.
|
|
8
8
|
|
|
9
|
-
**Текущая версия: [1.
|
|
9
|
+
**Текущая версия: [1.3.0](https://github.com/hardcodd/Commentail/releases/tag/v1.3.0)** · [PyPI](https://pypi.org/project/commentail/1.3.0/)
|
|
10
10
|
|
|
11
11
|
[](https://github.com/hardcodd/Commentail/actions/workflows/tests.yml)
|
|
12
12
|
[](https://djangopackages.org/packages/p/commentail/)
|
|
@@ -120,6 +120,13 @@ CI определяет все пять пар фреймворков на Pytho
|
|
|
120
120
|
получают писем. Вход и регистрацию предоставляет ваш сайт. Обязательных внешних
|
|
121
121
|
CDN и CAPTCHA-сервисов нет. См. [настройку писем](docs/wiki/Email-and-worker.md).
|
|
122
122
|
|
|
123
|
+
Защита гостей включает скрытые проверки формы, лимиты попыток и сигналы модерации
|
|
124
|
+
для повторяющегося длинного текста и множества ссылок, включая гостевые правки. Google reCAPTCHA v2
|
|
125
|
+
и Яндекс SmartCaptcha подключаются по желанию; внешним виджетам нужен JavaScript,
|
|
126
|
+
запасного сценария без него нет.
|
|
127
|
+
См. [подключение и другие провайдеры](docs/wiki/Callbacks.md#ready-to-use-providers)
|
|
128
|
+
и [защиту гостей](docs/wiki/Security-and-privacy.md#low-friction-guest-checks).
|
|
129
|
+
|
|
123
130
|
### Языки
|
|
124
131
|
|
|
125
132
|
Английский (`en`), русский (`ru`), немецкий (`de`), французский (`fr`),
|
|
@@ -137,11 +144,11 @@ CDN и CAPTCHA-сервисов нет. См. [настройку писем](do
|
|
|
137
144
|
В виртуальном окружении существующего сайта Wagtail установите опубликованный выпуск:
|
|
138
145
|
|
|
139
146
|
```sh
|
|
140
|
-
python -m pip install commentail==1.
|
|
147
|
+
python -m pip install commentail==1.3.0
|
|
141
148
|
```
|
|
142
149
|
|
|
143
150
|
Для необязательного драйвера PostgreSQL используйте
|
|
144
|
-
`python -m pip install 'commentail[postgres]==1.
|
|
151
|
+
`python -m pip install 'commentail[postgres]==1.3.0'`.
|
|
145
152
|
Для существующей установки следуйте [инструкции обновления](docs/wiki/Installation.md#upgrading-and-restoring)
|
|
146
153
|
до нужной версии.
|
|
147
154
|
|
|
@@ -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
|
+
)
|