Skip to content

fix: preserve chatMessage subject on reads and add message send --subject - #90

Open
amanjoshicodes wants to merge 1 commit into
osodevops:mainfrom
amanjoshicodes:fix/message-subject
Open

fix: preserve chatMessage subject on reads and add message send --subject#90
amanjoshicodes wants to merge 1 commit into
osodevops:mainfrom
amanjoshicodes:fix/message-subject

Conversation

@amanjoshicodes

Copy link
Copy Markdown
Contributor

Problem

ChatMessage in src/models/message.rs has no subject field, so the subject of a channel root message — which Graph returns on both GET .../messages/{id} and the list endpoint — is silently dropped during deserialization. A message posted with a subject reads back without one:

$ teams message send --team TEAM_ID --channel CHANNEL_ID --subject "Release plan" --body "Details inside."   # (not possible before this PR)
$ teams message get --team TEAM_ID --channel CHANNEL_ID MESSAGE_ID --output json | jq .data.subject
null        # v0.6.0 — Graph returns "Release plan", the CLI loses it

There was also no way to set a subject on send.

Change

  • ChatMessage gains subject: Option<String> (skip-serializing when absent, so messages without a subject gain no "subject": null noise). message get and message list now return what Graph stores.
  • SendMessageRequest gains the top-level subject, exposed as teams message send --subject TEXT. Channel sends only: chat messages have no subject, so clap rejects --subject with --chat or without --channel (exit 2) before anything is sent.
  • Docs: README, docs/command-reference.md, docs/man/teams.1, CHANGELOG entry under Unreleased. No version bump (per the release-automation convention).

Tests

  • Model round-trips: subject survives deserialize/serialize; absent subject stays omitted; SendMessageRequest serializes subject at the top level.
  • CLI regressions: message send --help advertises --subject <SUBJECT>; --subject with --chat and --subject without --channel both fail with exit 2.
  • cargo fmt -- --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --all-targets (313 tests) all green.

Live verification (real tenant, delegated auth)

Send with the patched binary, then read back three ways:

$ teams message send --team TEAM_ID --channel CHANNEL_ID --subject "CLI subject test" --body "[TESTING] ..." --output json | jq '{id: .data.id, subject: .data.subject}'
{ "id": "MESSAGE_ID", "subject": "CLI subject test" }

$ teams message get --team TEAM_ID --channel CHANNEL_ID MESSAGE_ID --output json | jq .data.subject
"CLI subject test"                  # patched binary; raw Graph GET agrees

$ teams-v0.6.0 message get --team TEAM_ID --channel CHANNEL_ID MESSAGE_ID --output json | jq .data.subject
null                                # released binary on the same message

message list on the same channel shows the subject on the patched binary as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant