Commit graph

13 commits

Author SHA1 Message Date
Christopher Poile
0502d6b3c5
[MM-68655] Surface RPC errors from plugin hooks (#36414)
* add WithRPCErr hooks (server-facing/internal only)

* zero _returns on RPC failure in WithRPCErr companions

Aligns the WithRPCErr template with the HooksRPCErr godoc contract: when
g.client.Call returns a transport error, gob may have partially decoded the
reply. Reassign _returns to a zero value before destructuring so callers always
receive zeroed outputs alongside a non-nil transport error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* rename HooksRPCErr to HooksWithRPCErr for naming consistency

Every related symbol uses the WithRPCErr suffix (MessageHasBeenPostedWithRPCErr,
RunMultiPluginHookWithRPCErr, RunMultiHookWithRPCErr, etc.). Aligning the
interface name removes the only outlier and makes the convention uniform.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* rename rpcErrImpl to hooksWithRPCErrImpl

Mirrors the existing hooksImpl/Hooks naming pattern on hooksTimerLayer.

* add supervisor.HooksWithRPCErr() and drop runtime type assertion

The old path did rp.supervisor.Hooks().(HooksWithRPCErr) and handled the
"doesn't implement" branch — but that branch was structurally unreachable
(the compile-time `_ HooksWithRPCErr = (*hooksTimerLayer)(nil)` assertion
guards it).

Change supervisor.hooks from `Hooks` to the concrete `*hooksTimerLayer`
(which implements both interfaces, enforced at field assignment), add a
parallel HooksWithRPCErr() accessor, and call it directly. Hooks() keeps
its public Hooks-interface signature via implicit conversion at return.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* drop "implemented by" clause from HooksWithRPCErr godoc

Both hooksRPCClient and hooksTimerLayer satisfy the interface, and naming
implementations in interface godocs adds rot — the contract is what readers
need, not the list of wrappers.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 10:41:11 -04:00
Doug Lauder
c3ab0f7f78
MM-68191: Add plugin Receive APIs for shared channel sync (#35962)
* Add plugin APIs for plugin to sync data into shared channels
2026-04-14 14:31:25 -04:00
Doug Lauder
7d6d834f1f
MM-68016, MM-68017, MM-68018 Add plugin pre-hooks for membership and channel archive (#35731)
* MM-68016, MM-68017, MM-68018 Add plugin pre-hooks for channel member add, team member add, and channel archive

  Enable plugins to intercept and reject (or modify) three operations before
  they are persisted: adding a channel member, adding a team member, and
  archiving a channel. These are the three high-priority hooks from epic
  MM-68003.
2026-03-25 08:45:17 -04:00
Ben Schumacher
9add320011
[MM-64654] Migrate to modern Go features (#31820) 2025-07-18 12:54:51 +02:00
David Krauser
aaa62a40ae
[MM-64686] Expose audit logging functionality via plugin API (#31204)
This commit exposes audit logging functionality to plugins via the plugin API, allowing plugins to create and log audit records. Additionally, it addresses a gob encoding issue that could cause plugin crashes when audit data contains nil pointers or unregistered types.
2025-06-25 20:37:32 -04:00
Ben Cooke
ccd8a60168
Plugin groups (#30320)
* add new pluginapi methods

* SAML login hook

* set ReAddRemovedMembers to true for plugin groups

* change to DoLogin signature for SAML
2025-03-13 12:00:15 -04:00
Ben Schumacher
32d93fd469
[MM-57743] Enable errcheck linter (#26723) 2024-04-29 11:23:01 +02:00
Ben Schumacher
de3e5aab25
[MM-53156] Remove Multi-Product architecture (#25669) 2024-02-15 13:01:44 +01:00
Claudio Costa
aa3a12f183
[MM-55268] Implement ServeMetrics plugins hook (#24249)
* Implement ServeMetrics plugins hook

* Update error id

* Simplify

* Revert "Simplify"

This reverts commit c9dc5d5eac.

* Add comment and error handler

* Wrap error

* Update translation file

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-11-17 14:39:06 -06:00
Qrypt
a46ad3169c
(feature) New MessagesWillBeConsumed Server Plugin Hook (#23305)
* feature: implemented basic MessageWillBeConsumed hook and applied on GetSinglePost method.

* use hook in get methods

* chore: refactored hook usage and created utils functions to apply hook

* bugfix: single post not updating

* chore: adjusted hook to return post

* chore: reverted some uneeded  changes

* chore: updated hook to accept slice of posts

* bugfix: slice filled with niil values

* chore: MessageWillBeConsumed ranamed to MessagesWillBeConsumed

* Update plugin/hooks.go

Co-authored-by: Jesse Hallam <jesse@thehallams.ca>

* Add feature flag

* Update min version

* update tests to account for feature flag

* fix linting issues

---------

Co-authored-by: Matej Topolovac <>
Co-authored-by: mtopolovac <43346061+mtopolovac@users.noreply.github.com>
Co-authored-by: Jesse Hallam <jesse@thehallams.ca>
Co-authored-by: Kevin Hsieh <kevinh@qrypt.com>
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2023-10-23 11:12:46 -03:00
Ben Schumacher
0d5a8b8841
Add whitespace linter (#24855) 2023-10-11 10:13:36 +02:00
Agniva De Sarker
efaa6264cc
MM-53032: Fix module path after repo rename (#23689)
It was a good decision in hindsight to keep the public module as 0.x
because this would have been a breaking change again.

https://mattermost.atlassian.net/browse/MM-53032
```release-note
Changed the Go module path from github.com/mattermost/mattermost-server/server/v8 to github.com/mattermost/mattermost/server/v8.

For the public facing module, it's path is also changed from github.com/mattermost/mattermost-server/server/public to github.com/mattermost/mattermost/server/public
```
2023-06-11 10:54:35 +05:30
Jesse Hallam
bb02b35048
Expose public/ API as submodule (#23345)
* model -> public/model

* plugin -> public/plugin

* public/model/utils -> public/utils

* platform/shared/mlog -> public/shared/mlog

* platform/shared/i18n -> public/shared/i18n

* platform/shared/markdown -> public/shared/markdown

* platform/services/timezones -> public/shared/timezones

* channels/einterfaces -> einterfaces

* expose public/ submodule

* go mod tidy

* .github: cache-dependency-path, setup-go-work

* modules-tidy for public/ too

* remove old gomodtidy
2023-05-10 13:07:02 -03:00