Skip to content

Commit fc6c049

Browse files
committed
fix(notion): fix rich_text entry for notion
https://developers.notion.com/reference/block#to-do
1 parent 0cfe56d commit fc6c049

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

syncall/notion/notion_todo_block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ def plaintext(self, val):
112112
@classmethod
113113
def get_plaintext(cls, todo_section: NotionTodoSection):
114114
"""Get the plaintext from a todo section."""
115-
return "".join([li["plain_text"] for li in todo_section["text"]]) # type: ignore
115+
return "".join([li["plain_text"] for li in todo_section["rich_text"]]) # type: ignore
116116

117117
def serialize(self) -> dict:
118118
return {
119119
"object": "block",
120120
"type": "to_do",
121121
"to_do": {
122-
"text": [{"type": "text", "text": {"content": self.plaintext}}],
122+
"rich_text": [{"type": "text", "text": {"content": self.plaintext}}],
123123
"checked": self.is_checked,
124124
},
125125
}

tests/conftest_notion.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def notion_simple_todo() -> NotionTodoBlockItem:
2828
"archived": False,
2929
"type": "to_do",
3030
"to_do": {
31-
"text": [
31+
"rich_text": [
3232
{
3333
"type": "text",
3434
"text": {"content": "Lacinato kale", "link": None},
@@ -94,7 +94,7 @@ def notion_chained_todo() -> NotionTodoBlockItem:
9494
"archived": False,
9595
"type": "to_do",
9696
"to_do": {
97-
"text": [
97+
"rich_text": [
9898
{
9999
"type": "text",
100100
"text": {"content": "Bringing it ", "link": None},
@@ -204,7 +204,7 @@ def page_contents() -> NotionPageContents:
204204
"archived": False,
205205
"type": "paragraph",
206206
"paragraph": {
207-
"text": [
207+
"rich_text": [
208208
{
209209
"type": "text",
210210
"text": {"content": "👋 Welcome to Notion!", "link": None},
@@ -231,7 +231,7 @@ def page_contents() -> NotionPageContents:
231231
"archived": False,
232232
"type": "paragraph",
233233
"paragraph": {
234-
"text": [
234+
"rich_text": [
235235
{
236236
"type": "text",
237237
"text": {"content": "Here are the basics:", "link": None},
@@ -258,7 +258,7 @@ def page_contents() -> NotionPageContents:
258258
"archived": False,
259259
"type": "to_do",
260260
"to_do": {
261-
"text": [
261+
"rich_text": [
262262
{
263263
"type": "text",
264264
"text": {"content": "Lacinato kale", "link": None},
@@ -286,7 +286,7 @@ def page_contents() -> NotionPageContents:
286286
"archived": False,
287287
"type": "to_do",
288288
"to_do": {
289-
"text": [
289+
"rich_text": [
290290
{
291291
"type": "text",
292292
"text": {"content": "Bringing it ", "link": None},
@@ -384,7 +384,7 @@ def page_contents() -> NotionPageContents:
384384
"archived": False,
385385
"type": "bulleted_list_item",
386386
"bulleted_list_item": {
387-
"text": [
387+
"rich_text": [
388388
{
389389
"type": "text",
390390
"text": {"content": "a list item", "link": None},
@@ -411,7 +411,7 @@ def page_contents() -> NotionPageContents:
411411
"archived": False,
412412
"type": "to_do",
413413
"to_do": {
414-
"text": [
414+
"rich_text": [
415415
{
416416
"type": "text",
417417
"text": {
@@ -603,7 +603,7 @@ def page_contents() -> NotionPageContents:
603603
"archived": False,
604604
"type": "to_do",
605605
"to_do": {
606-
"text": [
606+
"rich_text": [
607607
{
608608
"type": "text",
609609
"text": {"content": "See the ", "link": None},
@@ -668,7 +668,7 @@ def page_contents() -> NotionPageContents:
668668
"archived": False,
669669
"type": "to_do",
670670
"to_do": {
671-
"text": [
671+
"rich_text": [
672672
{
673673
"type": "text",
674674
"text": {"content": "Click the ", "link": None},
@@ -731,7 +731,7 @@ def page_contents() -> NotionPageContents:
731731
"archived": False,
732732
"type": "to_do",
733733
"to_do": {
734-
"text": [
734+
"rich_text": [
735735
{
736736
"type": "text",
737737
"text": {"content": "Click ", "link": None},
@@ -794,7 +794,7 @@ def page_contents() -> NotionPageContents:
794794
"archived": False,
795795
"type": "toggle",
796796
"toggle": {
797-
"text": [
797+
"rich_text": [
798798
{
799799
"type": "text",
800800
"text": {
@@ -840,7 +840,7 @@ def page_contents() -> NotionPageContents:
840840
"archived": False,
841841
"type": "paragraph",
842842
"paragraph": {
843-
"text": [
843+
"rich_text": [
844844
{
845845
"type": "text",
846846
"text": {"content": "See it in action:", "link": None},
@@ -895,7 +895,7 @@ def page_contents() -> NotionPageContents:
895895
"has_children": False,
896896
"archived": False,
897897
"type": "paragraph",
898-
"paragraph": {"text": []},
898+
"paragraph": {"rich_text": []},
899899
},
900900
{
901901
"object": "block",
@@ -934,7 +934,7 @@ def page_contents() -> NotionPageContents:
934934
"has_children": False,
935935
"archived": False,
936936
"type": "paragraph",
937-
"paragraph": {"text": []},
937+
"paragraph": {"rich_text": []},
938938
},
939939
{
940940
"object": "block",
@@ -973,7 +973,7 @@ def page_contents() -> NotionPageContents:
973973
"has_children": False,
974974
"archived": False,
975975
"type": "paragraph",
976-
"paragraph": {"text": []},
976+
"paragraph": {"rich_text": []},
977977
},
978978
{
979979
"object": "block",
@@ -1013,7 +1013,7 @@ def page_contents() -> NotionPageContents:
10131013
"archived": False,
10141014
"type": "paragraph",
10151015
"paragraph": {
1016-
"text": [
1016+
"rich_text": [
10171017
{
10181018
"type": "text",
10191019
"text": {"content": "Visit our ", "link": None},
@@ -1070,7 +1070,7 @@ def page_contents() -> NotionPageContents:
10701070
"has_children": False,
10711071
"archived": False,
10721072
"type": "paragraph",
1073-
"paragraph": {"text": []},
1073+
"paragraph": {"rich_text": []},
10741074
},
10751075
{
10761076
"object": "block",
@@ -1081,7 +1081,7 @@ def page_contents() -> NotionPageContents:
10811081
"archived": False,
10821082
"type": "paragraph",
10831083
"paragraph": {
1084-
"text": [
1084+
"rich_text": [
10851085
{
10861086
"type": "text",
10871087
"text": {"content": "👉", "link": None},
@@ -1172,7 +1172,7 @@ def page_contents() -> NotionPageContents:
11721172
"has_children": False,
11731173
"archived": False,
11741174
"type": "paragraph",
1175-
"paragraph": {"text": []},
1175+
"paragraph": {"rich_text": []},
11761176
},
11771177
],
11781178
"next_cursor": None,

0 commit comments

Comments
 (0)