From abbf0697c25bb11086851d29fb024171f9eb7b26 Mon Sep 17 00:00:00 2001 From: Christina Lin <44586776+chrstinalin@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:05:11 -0500 Subject: [PATCH 01/11] Support Markdown in Add-on Listing Fields --- requirements/prod.txt | 3 ++ src/olympia/addons/models.py | 12 ++++--- .../devhub/addons/edit/describe.html | 4 +-- .../devhub/addons/edit/technical.html | 4 +-- .../devhub/addons/submit/describe.html | 6 ++-- .../templates/devhub/includes/macros.html | 11 ++++++ .../devhub/includes/policy_form.html | 6 ++-- src/olympia/translations/fields.py | 4 +++ src/olympia/translations/models.py | 35 +++++++++++++++---- 9 files changed, 64 insertions(+), 21 deletions(-) diff --git a/requirements/prod.txt b/requirements/prod.txt index 844b006bd1f8..234c3a954e63 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -1208,3 +1208,6 @@ watchdog[watchmedo]==3.0.0 \ django-node-assets==0.9.14 \ --hash=sha256:80cbe3d10521808309712b2aa5ef6d69799bbcafef844cf7f223d3c93f405768 \ --hash=sha256:d5b5c472136084d533268f52ab77897327863a102e25c81f484aae85eb806987 +Markdown==3.7 \ + --hash=sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2 \ + --hash=sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803 diff --git a/src/olympia/addons/models.py b/src/olympia/addons/models.py index 8125e9ce7678..b9dc5fdb8672 100644 --- a/src/olympia/addons/models.py +++ b/src/olympia/addons/models.py @@ -65,7 +65,7 @@ from olympia.tags.models import Tag from olympia.translations.fields import ( NoURLsField, - PurifiedField, + PurifiedMarkdownField, TranslatedField, save_signal, ) @@ -501,12 +501,14 @@ class Addon(OnChangeMixin, ModelBase): homepage = TranslatedField(max_length=255) support_email = TranslatedField(db_column='supportemail', max_length=100) support_url = TranslatedField(db_column='supporturl', max_length=255) - description = PurifiedField(short=False, max_length=15000) + description = PurifiedMarkdownField(short=False, max_length=15000) summary = NoURLsField(max_length=250) - developer_comments = PurifiedField(db_column='developercomments', max_length=3000) - eula = PurifiedField(max_length=350000) - privacy_policy = PurifiedField(db_column='privacypolicy', max_length=150000) + developer_comments = PurifiedMarkdownField( + db_column='developercomments', max_length=3000 + ) + eula = PurifiedMarkdownField(max_length=350000) + privacy_policy = PurifiedMarkdownField(db_column='privacypolicy', max_length=150000) average_rating = models.FloatField( max_length=255, default=0, null=True, db_column='averagerating' diff --git a/src/olympia/devhub/templates/devhub/addons/edit/describe.html b/src/olympia/devhub/templates/devhub/addons/edit/describe.html index 284c4e3f3872..7a795d9b3f96 100644 --- a/src/olympia/devhub/templates/devhub/addons/edit/describe.html +++ b/src/olympia/devhub/templates/devhub/addons/edit/describe.html @@ -1,4 +1,4 @@ -{% from "devhub/includes/macros.html" import tip, empty_unless, flags, select_cats, some_html_tip, trans_readonly %} +{% from "devhub/includes/macros.html" import tip, empty_unless, flags, select_cats, markdown_tip, trans_readonly %}