From 3c9a42c38be3490b59b113f61687a2787401a207 Mon Sep 17 00:00:00 2001 From: stevekaplan123 Date: Sun, 7 Jan 2024 11:37:40 +0200 Subject: [PATCH 1/3] fix(Source Editor): Prompts should be textareas not input elements --- static/js/AdminEditor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/AdminEditor.jsx b/static/js/AdminEditor.jsx index 1d1ecea94a..d761f200b8 100644 --- a/static/js/AdminEditor.jsx +++ b/static/js/AdminEditor.jsx @@ -21,7 +21,7 @@ const options_for_form = { placeholder: "Add a description.", type: 'textarea' }, - "Prompt": {label: "Prompt", field: "prompt", placeholder: "Add a prompt.", textarea: true}, + "Prompt": {label: "Prompt", field: "prompt", placeholder: "Add a prompt.", type: 'textarea'}, "English Short Description": { label: "English Short Description for Table of Contents", field: "enCategoryDescription", placeholder: "Add a short description.", type: 'input' From d3e31c5045cd3316097fa6d1eb21c2a519326ec2 Mon Sep 17 00:00:00 2001 From: stevekaplan123 Date: Sun, 7 Jan 2024 12:28:37 +0200 Subject: [PATCH 2/3] fix(Markdown): markdown in admin editors was not being validated --- static/js/AdminEditor.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/static/js/AdminEditor.jsx b/static/js/AdminEditor.jsx index 1d1ecea94a..d324d6b687 100644 --- a/static/js/AdminEditor.jsx +++ b/static/js/AdminEditor.jsx @@ -13,13 +13,15 @@ const options_for_form = { label: "English Description", field: "enDescription", placeholder: "Add a description.", - type: 'textarea' + type: 'textarea', + markdown: true, }, "Hebrew Description": { label: "Hebrew Description", field: "heDescription", placeholder: "Add a description.", - type: 'textarea' + type: 'textarea', + markdown: true }, "Prompt": {label: "Prompt", field: "prompt", placeholder: "Add a prompt.", textarea: true}, "English Short Description": { @@ -136,7 +138,7 @@ const AdminEditor = ({title, data, close, catMenu, pictureUploader, updateData, const preprocess = async () => { setValidatingLinks(true); for (const x of items) { - if (options_for_form[x]?.is_textarea) { + if (options_for_form[x]?.markdown) { const field = options_for_form[x].field; const valid_tags = await validateMarkdownLinks(data[field]); if (!valid_tags) { From e4e2748f0209a5b38dda4984850a8dde05eb135d Mon Sep 17 00:00:00 2001 From: Lev Israel Date: Thu, 18 Jan 2024 17:31:04 +0200 Subject: [PATCH 3/3] fix: Fix recursion call in `TreeNode.traverse_tree`. Add some docs to `Topic.merge` --- sefaria/model/schema.py | 2 +- sefaria/model/topic.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sefaria/model/schema.py b/sefaria/model/schema.py index 82e89fe656..0efb7bbbe2 100644 --- a/sefaria/model/schema.py +++ b/sefaria/model/schema.py @@ -588,7 +588,7 @@ def traverse_tree(self, callback, **kwargs): """ callback(self, **kwargs) for child in self.children: - child.traverse_to_string(callback, **kwargs) + child.traverse_tree(callback, **kwargs) def traverse_to_string(self, callback, depth=0, **kwargs): st = callback(self, depth, **kwargs) diff --git a/sefaria/model/topic.py b/sefaria/model/topic.py index 2304a7a5b4..a916c78c16 100644 --- a/sefaria/model/topic.py +++ b/sefaria/model/topic.py @@ -276,6 +276,9 @@ def set_slug(self, new_slug) -> None: def merge(self, other: Union['Topic', str]) -> None: """ + Merge `other` into `self`. This means that all data from `other` will be merged into self. + Data from self takes precedence in the event of conflict. + Links to `other` will be changed to point to `self` and `other` will be deleted. :param other: Topic or old slug to migrate from :return: None """