Commit Graph

171 Commits

Author SHA1 Message Date
Harrison Healey
3d0fd16666 MM-54640 Add API to get multiple emojis by name at once (#24651)
* MM-54640 Add API to get multiple emojis by name at once

* Fix status code when too many names are requested

* Address feedback

* Update unit tests

* Fix styling

* Fix more styling

* Fix mismatched i18n id
2023-10-17 12:03:28 -04:00
Jesse Hallam
0577a5aaa2 Fix OpenApi vetting (#23974)
* fix openApi vetting

The underlying mattermost-govet tool effectively hasn't been called for some time, as we weren't checking out and building the spec files to pass. Now that hte API is in the monorepo, build it locally and check against it.

Unfortunately, our API documentation isn't up-to-date, and this PR isn't fixing that. For now, add a discrete `make vet-api` and workflow that won't block the build until the API documentation is back in sync and can be merged into the existing `make vet` directive.

* mattermost-govet: use upstream@new

* fix missing /api/v4 prefix for commands autocomplete suggestion

* document /api/v4/ldap/users/{user_id}/group_sync_memberships

* document /api/v4/groups/{group_id}/restore

* fix /files/{file_id}/public actually at root

* document /api/v4/users/invalid_emails

* fix SetThreadUnreadByPostId

* Revert "fix SetThreadUnreadByPostId"

This reverts commit b16bcc8044.

* Revert "Revert "fix SetThreadUnreadByPostId""

This reverts commit 8bda05dc8a.

* workaround undocumented API endpoints

* remove unnecessary whiteline

* ignore go tool output

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-10-16 11:27:43 -03:00
js029
9698ab2119 Mm 24857 specific logger in post go (#24862)
Co-authored-by: js029 <js029@gmail.com>
2023-10-16 12:17:04 +02:00
Ben Schumacher
e4fa6200c3 [MM-45309] Replace github.com/mattermost/gziphandler with github.com/klauspost/compress/gzhttp (#24293) 2023-10-12 08:27:31 +02:00
Ben Schumacher
eb35e83152 [MM-54850] Use request-specific logger in channels/app/admin_advisor.go (#24859) 2023-10-12 08:23:57 +02:00
Agniva De Sarker
3dd9e3715c Goodbye, GraphQL (#24827)
```release-note
NONE
```
2023-10-12 09:47:35 +05:30
Deepayan Mukherjee
77ee4d93b7 [MM-24856] User request specific loggers in channels/api4/system.go (#24881)
* replace global mlog with local c.Logger and setInvalidParam with setInvalidParamWithErr if relevant

Signed-off-by: Deepayan Mukherjee <deepayanmukherjee1312@gmail.com>

* replace global mlog.Info with local c.Logger.Info

Signed-off-by: Deepayan Mukherjee <deepayanmukherjee1312@gmail.com>

---------

Signed-off-by: Deepayan Mukherjee <deepayanmukherjee1312@gmail.com>
2023-10-11 17:34:49 +02:00
Ben Schumacher
13c05a571f Migrate store methods to use request.Context instead of context.Context (#24836) 2023-10-11 13:08:55 +02:00
Ben Schumacher
0d5a8b8841 Add whitespace linter (#24855) 2023-10-11 10:13:36 +02:00
Ben Schumacher
aad25be4e1 [MM-54434] Use job.Logger to capture ldap logs (#24493) 2023-10-06 22:43:21 +02:00
Delaney Sylvans
d61364a24a [MM-54024] Handle JSON nulls when unmarshalling in api4 (#24656)
* handle JSON nulls when unmarshalling in api4

* catch more cases of unhandled JSON null

* fix lint issues

* remove unnecessary checks

* add bot tests for null values

* fix bot_test lint

* add channel null tests

* add group null tests

* add notify_admin null tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-10-05 19:25:59 +05:30
Caleb Roseland
b7f1a7f262 MM-52792: Update createPost, updatePost, & patchPost (#24195) 2023-10-03 09:51:07 -05: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
Caleb Roseland
9a3b503169 MM-54505: re-enable remote marketplace functionality (#24561) 2023-09-15 12:17:53 -05: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
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
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
Ben Schumacher
30b12f199b [MM-54132] Use annotated logger for log messages from jobs (#24275) 2023-09-07 08:50:22 +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
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
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
Caleb Roseland
818225dffe MM-52981, MM-53559: Streamlined in-product marketplace (#24311) 2023-08-25 14:39:25 -05:00
Ibrahim Serdar Acikgoz
639d73b3e7 api4/user: Deduplicate userids for getUsersByIds endpoint (#24344) 2023-08-24 15:14:01 +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
Christopher Poile
7b0b0d8609 MM-53764 - Fix: Improve limits on Opengraph Data Cache (#24177)
* enforce strict opengraph cache entry size limit

* move json marshalling and error checking into parsOpenGraphMetadata fn

* fix linting

* fix potential nil deref

* Revert "fix potential nil deref"

This reverts commit 095bcd496e.

* Revert "fix linting"

This reverts commit f3e1f7b276.

* Revert "move json marshalling and error checking into parsOpenGraphMetadata fn"

This reverts commit ba9a1e13b0.

* Revert "enforce strict opengraph cache entry size limit"

This reverts commit d1de4a8fa4.

* remove /opengraph api endpoint

* i18n

* removing unneeded action and reducer
2023-08-17 18:23:39 -04:00
Jesse Hallam
ad142c958e MM-53355: install transitionally prepackaged plugins to filestore (#24225)
* move plugin signature verification to caller

The semantics for when plugin signature validation is required are unique to the caller, so move this logic there instead of masking it, thus simplifying some of the downstream code.

* support transitionally prepacked plugins

Transitionally prepackaged plugins are prepackaged plugins slated for unpackaging in some future release. Like prepackaged plugins, they automatically install or upgrade if the server is configured to enable that plugin, but unlike prepackaged plugins they don't add to the marketplace to allow for offline installs. In fact, if unlisted from the marketplace and not already enabled via `config.json`, a transitionally prepackaged plugin is essentially hidden.

To ensure a smooth transition in the future release when this plugin is no longer prepackaged at all, transitionally prepackaged plugins are persisted to the filestore as if they had been installed by the enduser. On the next restart, even while the plugin is still transitionally prepackaged, the version in the filestore will take priority. It remains possible for a transitionally prepackaged plugin to upgrade (and once again persist) if we ship a newer version before dropping it altogether.

Some complexity arises in a multi-server cluster, primarily because we don't want to deal with multiple servers writing the same object to the filestore. This is probably fine for S3, but has undefined semantics for regular filesystems, especially with some customers backing their files on any number of different fileshare technologies. To simplify the complexity, only the cluster leader persists transitionally prepackaged plugins.

Unfortunately, this too is complicated, since on upgrade to the first version with the transitionally prepackaged plugin, there is no guarantee that server will be the leader. In fact, as all nodes restart, there is no guarantee that any newly started server will start as the leader. So the persistence has to happen in a job-like fashion. The migration system might work, except we want the ability to run this repeatedly as we add to (or update) these transitionally prepackaged plugins. We also want to minimize the overhead required from the server to juggle any of this.

As a consequence, the persistence of transitionally prepackaged plugins occurs on every cluster leader change. Each server will try at most once to persist its collection of transitionally prepackaged plugins, and newly started servers will see the plugins in the filestore and skip this step altogether.

The current set of transitionally prepackaged plugins include the following, but this is expected to change:
* focalboard

* complete list of transitionally prepackaged plugins

* update plugin_install.go docs

* updated test plugins

* unit test transitionally prepackged plugins

* try restoring original working directory

* Apply suggestions from code review

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* clarify processPrepackagedPlugins comment

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
2023-08-17 12:46:57 -03:00
Jesús Espino
5f7482e541 Remove remote users from the license counting and explicitly dissallow them to log in (#22582)
* Making all the counts aware of Remote users

* Disable login for remote users

* Adding tests for login remote_users error

* Adding tests for the store

* Adding frontend part of not counting remote users in the license

* Addressing PR review comment

* Adding the new ExternaUserId field to users

* Running make migrations-extract

* Running make app-layers and make gen-serialized

* Revert "Adding the new ExternaUserId field to users"

This reverts commit 12e5fd5189.

* Adding GetUserByRemoteID methods

* Adding needed migration for users

* i18n-extract

* Fixing postgres increase remote user id field size migration up and down

* run make gen-serialized

* Removing migration code

* Not count remote users as part of the cloud pricing

* Add the cloud subscription when a user gets promote from remote to not-remote

* Fixing merge problems

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-08-14 17:54:10 +02:00
Daniel Espino García
e9b3afecc2 Mark category as read (#24003)
* Mark category as read

* Fix lint and test

* Fix tests

* Fix test and remove wrong aria

* Address server issues and add mark as read for unreads

* Missing changes

* Fix tests

* fix tests

* Add confirmation popup to mark as read category

* Always use viewMultipleChannels and other fixes

* Remove unneeded code

* Fix test

* Address feedback

* Address feedback

* Fix tests

* Fix test

* Fix tests

* Update aria-haspopup depending on the number of channels to mark as viewed

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-08-14 10:01:02 +02:00
Ben Schumacher
7ecf6c0b5c [MM-53943] Remove deprecated UserAuth.Password field (#24213) 2023-08-09 10:35:53 +02:00
Jesse Hallam
62d49350e5 API Updates (#24105)
* fix missing /api/v4 prefix for commands autocomplete suggestion

* document /api/v4/ldap/users/{user_id}/group_sync_memberships

* document /api/v4/groups/{group_id}/restore

* fix /files/{file_id}/public actually at root

* document /api/v4/users/invalid_emails
2023-08-01 21:47:37 -03:00
Elias Nahum
aa88f8bf59 Add read_channel_content permission (#24118)
* Add read_channel_content permission

* fix tests

* update system console default permissions per role

* add read_channel_content to e2e defaultRolesPermissions

* Migration to include custom roles

* change deprecated isNotExactRole for isNotRole

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-31 09:12:53 -04:00
Ibrahim Serdar Acikgoz
2a4de2eecc Revert "Add read_channel_content permission (#24018)" (#24114)
This reverts commit a19ce047ba.
2023-07-25 13:17:58 +03:00
Harshil Sharma
26617fcbdc Remove insights (#23952)
* removed server side

* Updated store layer

* unused import

* Updated autogenerated code template

* Updated tests

* lint fix

* unused translations

* webapp side

* Updated i18n

* lint fix:

* type fix

* Updated snapshots

* Removed insights from API specs

* updated e2e

* Updated e2e tests

* Updated e2e tests

* Removed insights tests

* Removed Insights as possible channel to load in sidebar from test

* Removed more insights tests

* More e2e fixed

* More cleanup

* Lint

* More cleanup in client4 and boards api

* More cleanup

* Fixes

* lint fix

---------

Co-authored-by: maria.nunez <maria.nunez@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-25 12:34:38 +05:30
Elias Nahum
a19ce047ba Add read_channel_content permission (#24018)
* Add read_channel_content permission

* fix tests

* update system console default permissions per role

* add read_channel_content to e2e defaultRolesPermissions

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-24 09:37:59 -04:00
Jesse Hallam
89e65257a6 Remove command palette POC (#24044)
* Revert "POC: Cross-team recent search (#20027)"

This reverts commit aa59c28b04, preserving
a few code tidyings unrelated to the original PR.

* Revert "Add feature flag for command palette (#20011)"

This reverts commit c78c5ce3f3.
2023-07-24 10:31:06 -03:00
Julien Tant
077c16ef61 [MM-53454] Add export file settings + slash command for public link (#23915)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-19 13:01:39 -07:00
Nick Misasi
0b564005cf [MM-53702] Remove Downgrade Team Selection modal and all accompanying logic (#24059)
* Remove Downgrade Team Selection modal and all accompanying logic

* fix linter

* Fix i18n

* Final pipeline fixes
2023-07-19 09:35:14 -04:00
Sinan Sonmez (Chaush)
628273d98d MM42267: Add member count in the browse channel modal (#23800)
* add base for calling the endpoint

* add endpoint and handler

* update store and layers

* call the endpoint

* align types

* update app layers

* generate mocks

* complete handler

* finish store query

* add todos

* add ui for member count

* add selector

* add a todo

* add cache layer

* optimize calls in FE

* handle invalidation of the cache

* fix go style

* fix test

* use existing channel layer count

* fix import error

* delete unnecessary code

* write tests for channel cache layer

* fix testname

* fix mocks

* fix cache layer test

* fix a test

* really fix the test

* write more tests for server

* address PR comments

* remove comment

* rename more_channels to browse_channels

* fix style

* update snapshot

* add translations

* Revert "add translations"

This reverts commit 56476a5dab.

* add only related translations

* address PR review points

* add test

* fix test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-19 11:45:27 +05:30
Miguel de la Cruz
150c6e7aef Remove boards product references (#23855)
Automatic Merge
2023-07-18 15:17:29 +03:00
Devin Binnie
823ef27d6c Revert "[MM-37984] Allow Desktop App to authenticate via external providers outside of the app on supported servers (#23795)" (#24039)
This reverts commit abdf4e58c3.
2023-07-17 10:54:53 -04:00
Doug Lauder
a8244e9d10 MM-53147 Support for embedding Mattermost in an MSTeams iframe (#23776)
* add teams to allowed frame-ancestors

* fix unit tests

* set SameSite attribute for session cookie

* further restrict ancestors

* skip landing page if in iframe

* Only set cookie SameSite=None if embedded in iframe

* don't set MMEMBED cookie on landing page (check only)

* fully parse MMEMBED cookie

* add comment

* more comments

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-12 17:55:13 -04:00
Devin Binnie
abdf4e58c3 [MM-37984] Allow Desktop App to authenticate via external providers outside of the app on supported servers (#23795)
* WIP

* Add rate limiting for desktop token API

* Missing mocks

* Style fixes

* Update snapshots

* Maybe use an actual redirect link :P

* Refactoring for tests

* Add tests for server

* Fix lint issue

* Fix tests

* Fix lint

* Add front-end screen component

* Component logic

* Style changes

* Quick style fix

* Lint fixes

* Initial PR feedback

* Enable logging into the browser as well when completing the login process

* Refactor to push more logic to the other component

* Remove unnecessary helper code

* Fix i18n

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-12 09:25:05 -04:00
Scott Bishel
30140c0a27 MM-53098 Fix for checking bot and user permissions on shared endpoints (#23751)
* temp commit

* update test to allow bot creation

* add bot check to updateUser and deleteUser

* add more unit tests

* lint fixes

* lint fix

* update based on doc

* add more unit tests

* lint fixes

* fix unit tests

* fix unit tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-10 13:28:40 -06:00