feat(mattermost): add edit and delete message actions#25295
Open
Luna2026-a11y wants to merge 10 commits intoopenclaw:mainfrom
Open
feat(mattermost): add edit and delete message actions#25295Luna2026-a11y wants to merge 10 commits intoopenclaw:mainfrom
Luna2026-a11y wants to merge 10 commits intoopenclaw:mainfrom
Conversation
extensions/mattermost/src/channel.ts
Outdated
Comment on lines
+74
to
+80
| const message = | ||
| typeof (params as any)?.message === "string" | ||
| ? (params as any).message | ||
| : typeof (params as any)?.text === "string" | ||
| ? (params as any).text | ||
| : ""; | ||
| if (!message) { |
Contributor
There was a problem hiding this comment.
empty message is allowed but might cause API errors
The code allows empty strings for the message parameter, but Mattermost API typically requires non-empty message text. If params.message or params.text is an empty string, it will pass the empty string check but could fail at the API level.
Compare with Discord (line 171 in src/channels/plugins/actions/discord/handle-action.ts): requires message with required: true
Compare with Telegram (line 161 in src/channels/plugins/actions/telegram.ts): requires message with required: true, allowEmpty: false
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/mattermost/src/channel.ts
Line: 74-80
Comment:
empty message is allowed but might cause API errors
The code allows empty strings for the `message` parameter, but Mattermost API typically requires non-empty message text. If `params.message` or `params.text` is an empty string, it will pass the empty string check but could fail at the API level.
Compare with Discord (line 171 in `src/channels/plugins/actions/discord/handle-action.ts`): requires message with `required: true`
Compare with Telegram (line 161 in `src/channels/plugins/actions/telegram.ts`): requires message with `required: true, allowEmpty: false`
How can I resolve this? If you propose a fix, please make it concise.|
This pull request has been automatically marked as stale due to inactivity. |
6350dbd to
b5650e4
Compare
b5650e4 to
3e7598c
Compare
54075f1 to
4ec6fb5
Compare
4ec6fb5 to
bb067c0
Compare
Add patchMattermostPost() and deleteMattermostPost() to the Mattermost
client, and wire them as 'edit' and 'delete' actions in the channel
plugin's message action adapter.
This enables:
- Editing bot messages via the message tool (action=edit)
- Deleting bot messages via the message tool (action=delete)
- Foundation for block-streaming edit-in-place (progressive message
rendering like Telegram/Discord)
Uses PATCH /api/v4/posts/{post_id}/patch for edits and
DELETE /api/v4/posts/{post_id} for deletions.
Tested against a live Mattermost 10.x instance.
bb067c0 to
69b8aef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
patchMattermostPost()anddeleteMattermostPost()to the Mattermost client, and wires them aseditanddeleteactions in the channel plugin message action adapter.What this enables
action=edit) — foundation for block-streaming edit-in-place (progressive message rendering like Telegram/Discord)action=delete)API endpoints used
PUT /api/v4/posts/{post_id}/patch(partial update)DELETE /api/v4/posts/{post_id}Files changed
extensions/mattermost/src/mattermost/client.ts— addpatchMattermostPost()anddeleteMattermostPost()extensions/mattermost/src/channel.ts— registereditanddeleteinlistActions,supportsAction, andhandleActionTesting
edit_post/delete_postpermissions (standard bot permissions)Notes
This is a stepping stone toward full block-streaming support on Mattermost, bringing it closer to feature parity with the Telegram and Discord plugins.
Greptile Summary
Added edit and delete message functionality to the Mattermost plugin by implementing
patchMattermostPost()anddeleteMattermostPost()in the client, and wiring them through the channel message action adapter.Changes:
patchMattermostPost()function supporting partial updates (message, props, fileIds)deleteMattermostPost()function for post deletioneditanddeleteactions inlistActions()andsupportsAction()PUT /posts/{id}/patch,DELETE /posts/{id})Architecture:
reactaction handler (account resolution, validation, error handling)messageIdandpostIdparameter names for flexibilityThe implementation is straightforward and brings Mattermost closer to feature parity with Telegram and Discord plugins.
Confidence Score: 4/5
Last reviewed commit: e3df5fa
(2/5) Greptile learns from your feedback when you react with thumbs up/down!