Skip to content

Conversation

@milanholemans
Copy link
Contributor

Closes #6484

Copilot AI review requested due to automatic review settings December 31, 2025 00:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the teams chat message list command by migrating it to Zod schema validation and adding support for filtering messages by creation date.

Key changes:

  • Migrates command validation from legacy pattern to Zod schema
  • Adds optional endDateTime parameter to filter messages created before a specific date
  • Updates default output properties to include createdDateTime

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/m365/teams/commands/chat/chat-message-list.ts Migrates to Zod schema validation, adds endDateTime option for filtering messages, updates default properties to include createdDateTime
src/m365/teams/commands/chat/chat-message-list.spec.ts Updates tests to use Zod schema validation pattern, adds test for endDateTime filtering, refactors test data into shared apiResponse constant
docs/docs/cmd/teams/chat/chat-message-list.mdx Adds documentation for new endDateTime option, updates permissions section, updates example outputs to include createdDateTime
Comments suppressed due to low confidence (1)

src/m365/teams/commands/chat/chat-message-list.ts:86

  • Test coverage is missing for the JSON output scenario. The command should have a test that verifies the message body structure is preserved in JSON output mode (i.e., the body.content is not hoisted to body and shortBody is not added). The removed test 'outputs all data in json output mode' provided this coverage, and should be replaced with an equivalent test.
      if (args.options.output && args.options.output !== 'json') {
        items.forEach(i => {
          // hoist the content to body for readability
          i.body = (i.body as ItemBody).content as any;

          let shortBody: string | undefined;
          const bodyToProcess = i.body as string;

          if (bodyToProcess) {
            let maxLength = 50;
            let addedDots = '...';
            if (bodyToProcess.length < maxLength) {
              maxLength = bodyToProcess.length;
              addedDots = '';
            }

            shortBody = bodyToProcess.replace(/\n/g, ' ').substring(0, maxLength) + addedDots;
          }

          i.shortBody = shortBody;
        });
      }

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

Improve the teams chat message list command

1 participant