im: card table cells drop at mentions and local_datetime (markdown cell data)

Aperta Adatta ai principianti
#2,915 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli

Direzione di ricerca

Inizia in shortcuts/im/convert_lib/card.go, in convertTable e extractTableCellValue, poi confronta il modo in cui convertElement gestisce gli elementi del body. Riproduci il comportamento con i dati della scheda forniti e verifica che le celle delle tabelle Markdown mantengano le menzioni e le date e gli orari locali come avviene fuori dalle tabelle; conferma inoltre che la conversione delle tabelle esistente funzioni ancora.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

domain/im

Summary

When an interactive card (schema 2.0) contains a table whose columns have dataType: "markdown", the converter in shortcuts/im/convert_lib/card.go drops every at and local_datetime element inside the cells. Each cell keeps only its plain_text pieces, so a schedule table comes out as | – | , |: the times and the people are gone.

The same elements outside a table convert correctly.

Seen on v1.0.100, and main has the same code. Affects im +messages-mget, +chat-messages-list, +threads-messages-list, and everything else that renders cards through convertCard with card_msg_content_type=raw_card_content.

Reproduction

Raw content as mget returns it with card_msg_content_type=raw_card_content (synthetic data):

{"card_schema":2,"json_attachment":"{\"at_users\":{\"u1\":{\"content\":\"Alice\",\"mention_key\":\"@_user_1\"},\"u2\":{\"content\":\"Bob\",\"mention_key\":\"@_user_2\"}}}","json_card":"{\"body\":{\"property\":{\"elements\":[{\"property\":{\"elements\":[{\"property\":{\"content\":\"Outside a table: \"},\"tag\":\"plain_text\"},{\"property\":{\"userID\":\"u1\"},\"tag\":\"at\"},{\"property\":{\"content\":\" at \"},\"tag\":\"plain_text\"},{\"property\":{\"formatType\":\"date\",\"milliseconds\":\"1794441300000\"},\"tag\":\"local_datetime\"}]},\"tag\":\"markdown\"},{\"property\":{\"columns\":[{\"dataType\":\"markdown\",\"displayName\":\"Shift\",\"name\":\"shift\"},{\"dataType\":\"markdown\",\"displayName\":\"Primary\",\"name\":\"who\"}],\"rows\":[{\"shift\":{\"data\":{\"property\":{\"elements\":[{\"property\":{\"formatType\":\"date_short\",\"milliseconds\":\"1794412800000\"},\"tag\":\"local_datetime\"},{\"property\":{\"content\":\" \"},\"tag\":\"plain_text\"},{\"property\":{\"formatType\":\"time\",\"milliseconds\":\"1794412800000\"},\"tag\":\"local_datetime\"},{\"property\":{\"content\":\" – \"},\"tag\":\"plain_text\"},{\"property\":{\"formatType\":\"time\",\"milliseconds\":\"1794437940000\"},\"tag\":\"local_datetime\"}]},\"tag\":\"markdown\"}},\"who\":{\"data\":{\"property\":{\"elements\":[{\"property\":{\"userID\":\"u1\"},\"tag\":\"at\"},{\"property\":{\"content\":\", \"},\"tag\":\"plain_text\"},{\"property\":{\"userID\":\"u2\"},\"tag\":\"at\"}]},\"tag\":\"markdown\"}}}]},\"tag\":\"table\"}]}},\"schema\":2}"}

with mentions [{"key":"@_user_1","id":"ou_alice","name":"Alice"},{"key":"@_user_2","id":"ou_bob","name":"Bob"}].

convertCard(raw, mentions) returns:

<card>
Outside a table: @Alice(ou_alice) at 2026-11-11T23:55:00Z
| Shift | Primary |
|------|------|
|   –  | ,  |
</card>

Expected: the cells read the way the same elements read outside the table, e.g.

| 2026-11-11T00:00:00Z 2026-11-11T00:00:00Z – 2026-11-11T06:59:00Z | @Alice(ou_alice), @Bob(ou_bob) |

Where it goes wrong

convertTable → extractTableCellValue(cellData["data"]). For a markdown cell, data is a card element ({"tag":"markdown","property":{"elements":[…]}}), so it takes the default branch → extractTextContent → extractTextFromProperty. That joins only the content / text / i18nContent of each child, and at (userID) and local_datetime (milliseconds) have none of those.

A cell whose data is a tagged element could go through convertElement instead, as body elements do. Then convertAt (with at_users / mentions) and convertLocalDatetime apply inside tables too, along with links, emoji and text styles.

Context

This matters for messages from on-call and scheduling bots, which are often tables of <at> and <local_datetime>. For those cards the converted text keeps none of the information the card carries.

Lingua principale
Go
Stelle
18.2k
Fork
1.4k
Merge medio
1g 3h
PR unite (30g)
18

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di larksuite/cli

Tutte le issue di larksuite/cli

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.