Commit graph

38 commits

Author SHA1 Message Date
Ben Schumacher
b2df9be70b
Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
Eva Sarafianou
3ac4a73c63
[MM-65837], [MM-65824] - Update Dependencies (#33972)
* Update github.com/mholt/archives

* Update github.com/spf13/viper

* make batch migration worker tests less flaky

---------

Co-authored-by: Jesse Hallam <jesse@mattermost.com>
2025-10-01 20:19:22 +00:00
Ben Schumacher
18eb1347db
[MM-64900] Migrate to use request.CTX instead of context.Context (#33541)
* Migrate GetRoleByName

* Migrate users GetUsers

* Migrate Post and Thread store

* Migrate channel store

* Fix TestConvertGroupMessageToChannel

* Fix TestGetMemberCountsByGroup

* Fix TestPostStoreLastPostTimeCache
2025-09-18 16:14:24 +02:00
David Krauser
c0ff672afb
[MM-64840] Add EmailNotificationWillBeSent Plugin Hook (#33421) 2025-08-05 09:09:07 -04:00
Ben Schumacher
9add320011
[MM-64654] Migrate to modern Go features (#31820) 2025-07-18 12:54:51 +02:00
Claudio Costa
611b2a8e79
[MM-62408] Server Code Coverage with Fully Parallel Tests (#30078)
* TestPool

* Store infra

* Store tests updates

* Bump maximum concurrent postgres connections

* More infra

* channels/jobs

* channels/app

* channels/api4

* Protect i18n from concurrent access

* Replace some use of os.Setenv

* Remove debug

* Lint fixes

* Fix more linting

* Fix test

* Remove use of Setenv in drafts tests

* Fix flaky TestWebHubCloseConnOnDBFail

* Fix merge

* [MM-62408] Add CI job to generate test coverage (#30284)

* Add CI job to generate test coverage

* Remove use of Setenv in drafts tests

* Fix flaky TestWebHubCloseConnOnDBFail

* Fix more Setenv usage

* Fix more potential flakyness

* Remove parallelism from flaky test

* Remove conflicting env var

* Fix

* Disable parallelism

* Test atomic covermode

* Disable parallelism

* Enable parallelism

* Add upload coverage step

* Fix codecov.yml

* Add codecov.yml

* Remove redundant workspace field

* Add Parallel() util methods and refactor

* Fix formatting

* More formatting fixes

* Fix reporting
2025-05-30 13:58:26 +02:00
Claudio Costa
7c25de2cff
[MM-63345] Address Go v1.23 incompatibility issues with plugins (#30386)
* Address Go v1.23 incompatibility issues with plugins

* Install multiple Go versions for compatibility tests

* Rename
2025-03-11 17:44:42 +00:00
Harshil Sharma
6e5a67caec
Feature edit attachments (#29769)
* Updated patch/update post API to allow file modification (#29447)

* WIP

* WIP

* Atatched new files ton post

* WIP: deleting removed files

* Deleted removed files and invalidated file metadata cache

* removed file ignore logif from update post API

* Added TestFindExclusives

* Added tests for DeleteForPostByIds

* Added app layer tests

* Added tests

* Added API level tests

* test enhancements

* Fixed a test

* Edit history include file metadata (#29505)

* Send file metadata in edit history metadata

* Added app tests

* Added store tests

* Added tests for populateEditHistoryFileMetadata{

* Added cache to avoid repetitigve DB calls for edits with only message changes

* Added API tests

* i18m fix

* removed commented code

* Improved test helper

* Show attachments in edit history RHS (#29519)

* Send file metadata in edit history metadata

* Added app tests

* Added store tests

* Added tests for populateEditHistoryFileMetadata{

* Added cache to avoid repetitigve DB calls for edits with only message changes

* Added API tests

* i18m fix

* WIUP: displa files in edit

* removed commented code

* Displayed file in edit history

* Handled file icon

* Fixed closing history component on clicking on file

* Simplified selector

* Simplified selector

* Improved test helper

* Disabled action menu on edit history file

* Added tests

* Improved selector

* Updated snapshot

* review Fixes

* restructured componnets

* Updated test

* Updated test

* Restore post api (#29643)

* Restore post version API WIP

* Undelete files WIP

* Added store tests

* Created post restore API

* Updated updatepost safeUpdate signature

* review fixex and improvements

* Fixed an app test

* Added API laer tests

* Added API tests and OpenAPI specs

* Fixed a typo

* Allow editing files when editing posts (#29709)

* WIP - basic view files when editing post

* Cleanup

* bg color

* Added text editor tests for files

* WIP

* WIP

* removed debug log

* Allowed admin to add and remove files on someone else's post

* Handled drafts and scheduled posts

* linter fixes

* Updated snapshot

* server test fix

* CI

* Added doc

* Restore post api integration (#29719)

* WIP - basic view files when editing post

* Cleanup

* bg color

* Added text editor tests for files

* WIP

* WIP

* removed debug log

* Allowed admin to add and remove files on someone else's post

* Handled drafts and scheduled posts

* linter fixes

* Updated snapshot

* server test fix

* Used new API to restore post

* handled edut limit and undo

* lint fix

* added comments

* Fixed edit post item tests

* Fixed buttons

* Aded snapshots

* fix test

* Updated snapshot

* Minor fixes

* fixed snapshot

* Edit file dnd area (#29763)

* dnd wip

* DND continued

* Supported multiple unbind dragster funcs

* lint fixes

* Got center channel file drop working when editing a post

* file dnd working with center channel and rhs

* file dnd working with center channel and rhs

* removed unneeded stopPropogation calls

* cleanup

* DND overlay fix

* Lint fix

* Advanced text editor test updates for file upload overlay

* fixed use upload hook tests

* Updated some more snapshots

* minor cleanup

* Updated i18n

* removed need of array for dragster unbind events

* lint fixes

* edit history cursor

* Fixed bugu causing faliure to delete empty posts (#29778)

* Files in restore confirmation (#29781)

* Added files to restore post confirmation dialog

* Fixed post restore toast colors

* Fixed restore bug

* Fixed restore confirmation toast tests

* a11y improvement and modal width fix

* Edit attachment misc fixes (#29808)

* Removed single image actions in restore post confirmation dialog

* Fixed file drop overlay size and position

* Made edit indiator accessible

* Lint fix

* Added bunch of more tests

* ANother test migrated from enzyme to react testing library

* More test enhancements

* More test enhancements

* More test enhancements

* lint fixes

* Fixed  a test

* Added missing snapshots

* Test fixes
2025-01-13 18:16:56 +05:30
Ben Schumacher
053d0b5f0a
[MM-61140] Allow plugins to add Support Packet data without UI elements (#28833)
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2024-11-13 11:20:39 +01:00
Arya Khochare
373e21c5a1
Fixed errcheck issues in server/channels/app/plugin_hooks_test.go (#29059) 2024-11-05 15:36:19 +01:00
Daniel Espino García
2d96053012
Use flags for create post (#28857)
* Use flags for create post

* Remove unintended file

* Fix unintended change and types

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-10-22 16:00:26 +02:00
Agniva De Sarker
6f3327ce0f
MM-58038: Use context to call master for DeletePost (#27098)
Calling app.DeletePost immediately after creating a post
is susceptible to replica lag because we were calling the
replica to check for the post.

We fix this by passing a context to always query master.

https://mattermost.atlassian.net/browse/MM-58038

```release-note
NONE
```
2024-05-24 19:35:48 +05:30
Agniva De Sarker
dc3e5b9269
MM-57532: Improve timeouts for some tests (#26642)
- Bump timeouts for some cases
- Improve sleep with require/assert.EventuallyT
for better performance and reliability.

https://mattermost.atlassian.net/browse/MM-57532

```release-note
NONE
```
2024-04-05 19:28:49 +05:30
Harshil Sharma
b02d634916
User limit enforcement (#26511)
* Added hard limits when creating user

* Added check to user activation

* Added missing check for licensed servers

* Fix i18n

* Fixed style order

* Added a separate hard limit along with existing 10k user soft limit

* For CI

* Fixing flaky test, hopefully

* Added tests
2024-03-21 19:41:53 +05:30
Agniva De Sarker
204c728b08
MM-56879: Migrate caches from store layer to cache layer (#26255)
There were 3 remaining caches which were there in the store layer.
We migrate them to make the store layer fully free
from any caches.

https://mattermost.atlassian.net/browse/MM-56879

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-03-07 10:55:28 +05:30
Harrison Healey
d5446cd25e
MM-56948 Fix flaky TestUserHasJoinedChannel (#26359)
* MM-56948 Fix flaky TestUserHasJoinedChannel

* Add comment explaining flakiness
2024-03-04 20:16:56 +00:00
Harrison Healey
7d9f725d90
MM-56776 Call ChannelHasBeenCreated plugin hook for GMs (#26226) 2024-02-16 09:47:08 -05:00
Ben Schumacher
de3e5aab25
[MM-53156] Remove Multi-Product architecture (#25669) 2024-02-15 13:01:44 +01:00
Harrison Healey
4ac345cc56
Add some tests for plugin hooks used by MS Teams plugin automute (#26144)
* Confirm that plugins can trigger their own PreferencesHaveChanged hook

* Add tests for ChannelHasBeenCreated hook

* Convert new tests to use assert.Eventually

* Add tests for UserHasJoinedChannel hook

* Bypass linter for a case where t.Fatal is needed
2024-02-13 16:39: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
KIMBOH LOVETTE
a6ba7163c8
[GH-21566] Add request context and logger to all public methods in server/channels/app/authentication.go (#25270) 2023-11-08 14:39:09 +01:00
Ben Schumacher
b0bf5d0765
[MM-55053] Use request-specific logger in channels/app/file.go (#25037) 2023-11-07 10:04:16 +01:00
Ben Schumacher
486e836b83
Fix racy test issues (#24971) 2023-11-06 12:26:17 +01: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
13c05a571f
Migrate store methods to use request.Context instead of context.Context (#24836) 2023-10-11 13:08:55 +02: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
Ben Schumacher
30b12f199b
[MM-54132] Use annotated logger for log messages from jobs (#24275) 2023-09-07 08:50:22 +02:00
Felipe Martin
9f7521d003
Move request package into public/shared folder (#24420)
* move request package to public/shared

* updated app-layers

* update app layer

* remove original package location
2023-09-05 09:47:30 +02: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
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
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
Jesse Hallam
f28a2bcca7
server/public/ -- pre-requisite changes (#23278)
* invert depdendency: filestore -> model

* markdown: nolint:misspell

* inline jsonutils within model

* push model.GetInfoForBytes -> channels/app

* push channel/utils.CompileGo* -> plugin/utils

* push plugin/scheduler -> channels/jobs/plugins

* push utils.Copy(File|Dir) -> model

* oauthproiders/gitlab -> channels/app/oauthproviders/gitlab

* decouple plugin from einterfaces.MetricsInterface

* fix TestGetInfoForFile

* Revert "Run golangci in server CI (#23240)"

This reverts commit 349e5d4573.

* add model/utils

---------

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2023-05-09 13:30:02 -03:00
Harrison Healey
d001994ef9
MM-52282 Remove ExperimentalSettings.PatchPluginsReactDOM (#23172)
* MM-52282 Remove ExperimentalSettings.PatchPluginsReactDOM

* Fix missing file from last commit

* Fix test usage of plugin.NewEnvironment
2023-05-03 15:04:10 -04:00
Miguel de la Cruz
067e36c23c
Enable products for tests (#22757)
* Enable products for channels tests

* increase unit test timeout; check IsConfigReadOnly

* make app-layers

* Avoid loading boards tempaltes between tests to improve speed

* Fix delete query to be compatible with both databases

* Avoid preserving the templates for boards store tests

* Run all tests in one command

* Revert "Run all tests in one command"

This reverts commit 0330f7cd8f.

* concurrent pkg group tests in CI

* Revert "Revert "Run all tests in one command""

This reverts commit 73892fec77.

* Revert "concurrent pkg group tests in CI"

This reverts commit 550fb6cdd4.

* try testing 3 subsets of packages concurrently to improve time taken

* Revert "try testing 3 subsets of packages concurrently to improve time taken"

This reverts commit 97475f3c4e.

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: wiggin77 <wiggin77@warpmail.net>
2023-04-18 13:58:33 +02:00
Agniva De Sarker
b200a07881
v8.0 module release (#22975)
https://mattermost.atlassian.net/browse/MM-52079

```release-note
We upgrade the module version to 8.0. The new module path is github.com/mattermost-server/server/v8.
```


Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
2023-04-18 11:05:28 +05:30
Doug Lauder
c943ed6859
Mono repo -> Master (#22553)
Combines the following repositories into one:

https://github.com/mattermost/mattermost-server
https://github.com/mattermost/mattermost-webapp
https://github.com/mattermost/focalboard
https://github.com/mattermost/mattermost-plugin-playbooks
2023-03-22 17:22:27 -04:00
Renamed from app/plugin_hooks_test.go (Browse further)