Repository navigation
Commit 01172ea
committed
fix: store inline prosemirror JSON in ChatMessage.message (HULY-20)
The original attempt (PR #44, reverted in #45) called uploadMarkup and
stored a MarkupBlobRef string in `message`. That rendered as literal
text in the web UI because the front-end's MessageViewer component does:
$: node = markupToJSON(message)
with no MarkupBlobRef resolution step. ChatMessage.message is typed
`TypeMarkup()` — an inline prosemirror-JSON string (`Markup = string`
in @hcengineering/core), not a MarkupBlobRef.
Why the same pattern appeared to work for Issue.description:
Issue.description is also `TypeMarkup()`, but the web UI renders it
through `<CollaborativeTextEditor>`, which DOES resolve MarkupBlobRef
via the collaborator service. So `huly issue update --body` accidentally
worked. The chat/dm/thread/activity paths render through plain
`MessageViewer` and broke.
Fix:
* Convert HTML → prosemirror JSON locally via the existing
`htmlToMarkup()` helper.
* Store the resulting prosemirror-JSON string inline in `message`
— no blob upload, no MarkupBlobRef.
* Same pattern applied to all 10 chat-message write paths:
comment add/update, channel message send/update, thread reply
add/update, dm message send, activity reply add/update,
approval comment.
Removed from the previous PR (no longer relevant):
* `uploadMarkup` and `generateId` imports — not used anymore.
* Deferred-upload pattern for dry-run on channel paths — dry-run
preview now shows the converted prosemirror JSON (which is what
would be stored). No external IO involved in conversion, so no
point deferring.
* `wouldUploadMarkup` notes in dry-run output — n/a, no upload.
Verified on https://huly.aaravlabs.com (real server):
* Posted via the local build: `node dist/index.js comment add --issue
HULY-20 --body-file /tmp/kilo/huly20-fix2.html`.
* message field stores inline prosemirror JSON starting with
`{"type":"doc","content":[{"type":"heading",...}]}`.
* Web UI's MessageViewer can render this directly without any
collaborator lookup.1 parent 0107d56 commit 01172ea
4 files changed
Lines changed: 49 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
371 | 372 | | |
372 | 373 | | |
373 | 374 | | |
374 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
375 | 380 | | |
376 | 381 | | |
377 | 382 | | |
| |||
408 | 413 | | |
409 | 414 | | |
410 | 415 | | |
| 416 | + | |
411 | 417 | | |
412 | 418 | | |
413 | 419 | | |
414 | 420 | | |
415 | | - | |
| 421 | + | |
416 | 422 | | |
417 | 423 | | |
418 | 424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
300 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
301 | 305 | | |
302 | 306 | | |
303 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
546 | 547 | | |
547 | 548 | | |
548 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
549 | 554 | | |
550 | | - | |
| 555 | + | |
551 | 556 | | |
552 | 557 | | |
553 | 558 | | |
| |||
610 | 615 | | |
611 | 616 | | |
612 | 617 | | |
| 618 | + | |
| 619 | + | |
613 | 620 | | |
614 | | - | |
| 621 | + | |
615 | 622 | | |
616 | 623 | | |
617 | 624 | | |
| |||
737 | 744 | | |
738 | 745 | | |
739 | 746 | | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
740 | 750 | | |
741 | | - | |
| 751 | + | |
742 | 752 | | |
743 | 753 | | |
744 | 754 | | |
| |||
791 | 801 | | |
792 | 802 | | |
793 | 803 | | |
794 | | - | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
795 | 807 | | |
796 | 808 | | |
797 | 809 | | |
| |||
1039 | 1051 | | |
1040 | 1052 | | |
1041 | 1053 | | |
1042 | | - | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1043 | 1058 | | |
1044 | 1059 | | |
1045 | 1060 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| |||
94 | 104 | | |
95 | 105 | | |
96 | 106 | | |
97 | | - | |
| 107 | + | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
102 | 112 | | |
103 | | - | |
| 113 | + | |
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
| |||
130 | 140 | | |
131 | 141 | | |
132 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
133 | 146 | | |
134 | 147 | | |
135 | 148 | | |
136 | 149 | | |
137 | 150 | | |
138 | 151 | | |
139 | 152 | | |
140 | | - | |
| 153 | + | |
141 | 154 | | |
142 | 155 | | |
143 | 156 | | |
| |||
0 commit comments