Commit graph

37 commits

Author SHA1 Message Date
Julien Tant
78050bb0d3
Change properties search signature to support multiple TargetIDs (#33873)
* change properties search

* add tests

* Fix calls to to the search methods

* Fix SearchPropertyFields call with wrong signature
2025-09-11 22:56:01 +00:00
Guillermo Vayá
d15b933888
[MM-64683] Implement property field counting functionality in Plugin API (#33438)
* Implement property field limit enforcement and counting functionality in Plugin API

- Added a limit of 20 property fields per group in the CreatePropertyField method.
- Introduced CountPropertyFields method to count active and all property fields, including deleted ones.
- Enhanced tests to validate the new property field limit and counting behavior.
- Updated related API and service methods to support the new functionality.

* Update server/channels/app/properties/property_field.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix vet

* fix lint error

* fix test

* fix tests

* fix test

* count properties + targets

* Update server/channels/app/plugin_api.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* remove test for limit

* fix more tests

* improve testing messages now that the limit is removed

* Apply suggestion from @calebroseland

Co-authored-by: Caleb Roseland <caleb@calebroseland.com>

* Apply suggestion from @calebroseland

Co-authored-by: Caleb Roseland <caleb@calebroseland.com>

* Apply suggestion from @calebroseland

Co-authored-by: Caleb Roseland <caleb@calebroseland.com>

* Apply suggestion from @calebroseland

Co-authored-by: Caleb Roseland <caleb@calebroseland.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Julien Tant <785518+JulienTant@users.noreply.github.com>
Co-authored-by: Caleb Roseland <caleb@calebroseland.com>
2025-09-11 12:49:14 -07:00
David Krauser
c0ff672afb
[MM-64840] Add EmailNotificationWillBeSent Plugin Hook (#33421) 2025-08-05 09:09:07 -04: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
Julien Tant
731bd7c414
MM-63285: Add property field methods to plugin API (#31035)
Co-authored-by: Claude <noreply@anthropic.com>
2025-06-10 16:10:28 -07:00
Jesse Hallam
e6d8bf5835
Upgrade Go to 1.24.3 (#31220)
* Upgrade Go to 1.24.3

Updates the following files:
- server/.go-version: 1.23.9 → 1.24.3
- server/build/Dockerfile.buildenv: golang:1.23.9-bullseye → golang:1.24.3-bullseye
- server/go.mod: go 1.23.0 → go 1.24.3, toolchain go1.23.9 → go1.24.3
- server/public/go.mod: go 1.23.0 → go 1.24.3, toolchain go1.23.9 → go1.24.3

Also fixes non-constant format string errors introduced by Go 1.24.3's stricter format string checking:
- Added response() helper function in slashcommands/util.go for simple string responses
- Removed unused responsef() function from slashcommands/util.go
- Replaced responsef() with response() for translated strings that don't need formatting
- Fixed fmt.Errorf and fmt.Fprintf calls to use proper format verbs instead of string concatenation
- Updated marketplace buildURL to handle format strings conditionally

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update generated mocks for Go 1.24.3

Regenerated mocks using mockery v2.53.4 to ensure compatibility with Go 1.24.3.
This addresses mock generation failures that occurred with the Go upgrade.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update to bookworm and fix non-existent sha

Signed-off-by: Stavros Foteinopoulos <stafot@gmail.com>

* fix non-constant format string

---------

Signed-off-by: Stavros Foteinopoulos <stafot@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Stavros Foteinopoulos <stafot@gmail.com>
2025-06-10 15:04:57 -03:00
Ben Cooke
bfe90c3704
New pluginapi method for syncables (#30790)
* new pluginapi method for syncables
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-05-21 14:44:34 -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
Domenico Rizzo
e8b5ecd826
MM-57738 - Added GetPluginID function across multiple files (#27960) 2024-08-26 13:39:29 +02:00
Ben Schumacher
6bbf7bbb9f
Update Packet metadata generation based on feedback (#27490) 2024-07-04 21:56:38 +02:00
Ibrahim Serdar Acikgoz
e85d34163c
Add support packet metadata (#27465) 2024-06-27 15:27:57 +02:00
Julien Tant
e96db725ea
PluginAPI: add ability to retrieve users by ids (#26936)
* pluginapi: ability to retrieve users by ids

* fix test
2024-05-15 07:06:40 -07:00
Agniva De Sarker
870cee30c6
MM-57759: Added mockery support for 1.22 (#26774)
* Revert "Revert "MM-57759: Bump mockery to version 2.42.2 to support go  1.22^" (#26772)"

This reverts commit cd3b5b46e1.

* Added the hooks.go file changes as well

```release-note
NONE
```
2024-04-13 08:15:59 +05:30
Agniva De Sarker
cd3b5b46e1
Revert "MM-57759: Bump mockery to version 2.42.2 to support go 1.22^" (#26772) 2024-04-12 15:31:24 +02:00
Ezekiel
98712737e6
MM-57759: Bump mockery to version 2.42.2 to support go 1.22^ (#26761) 2024-04-12 10:38:34 +02:00
Ibrahim Serdar Acikgoz
92f11f8971
Make support packet composable with plugins (#26403)
---------

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2024-04-12 10:05:58 +02:00
Jesse Hallam
2230fb6f5f
MM-57018: support reattaching plugins (#26421)
* ProfileImageBytes for EnsureBotOptions

* leverage plugintest.NewAPI

* fix linting

* add UpdateUserRoles to plugin api

* MM-57018: support reattaching plugins

Expose a local-only API for reattaching plugins: instead of the server starting and managing the process itself, allow the plugin to be launched externally (eg within a unit test) and reattach to an existing server instance to provide the unit test with a fully functional RPC API, sidestepping the need for mocking the plugin API in most cases.

In the future, this may become the basis for running plugins in a sidecar container.

Fixes: https://mattermost.atlassian.net/browse/MM-57018

* drop unused supervisor.pid

* factor out checkMinServerVersion

* factor out startPluginServer

* restore missing setPluginState on successful reattach

* avoid passing around a stale registeredPlugin

* inline initializePluginImplementation

* have IsValid return an error

* explicitly close rpcClient

In the case of reattached plugins, the Unix socket won't necessarily disappear leaving the muxBrokers blocked indefinitely. And `Kill()` doesn't do anything if there's no process being managed.

* explicitly detachPlugin

* emphasize gRPC not being supported

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-11 11:10:25 -04:00
Jesse Hallam
acbaf4c283
add UpdateUserRoles to plugin api (#26615)
* ProfileImageBytes for EnsureBotOptions

* leverage plugintest.NewAPI

* fix linting

* add UpdateUserRoles to plugin api
2024-03-29 19:22:54 -03:00
Doug Lauder
7b7bcff821
Shared channels auto-share DM & group messages (#26097)
* option for auto inviting plugin to all shared channels.
* auto-invite remotes to shared channels when flag set
2024-02-09 10:47:12 -05:00
Doug Lauder
a07097ed57
Plugin API hook for Shared Channel file attachment sync (#25874)
* option for auto inviting plugin to all shared channels.

* auto-invite remotes to shared channels when flag set

* fix unit test

* immediately ping new remotes; fix unique siteurl bug

* make i18n-extract

* fix translations

* plugin hooks for file attachments

* hook for profile image sync

* fix profile image sync

* fix unit test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-16 15:48:51 +01:00
Harrison Healey
4d96c11314
MM-56083 Add PatchMultipleMembersNotifyProps plugin API (#25690)
* Add ChannelStore.UpdateMultipleMembersNotifyProps

* Make UpdateMultipleMembersNotifyProps return updated values from the DB

* Add UpdateChannelMembersNotifications plugin API

* Extract i18n

* Fix style

* Make layers

* Change to PatchMultipleMembersNotifyProps

* Add limit to PatchChannelMembersNotifyProps

* Add additional unit tests

* Address feedback

* Lowercase decodeJSON

* Have PatchMultipleMembersNotifyProps update LastUpdateAt

* Fix tests that relied on unreliable return order

* Fix i18n
2024-01-11 13:24:52 -05:00
Harrison Healey
59549653a7
MM-56147 Add GetPreferenceForUser plugin API (#25704)
* MM-56147 Add GetPreferenceForUser plugin API

* Change return type to non-pointer for preference consistency

* Fix merge
2024-01-04 13:50:19 -05:00
Harrison Healey
502cd6ef7d
MM-56082 Add PreferencesHaveChanged plugin hook (#25659)
* Add interface for PreferencesHaveChanged hook

* Add context to preference-related methods of App

* Implement PreferencesHaveChanged

* Re-add missing "fmt" import

* Update minimum server version for the new hook

* Remove pointers to be consistent with other preference APIs
2024-01-03 12:25:53 -05:00
Doug Lauder
2d1135ca46
Shared channels plugin APIs for MS Teams plugin (#25805)
New plugin APIs and hooks for accessing Shared Channels service via plugin. 

- RegisterPluginForSharedChannels(opts model.RegisterPluginOpts) (remoteID string, err error)
- UnregisterPluginForSharedChannels(pluginID string) error
- ShareChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
- UpdateSharedChannel(sc *model.SharedChannel) (*model.SharedChannel, error)
- UnshareChannel(channelID string) (unshared bool, err error)
- UpdateSharedChannelCursor(channelID, remoteID string, cusror model.GetPostsSinceForSyncCursor) error
- SyncSharedChannel(channelID string) error
- InviteRemoteToChannel(channelID string, remoteID string, userID string) error
- UninviteRemoteFromChannel(channelID string, remoteID string) error

Hooks
- OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluster) (model.SyncResponse, error)
- OnSharedChannelsPing(rc *model.RemoteCluster) bool
2023-12-22 17:00:27 -05: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
Jesse Hallam
48bf4e9bd8
Fix issue 25390 (#25403) 2023-11-10 21:55:33 -04: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
Jesús Espino
17ff2049ec
Adding 'MessageHasBeenDeleted' hook to plugins (#22476)
* Adding 'MessageHasBeenDeleted' hook to plugins

* Remove debug logs

* Add unit test

* Bumping the required version

* Fix CI problems

* Increasing the minimum version

* go fmt

---------

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-14 18:33:22 +02:00
Jesús Espino
c9d49536f8
Adding SetFileSearchableContent plugin API endpoint (#24355)
* Adding SetFileSearchableContent plugin API endpoint

* Fixing CI problems

* Fixing CI problems

* Fixing CI problems

* Fixing CI problems

* Fixing CI problems

* Exposing it to the public API

* Fix CI problems

* Adding SetSearchableContent to the pluginapi File struct
2023-08-30 13:43:40 -07:00
Matthew Dorner
5de1e306de
Add UserHasBeenDeactivated plugin hook (#20894)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2023-08-30 08:55:20 +02:00
Christopher Poile
69c11cfe14
MM-53924 - Implement push notifications plugin hook and plugin api method (#24350)
* Revert "MM-52804 - Implement SendPushNotification plugin api method (#24273)"

This reverts commit 8418eefb75.

* Revert "MM-53924 - Implement NotificationWillBePushed plugin hook (#24263)"

This reverts commit f13a531bca.

* implement NotificationWillBePushed plugin hook

* implement SendPushNotification plugin api method

* move where we're setting post and channel type

* fix comment

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-08-24 12:33:53 -04:00
Christopher Poile
8418eefb75
MM-52804 - Implement SendPushNotification plugin api method (#24273)
* add SendPushNotification plugin api method

* lint; add testing.Short bc of the sleep

* add interface and generated layers

* add fields to PluginPushNotification; generate mocks

* SendPushNotification -> SendPluginPushNotification; improved comments

* more comments; fix test

* send api.ctx
2023-08-18 13:05:26 -04:00
Christopher Poile
f13a531bca
MM-53924 - Implement NotificationWillBePushed plugin hook (#24263)
* add NotificationWillBePushed hook

* mocks

* use a struct for hook parameters; simplify number of parameters sent across RPC

* missing wg.Wait

* change to a bool return value
2023-08-18 12:01:50 -04:00
Jesse Hallam
8abc8ed65c
MM-53358: Revert Threads Everywhere (#23882)
Remove changes related to the unshipped threads everywhere feature, including commits b8da473da7 and 9f9e19e05d.

Since a version of Playbooks shipped calling this experimental API, keep a `nil` implementation to avoid breaking compatibility. We remove the hooks altogether, but keep the numbering again to avoid breaking compatbility.

Fixes: https://mattermost.atlassian.net/browse/MM-53358
2023-06-30 15:31:25 -03:00
Claudio Costa
62a3ee8adc
[MM-52924] Implement ConfigurationWillBeSaved plugin hook (#23567)
* Implement ConfigurationWillBeSaved plugin hook

* Add comment

* Update comment

* Fix potential nil dereference if plugin environment is unset

* Address PR review
2023-06-12 18:23:02 -06: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