synology_apm_repo.sdk.units.content.saas_teams_chat module

Content Layer — Teams/Chat’s HTML rendering. Pure rows -> HTML string formatting, no I/O; the tree-navigation and message/sticker-fetching logic that calls this lives in units/saas/teams_chat.py.

synology_apm_repo.sdk.units.content.saas_teams_chat.render_channel_html(rows, *, channel_name, stickers_by_msg_id=None)

One self-contained HTML page (no external resources/JS) for a Teams channel/chat’s messages. rows are msg_info_table records already read from the decompressed message DB; this function itself does no I/O. stickers_by_msg_id — {msg_id: {sticker_url: base64_content}} from _read_stickers — defaults to {}. Messages sort by timestamp (undated rows first), group under a date separator, and resolve a real reply_to_id to its parent’s sender/preview rather than a bare id.

Known limitation: rows is the caller’s entire channel/chat history (units/saas/teams_chat.py’s own unit() reads every msg_info_table row, no cap), and this function’s whole result is then held in memory at once as one string inside a LazyArtifact (sized for “a small, fully in-memory blob,” which a genuinely large channel’s transcript is not). Not fixed speculatively — would need a streaming rendering shape, a real architectural change — until a real large-channel sample actually shows this as a practical problem.