Commit Graph

415 Commits

Author SHA1 Message Date
Ben Schumacher
845ea2a984 [MM-54290] Add CPU profile to support package (#24477) 2023-09-25 11:00:33 +02:00
Ben Schumacher
153ebc31d7 [MM-54289] Add heap profile to support package (#24476) 2023-09-25 09:46:15 +02:00
Daniel Espino García
88d043a971 Make GM behave as DM (#24289)
* Make GM behave as DM

* Fix lint

* Add desktop notification special behavior

* Change notification preferences menu

* Make changes to the GM channel intro

* Fix tests

* Fix i18n and style lint

* Add system notice and update style

* Fix style and fix tests

* Fix tests

* Handle push notifications as desktop notifications

* Fix tests

* Add test and default GMs to none when user level config is none

* Fix test

* Update only for mentions text

* Add tests

* Fix lint

* Fix lint
2023-09-19 15:29:57 +02:00
Harshil Sharma
39d6cb8008 MM-53125 Add feature to convert group message to private channel (#24421)
* Added convert to channel menu item

* WIP

* refactored channel name input field and created conversion modal

* style

* style

* WIP

* wip

* Created API to fetch common teams of GM members

* Added UI for all members deactivated

* Fetched common teams in client

* WIP

* Added a required attribute to DropdownInput component

* Fixed a case with dropdown input required flag

* WIP

* API first draft

* Genetayed layers and mocks

* Fixed create channel bug

* WIP

* Added cache invalidation

* Calling API from client

* Updated API to accept name and display name as well

* WIP

* Moved converted GM to correct category

* Style fixes

* Added logic to move user to new team/channel after GM conversion

* Prevented guest user from performing action

* Added loading indicator

* Added smoother height transistion when loading finishes

* UI imporvements

* WIP

* Formatted GM conversion message on client side

* lint fix

* Moved convert option from sidebar menu to channel header menu

* Some cleanup

* Updated server layers

* Fixed i18n

* Fixed types

* Fix server i18n

* Fixed channel creation bug

* Added store test for GetCommonTeamIDsForMultipleUsers

* Server tests done

* Updated snapshots

* Updated layers

* lint fix

* Update tests

* For CI

* lint

* restored debug code

* Used user ID instead of username in channel conversion post

* WIP

* Review fixes

* LInt fixes

* Test fix

* WIP

* WIP

* WIP

* wip

* Review fixes, lots of them

* Review fix

* Disabled WIP test

* test

* Cleanup

* Test fix

* removed testing line

* Fixed incorrect default message

* Review fixes

* Fixes

* lint and i18n fix

* Setting category on server side

* updated i18n

* Updated tests

* Added tests

* Refs cleanup

* added test

---------

Co-authored-by: Harshil Sharma <harshilsharma@Harshils-MacBook-Pro.local>
2023-09-19 14:41:34 +02:00
Devin Binnie
11cdd2b66b Fix flaky/incorrect desktop token test, clarify the parameter names (#24565)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-19 08:49:51 +02:00
Caleb Roseland
9a3b503169 MM-54505: re-enable remote marketplace functionality (#24561) 2023-09-15 12:17:53 -05:00
Scott Bishel
64fabbeed3 MM-54123 Add group slash command (#24553)
* adding group members to channel initial commit

* adding group to channel functionality along with add new team members

* fixing circular dependency

* fixing e2e and other optimizations

* adding e2e tests for adding group members to channels

* cypress lint

* fixing comments

* adding count to button

* improvements

* adjusting some stuff from PR comments

* remove ability to add user to team, update message for non-team members

* remove adding to team from add groups functionality

* update misspelled variable

* lint and unit test fixes

* add tests, cleanup

* lint fix

* revert package-lock.json

* fixes for cypress tests

* rename TeamInviteBanner to TeamWarningBanner, since invites are no longer allowed

* update for warning

* lint fixes

* cleanup

* fix failing e2e tests

* update slash command for user groups

* revert package-lock

* remove unused function

* update based on feedback

* update tests for last change

* i18n-extract, reorder

* retrieve and display user name

---------

Co-authored-by: Benjamin Cooke <benkcooke@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-15 11:00:41 -06: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 Cooke
bc4904e5b3 MM-54123 Add group to channel (#22954)
* adding group members to channel initial commit

* adding group to channel functionality along with add new team members

* fixing circular dependency

* fixing e2e and other optimizations

* adding e2e tests for adding group members to channels

* cypress lint

* fixing comments

* adding count to button

* improvements

* adjusting some stuff from PR comments

* remove ability to add user to team, update message for non-team members

* remove adding to team from add groups functionality

* update misspelled variable

* lint and unit test fixes

* add tests, cleanup

* lint fix

* revert package-lock.json

* fixes for cypress tests

* rename TeamInviteBanner to TeamWarningBanner, since invites are no longer allowed

* update for warning

* lint fixes

* cleanup

* fix failing e2e tests

* update messages to not use markdown

---------

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-14 08:43:44 -06:00
Claudio Costa
b4a47803e6 [MM-54456] Fix potential read after write issue when loading license (#24524)
* Fix potential read after write issue when loading license

* Use upsert
2023-09-13 14:47:12 -06:00
Felipe Martin
f65dad83bb Migrate emojiStore to use request.CTX instead of context.Context (#24514)
* migrate emojistore to request.ctx

* use mlog.CreateConsoleTestLogger

* Add comment to WithMaster and RequestContextWithMaster
2023-09-11 17:07:29 +02:00
David Janda
6e6668b88b [GH-16800]: Refactor raw SQL to query builder in group_store.go - part 2 (#24254)
* Use builder in GetMember

* Use query builder in GetByUser

* Use query builder in GetMemberUsers

* Use query builder in GetNonMemberUsersPage

* Use query builder in PermanentDeleteMembersByUser

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-11 15:17:26 +03:00
Sinan Sonmez (Chaush)
71fb10ae7a MM-54260: In Browse Channel Modal fix member count on private channels and when there is only 1 member in the channel (#24452) 2023-09-09 14:47:06 +05:30
Doug Lauder
5e7d1c6f9e MM-37511 Add userid to http logs (#24516)
* include user_id in http logs
2023-09-08 18:24:34 -04:00
Ben Schumacher
42e988132c [MM-46134] Add additional checks for PostStore/PostgreSQL/GetForThread/Pagination (#24458)
* Use require

* Add additonal length checks

* Remove Skip

* Manually set CreateAt
2023-09-08 16:50:53 +02:00
Ben Schumacher
a32e793982 Fix logger panic in migration scheduler (#24509)
Automatic Merge
2023-09-08 17:27:36 +03:00
Scott Bishel
15faf4a69c update to use AppError.Where() to differentiate errors (#24379)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-08 08:17:58 -06:00
David Janda
afeeacb94a Use GetBuilder and SelectBuilder to remove some boilerplate in group_store.go (#24255) 2023-09-07 18:28:39 +03:00
Agniva De Sarker
acdfefe456 Revert "MM-53879: Fix recursive loading of license (#24200)" (#24498)
This reverts commit dd73c2af0f.
2023-09-07 20:58:20 +05:30
Ibrahim Serdar Acikgoz
0e84ccb383 Bump Go version to v1.20 (#24439) 2023-09-07 13:06:18 +03:00
Ben Schumacher
30b12f199b [MM-54132] Use annotated logger for log messages from jobs (#24275) 2023-09-07 08:50:22 +02:00
Ben Cooke
791ee40568 [MM-53291] Data retention improvements (#24253)
* adding new migration for RetentionIdsForDeletion, changing logic for deleting orphaned reactions. Updating delete user and channel endpoints to remove respective reactions
2023-09-06 08:25:27 -04:00
Ben Schumacher
b2f36c7cdf [MM-54318] Add file storage information to support package (#24474)
* Reorder stats in support package struct

* Add file storage information to support package

* Add clusterID

* Change method name to DriverName

* Ordering

* Fix test
2023-09-06 09:21:25 +02:00
Agniva De Sarker
4482ba0fd0 MM-43341: Allow test to run (#24470)
When I fixed the flaky test in https://github.com/mattermost/mattermost/pull/20140,
I actually forgot to uncomment this line to allow the test to run.

Thanks to @hanzei for spotting this.

https://mattermost.atlassian.net/browse/MM-43341
```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-06 10:39:58 +05:30
Ben Schumacher
2c893d8c05 [MM-43252] Fix flaky TestPreparePostListForClient (#24407)
* Fix flaky TestPreparePostListForClient

* Ignore order of returned elements

* Revert timeout increase
2023-09-06 07:07:58 +02:00
Christopher Poile
b6f2c8205e MM-54219 - Fix: Improve limits on redirectLocationDataCache (#24429)
* ignore redirect locations over certain length

* maybe the link isn't necessary

* remove unrelated debugging line

* PR comments
2023-09-05 14:04:14 -04:00
KyeongSoo Kim
de000e888d MM-53687: Block changes to name, display name or purpose for direct and group messages (#24199)
* block changes to name, display name or purpose for direct and group messages

* add test

* fix condition

* update patch_channel

* update error message

* fix message

* fix lint

* fix i18n

```release-note
NONE
```

---------

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-05 15:00:32 +05:30
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
Ben Schumacher
01e7e96448 Migrate to idiomatic error handling in support_package.go (#24382) 2023-09-04 19:36:46 +02:00
Ben Schumacher
918fff378d [MM-47612] Fix flaky TestPluginAPIDeleteUserPreferences (#24406) 2023-09-04 10:41:05 +02:00
Pablo Andrés Vélez Vidal
4f0f3845e4 MM-54182 - add correct information to session table from mobile devices (#24353)
* MM-54182 - add correct information to session table from mobile devices

* improve comments around helper function

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-09-01 14:25:07 +02:00
Jian Lim
8c2fc88471 Refactor: func StringInSlice to slices.Contains (#24262)
* Refactor: Use generic to change func StringInSlice to Contains

* Refactor: Use generic to change func stringNotInSlice to Contains

Make utils.go (dir server/public/utils) and func Contains

* Refactor: Move func Contains from channels/utils to public/utils

Move func Contains from channels/utils to public/utils

Fix import declarations line

* Docs: Add a description of the Contains function

* Test: add TestContains

Add a test code for a Contain function
2023-09-01 12:35:27 +05:30
Ben Cooke
2c6179a0a6 Restore previously archived groups (#22597)
* add ability to restore groups from the user group modal

* factory selector for groups to reduce number of renders across the app

* react window and infinite scroll for user groups

* adding archive groups to dropdown

* restore user group from the view modal

* component cleanup

* lint

* adding websocket for archiveGroup

* updating tests

* adding some tests and fixing types

* lint

* fixing broken test

* fixing snapshot

* fixing infinitescroll

* lint

* increasing max-height and updating snapshots

* fixing PR comments

* fixing case for button

* snapshot and translation

* fixing PR comments

* tiding up repition and creating new hook

* fixing tests

* add additional parammeter for call to getGroups()

* make sure popup is visible for all rows

* update text for admin console

* update css for lint

* fix edge cases found in review

* revert package-lock.json

* revert adding query to GetGroupsParam

* fixing lint

* change include_archived to false in team_controller

---------

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-08-31 08:07:51 -06: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
Agniva De Sarker
b84236d555 MM-49627: Suppress transformation of embedded images via image proxy (#24401)
There was no check for embedded images which made "copy text" paste
the siteURL instead of the actual image content.

This does not change the behavior of actually rendering the image
which is how other sites behave as well.

https://mattermost.atlassian.net/browse/MM-49627
```release-note
NONE
```
2023-08-30 22:33:42 +05:30
Agniva De Sarker
fc9a9d1d41 MM-53410: Avoid antijoin for channelstore.channelSearchQuery (#24400)
https://mattermost.atlassian.net/browse/MM-53410
```release-note
NONE
```
2023-08-30 21:10:01 +05:30
Devin Binnie
a3b194581f [MM-37984] Allow Desktop App to authenticate via external providers outside of the app on supported servers (#24140)
* [MM-37984] Allow Desktop App to authenticate via external providers outside of the app on supported servers

* PR feedback

* Add support for mattermost-dev protocol for development use

* Update server/channels/db/migrations/postgres/000110_create_desktop_tokens.up.sql

* Fix silly typo

* Update server/channels/db/migrations/postgres/000110_create_desktop_tokens.up.sql

* Remove storage of client token, only validate it on the client

* Update migrations

* Add concurrently create index

* Remove CONCURRENTLY for now

* Fix issue with changing history

* Remove old migration

* Use idempotent statement to drop old index

* Remove reference to old table
2023-08-30 11:21:43 -04:00
Ben Schumacher
983a965cb7 [MM-52088] Fix flaky draft tests (#24405) 2023-08-30 12:52:37 +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
Doug Lauder
84b52333c1 MM-53165 Add X-Forwarded-For header to audit for rest api calls (#24390)
* Add X-Forwarded-For header to audit for rest api calls

* fix unit test
2023-08-28 07:24:55 -04:00
Scott Bishel
0a499770e6 Add additional unit test for bot/user access (#24206)
* add unit test

* add unit test

* add unit test

* update additional test
2023-08-28 11:59:42 +02:00
Julien Tant
9d569df9b4 [MM-22133] Allow exporting and importing archived channels (#23724) 2023-08-25 17:55:47 -07:00
Elias Nahum
f787fd6336 Sanitize user in update user response (#24362) 2023-08-25 19:31:48 -04:00
Caleb Roseland
818225dffe MM-52981, MM-53559: Streamlined in-product marketplace (#24311) 2023-08-25 14:39:25 -05: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
Ibrahim Serdar Acikgoz
639d73b3e7 api4/user: Deduplicate userids for getUsersByIds endpoint (#24344) 2023-08-24 15:14:01 +03:00
Agniva De Sarker
555009aa82 Bumping up migration number to 111 (#24341)
PR https://github.com/mattermost/mattermost/pull/24039 was reverted
which left an erroneous migration 110. So to workaround this,
we create a new migration with number 111.

```release-note
NONE
```
2023-08-23 21:15:53 +05:30
Matthew Straughn
2e449413e8 fixed initialism errors in accordance with golang conventions in 7 files. (#24287) 2023-08-22 10:15:51 +03:00
Agniva De Sarker
5c33f51b03 Add missing return (#24288)
```release-note
NONE
```
2023-08-21 16:53:36 -04:00
Agniva De Sarker
dd73c2af0f MM-53879: Fix recursive loading of license (#24200)
There were multiple problems with loading of a license.

1. It was called from inside app/server.go and app/platform/service.go. The first one wasn't really needed anymore, so we remove it.

2. To make loading of a license work across a cluster, the license load action was attached along with the `InvalidateAllCachesSkipSend` method. But the problem with that was that it would even get called in the caller node as well, putting it in a recursive loop.

```
LoadLicense -> SaveLicense -> InvalidateAllCaches -> InvalidateAllCachesSkipSend -> LoadLicense
```

To fix this, we create a dedicated loadLicense cluster event and move it away from the `InvalidateAllCachesSkipSend` method. And then from the caller side, we just trigger this action.

3. We also remove the first call to check license expiration which would load the license again. This is unnecessary because if the license is expired, server wouldn't start at all.

While here, we also make some other improvements like removing unnecessary goroutine spawning while publishing websocket events. They are already handled asynchronously, so there is no need
to create a goroutine for that.

We also remove

```
ps.ReloadConfig()
ps.InvalidateAllCaches()
```

from requestTrialLicense as they are already called from inside `*PlatformService.SaveLicense`.

And lastly, we remove the `*model.AppError` return from `*PlatformService.InvalidateAllCaches` because there was nothing to return at all.

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

```release-note
Fix several issues with loading of a license
```
2023-08-21 20:17:16 +05:30