Update docs to include collapsible elements#1516
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Interactive Dialogs documentation to cover the new collapsible dialog element, including its purpose, configuration fields, and an example payload for integrations.
Changes:
- Adds
collapsibleto the list of supported dialog element types. - Introduces a new “Collapsible elements” section with usage notes, a JSON example, and a field reference table.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📝 WalkthroughWalkthroughThis PR adds ChangesCollapsible Element Documentation
Plugin JSDoc Parameter Extraction
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
site/content/integrate/plugins/interactive-dialogs/_index.md (1)
625-626: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the heading hierarchy contiguous.
#####skips a level after###, which trips markdownlint and makes the section structure harder to scan.♻️ Suggested fix
-##### Minimum Server Version: 11.10.0 +#### Minimum Server Version: 11.10.0🤖 Prompt for 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. In `@site/content/integrate/plugins/interactive-dialogs/_index.md` around lines 625 - 626, The heading hierarchy in the Collapsible elements section is skipping a level, which breaks contiguous markdown structure. Update the markdown under the Collapsible elements section so the heading used with “Minimum Server Version: 11.10.0” matches the expected next level after the preceding `###` heading, and keep the section consistent with the surrounding headings in this document.Source: Linters/SAST tools
🤖 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.
Nitpick comments:
In `@site/content/integrate/plugins/interactive-dialogs/_index.md`:
- Around line 625-626: The heading hierarchy in the Collapsible elements section
is skipping a level, which breaks contiguous markdown structure. Update the
markdown under the Collapsible elements section so the heading used with
“Minimum Server Version: 11.10.0” matches the expected next level after the
preceding `###` heading, and keep the section consistent with the surrounding
headings in this document.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 72c8a727-8a20-4f30-85f7-c9480f0fa2ac
📒 Files selected for processing (1)
site/content/integrate/plugins/interactive-dialogs/_index.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@scripts/plugin-jsdocs.js`:
- Around line 57-62: The parameter extraction in the docs generation logic is
assuming every destructured property has prop.key.name, which breaks on
ObjectPattern entries like RestElement and misses other non-Identifier params.
Update the funcExpr[0].params.flatMap handling to explicitly branch on
param.type and safely handle destructured object/array patterns, defaults, and
rest elements without reading key.name blindly. Use the existing params
extraction block in the JSDoc script to keep all parameter shapes supported
while avoiding crashes on { ...rest }.
In `@site/content/integrate/plugins/interactive-dialogs/_index.md`:
- Around line 625-626: The heading hierarchy in the Collapsible elements section
is skipping a level, so update the heading after the `### Collapsible elements`
entry to use the next level heading instead of jumping to a deeper one. Adjust
the Markdown in `_index.md` so this section stays consistent with the
surrounding structure and satisfies the linter, using the same section labels
already present.
- Line 73: The sentence in the interactive dialogs docs reads awkwardly around
the “otherwise” clause and the “if” comma, so rewrite the copy in place for
clarity. Update the wording in the content block that mentions optional elements
so it flows more naturally, keeps the same meaning about client errors and help
text placement, and remains easy to scan.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1fabb27a-c9ce-442b-a490-0173f6d29cbc
📒 Files selected for processing (2)
scripts/plugin-jsdocs.jssite/content/integrate/plugins/interactive-dialogs/_index.md
| params = funcExpr[0].params.flatMap(param => { | ||
| if (param.properties) { | ||
| return param.properties.map(prop => prop.key.name); | ||
| } | ||
| return param.name ? [param.name] : []; | ||
| }); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm RestElement and other pattern node structures in the parser output.
# Requires the package installed in scripts/ (Makefile runs `cd scripts && npm install`).
node -e "
const { parse } = require('./scripts/node_modules/@typescript-eslint/typescript-estree');
const code = 'const fn = ({ a, ...rest }, [b], c = 1, ...args) => {};';
const ast = parse(code, { comment: true, loc: true });
const arrow = ast.body[0].declarations[0].init;
arrow.params.forEach(p => {
console.log(p.type, '→ properties:', !!p.properties, '| name:', p.name || '(none)', '| key:', p.key || '(none)');
if (p.properties) {
p.properties.forEach(prop => {
console.log(' prop:', prop.type, '| key:', prop.key?.name || '(none)', '| argument:', prop.argument?.name || '(none)');
});
}
});
"Repository: mattermost/mattermost-developer-documentation
Length of output: 1088
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== scripts/plugin-jsdocs.js ==\n'
cat -n scripts/plugin-jsdocs.js | sed -n '1,140p'
printf '\n== scripts/package.json (if present) ==\n'
if [ -f scripts/package.json ]; then
cat -n scripts/package.json | sed -n '1,220p'
fi
printf '\n== dependency references ==\n'
rg -n "`@typescript-eslint/typescript-estree`|typescript-estree" -S . --glob '!**/node_modules/**'Repository: mattermost/mattermost-developer-documentation
Length of output: 4542
Handle destructured params before reading prop.key.name ObjectPattern.properties can include RestElement nodes, so this branch can throw on { ...rest } and stop docs generation. The fallback also drops non-Identifier params like array patterns and defaults.
🤖 Prompt for 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.
In `@scripts/plugin-jsdocs.js` around lines 57 - 62, The parameter extraction in
the docs generation logic is assuming every destructured property has
prop.key.name, which breaks on ObjectPattern entries like RestElement and misses
other non-Identifier params. Update the funcExpr[0].params.flatMap handling to
explicitly branch on param.type and safely handle destructured object/array
patterns, defaults, and rest elements without reading key.name blindly. Use the
existing params extraction block in the JSDoc script to keep all parameter
shapes supported while avoiding crashes on { ...rest }.
| - `collapsible`: A section that groups child elements under a toggleable header. Use this to organize long forms; sections can be nested and can start expanded or collapsed. | ||
|
|
||
| Each element is required by default, otherwise the client will return an error as shown below. Note that the error message will appear below the help text, if one is specified. To make an element optional, set the field `"optional": "true"`. | ||
| Each element is required by default, otherwise the client will return an error as shown below. Note that the error message will appear below the help text, if one is specified. To make an element optional, set the field `"optional": true`. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Reword this sentence for clarity.
The otherwise clause reads awkwardly, and the comma before if is unnecessary. A small rewrite will make the requirement easier to scan.
♻️ Proposed fix
-Each element is required by default, otherwise the client will return an error as shown below. Note that the error message will appear below the help text, if one is specified. To make an element optional, set the field `"optional": true`.
+Each element is required by default; otherwise, the client will return an error as shown below. Note that the error message will appear below the help text if one is specified. To make an element optional, set the field `"optional": true`.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Each element is required by default, otherwise the client will return an error as shown below. Note that the error message will appear below the help text, if one is specified. To make an element optional, set the field `"optional": true`. | |
| Each element is required by default; otherwise, the client will return an error as shown below. Note that the error message will appear below the help text if one is specified. To make an element optional, set the field `"optional": true`. |
🧰 Tools
🪛 LanguageTool
[typographical] ~73-~73: The word “otherwise” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...collapsed. Each element is required by default, otherwise the client will return an error as show...
(THUS_SENTENCE)
[typographical] ~73-~73: Usually, there’s no comma before “if”.
Context: ... message will appear below the help text, if one is specified. To make an element op...
(IF_NO_COMMA)
🤖 Prompt for 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.
In `@site/content/integrate/plugins/interactive-dialogs/_index.md` at line 73, The
sentence in the interactive dialogs docs reads awkwardly around the “otherwise”
clause and the “if” comma, so rewrite the copy in place for clarity. Update the
wording in the content block that mentions optional elements so it flows more
naturally, keeps the same meaning about client errors and help text placement,
and remains easy to scan.
Source: Linters/SAST tools
| ### Collapsible elements | ||
| ##### Minimum Server Version: 11.10 |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use the next heading level here.
This jumps from ### to #####, which breaks the Markdown hierarchy. #### keeps the section structure consistent and satisfies the linter.
♻️ Proposed fix
-##### Minimum Server Version: 11.10
+#### Minimum Server Version: 11.10📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### Collapsible elements | |
| ##### Minimum Server Version: 11.10 | |
| ### Collapsible elements | |
| #### Minimum Server Version: 11.10 |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 626-626: Heading levels should only increment by one level at a time
Expected: h4; Actual: h5
(MD001, heading-increment)
🤖 Prompt for 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.
In `@site/content/integrate/plugins/interactive-dialogs/_index.md` around lines
625 - 626, The heading hierarchy in the Collapsible elements section is skipping
a level, so update the heading after the `### Collapsible elements` entry to use
the next level heading instead of jumping to a deeper one. Adjust the Markdown
in `_index.md` so this section stays consistent with the surrounding structure
and satisfies the linter, using the same section labels already present.
Source: Linters/SAST tools
|
Newest code from mattermost has been published to preview environment for Git SHA d1bc059 |
Summary
Adds in documentation and instructions regarding the new collapsible elements in interactive dialogs.
Ticket Link
https://mattermost.atlassian.net/browse/MM-69315