feat(im/convert): support content_v2 blocks in post message conversion - #1411
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughUpdated post rendering to prefer ChangesPost Rendering with Content Block Selection
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
06004af to
721f1b9
Compare
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@6b0ec80e318f3cd2cec97bb00e0c9ab7b599d1e7🧩 Skill updatenpx skills add larksuite/cli#feat/content-v2-support -y -g |
721f1b9 to
d0bfce5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@shortcuts/im/convert_lib/text.go`:
- Around line 131-135: The condition that checks if userId starts with "ou"
using strings.HasPrefix(userId, "ou") is too restrictive and prevents the
correct at-mention format from being rendered for valid user IDs that don't
start with "ou". Remove the strings.HasPrefix(userId, "ou") check and instead
render the <at user_id="...">...</at> format whenever userId is non-empty,
moving the else branch logic to handle only the case where userId is empty. This
ensures that any non-empty userId value will produce the proper at-mention XML
format rather than just the `@name` fallback.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9b1cf6ef-d8b2-49a1-8114-37721c9540fd
📒 Files selected for processing (8)
shortcuts/im/convert_lib/helpers_test.goshortcuts/im/convert_lib/text.goshortcuts/im/convert_lib/text_test.goskills/lark-im/references/lark-im-chat-messages-list.mdskills/lark-im/references/lark-im-message-enrichment.mdskills/lark-im/references/lark-im-messages-mget.mdskills/lark-im/references/lark-im-messages-search.mdskills/lark-im/references/lark-im-threads-messages-list.md
✅ Files skipped from review due to trivial changes (6)
- skills/lark-im/references/lark-im-threads-messages-list.md
- skills/lark-im/references/lark-im-message-enrichment.md
- skills/lark-im/references/lark-im-messages-search.md
- skills/lark-im/references/lark-im-chat-messages-list.md
- skills/lark-im/references/lark-im-messages-mget.md
- shortcuts/im/convert_lib/helpers_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- shortcuts/im/convert_lib/text_test.go
1b1064d to
da5df0b
Compare
# Conflicts: # shortcuts/im/convert_lib/text.go # shortcuts/im/convert_lib/text_test.go
da5df0b to
6b0ec80
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1411 +/- ##
==========================================
+ Coverage 73.42% 73.43% +0.01%
==========================================
Files 753 753
Lines 70111 70119 +8
==========================================
+ Hits 51476 51489 +13
+ Misses 14826 14823 -3
+ Partials 3809 3807 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Support
content_v2post message conversion in IM shortcuts so newer post payloads render with the expected markdown, mention, and image formats while preserving fallback compatibility with legacycontent.Changes
content_v2blocks when converting post messages, with fallback to legacycontent.mdpost elements.<at user_id="...">...</at>format when user IDs are available.content_v2selection, fallback behavior,md, mention, and image rendering.Test Plan
go test ./shortcuts/im/convert_libmake unit-testlark-cli im <command>flow works as expectedRelated Issues
Summary by CodeRabbit
@allis rendered via an explicit<at user_id="all"></at>token, andou*/name combinations follow consistent<at ...></at>output rules (with name-only and id-only handled distinctly).), with a separate fallback when no image key exists.<at ...></at>markup.content_v2vscontent.