Commit graph

268 commits

Author SHA1 Message Date
Miguel de la Cruz
809ad4f76d
Adds Remote Cluster related API endpoints (#27432)
* Adds Remote Cluster related API endpoints

New endpoints for the following routes are added:

- Get Remote Clusters at `GET /api/v4/remotecluster`
- Create Remote Cluster at `POST /api/v4/remotecluster`
- Accept Remote Cluster invite at `POST
/api/v4/remotecluster/accept_invite`
- Generate Remote Cluster invite at `POST
/api/v4/remotecluster/{remote_id}/generate_invite`
- Get Remote Cluster at `GET /api/v4/remotecluster/{remote_id}`
- Patch Remote Cluster at `PATCH /api/v4/remotecluster/{remote_id}`
- Delete Remote Cluster at `DELETE /api/v4/remotecluster/{remote_id}`

These endpoints are planned to be used from the system console, and
gated through the `manage_secure_connections` permission.

* Update server/channels/api4/remote_cluster_test.go

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>

* Fix AppError names

---------

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-07-04 10:35:26 +02:00
Scott Bishel
0dbef88cfc
MM-58771 - Make manage_server permission, non updatable (#27481)
* make manage_server, non updatable

* remove blank line
2024-07-03 12:41:20 -06:00
Scott Bishel
b78175c390
require Permission to user to mark channels as read (#27468) 2024-07-02 13:35:43 +02:00
Scott Bishel
817e18414e
require regenerate invite id to have invite permission (#27427) 2024-06-26 12:41:26 -06:00
Scott Bishel
6fd894953c
update for adding multiple members (#25128)
* update for adding multiple members

* fix unit test

* more test fixes

* add another unit test

* fix object passed by client4

* revert package-lock.json

* revert package-lock.json

* add length check

* limit size of lists in API requests

* revert package-lock

* add batching to front end

* add batching to front end

* fix bad merge

* update return type

* remove unnecessary permisssion check, add unit test

* fixes and add tests from review

* revert changes adding limits to other apis

* fixes

* clean-up from code review

* fix unit test call

* revert back to interface{}, fix unit test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-25 12:25:28 -06:00
Doug Lauder
6773d13dee
MM-58255 Ensure remote users do not get valid email addresses (#27421)
* remote users don't get valid email addresses; remote users cannot have access tokens

* block notification emails for remote users

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-25 09:26:08 -04:00
Arya Khochare
a8b18ac807
MM-57013 Added download button for downloading logs from server logs page in system console (#26389)
* added download system logs

* download all logs

* download all logs check-lint fix

* check lint fix

* download logs api

* download logs api working

* download logs working with error log

* linting issues and code cleanup

* CI check fix

* documented the api and logs from file with error handling

* test and final changes done

* final changes done

* Fix order of server-side translations

* Fix incorrect indentation of logs.yaml

---------

Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
2024-06-24 14:05:23 -04:00
Miguel de la Cruz
d490fdc1d9
Marks the RemoteTeamId field of RemoteClusters as deprecated (#27364)
* Marks the RemoteTeamId field of RemoteClusters as deprecated

The `RemoteTeamId` was used both in the `RemoteCluster` model and as
part of remote invites. It existed so two different remotes could have
multiple secure connections between them, and have each of those
connections scoped to a team, sharing through each only the channels
that belong to their corresponding team.

The way that we're thinking on the feature currently only contemplates
one secure connection between two servers, and shares all the
channels through that secure connection, so this field is no longer
needed.

As we don't have a system in place for the user to choose in which
team a channel should be created from an invite, this change adds a
mechanism that checks the invite for a teamId, and if it's not
present, fetches a team from the database to create the channel
into. This makes the change backwards compatible for secure
connections that already have an established behavior and allows us to
move forward with the implementation of an alternative.

* Mark invite teamId field as deprecated

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-22 23:08:55 +02:00
Matheus
cbd5d95bbb
[MM-57988] Fix move thread logic to not block channel admins (#27061)
* mm-57988: Allowing for channel admins to move thread

* Fix the MoveThread team admin unit test that was introduced

* Renaming the hasPermittedRole function to hasPermittedWranglerRole

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-18 13:41:49 -04:00
Ben Cooke
9187c772b6
[MM-56074] mmctl job commands (#26855)
* add job list and update  job status command to mmctl
2024-06-17 12:07:05 -04:00
Claudio Costa
4b0ae20ef7
Pass remote address in WebSocketMessageHasBeenPosted plugin hook (#27332) 2024-06-13 09:01:49 +02:00
Doug Lauder
d40cc68b1c
MM-58349 Don't allow remote user to create sessions or reset password (#27215)
Automatic Merge
2024-06-03 17:11:30 +03:00
Miguel de la Cruz
b00b68920d
Fix test that is not using context (#27164) 2024-05-27 11:38:07 +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
Miguel de la Cruz
cd81b199b7
Cleans RemoteId when sanitizing post input from the API (#27049)
* Cleans RemoteId when sanitizing post input from the API

* Fix require check

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-23 14:29:19 +02:00
Miguel de la Cruz
a4afae5b3b
Adds RemoteId to the fields to clean when coming from the API (#27047)
* Cleans the RemoteId when creating a user through the API

* Replace bad usage of the API with an App call in tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-22 11:20:02 +02:00
Harrison Healey
b9f7d38cb1
MM-58281 Change performance timestamps to be floats (#27046)
* MM-58281 Change performance timestamps to be floats

* Commit missed line
2024-05-17 13:52:03 -04:00
Doug Lauder
5a79565244
Check user belongs to remote when updating profile image (#27008) 2024-05-16 08:21:12 -04:00
Harrison Healey
8f9d1b802c
MM-58263 Remove CSRF check from /api/v4/client_perf (#27011)
We use navigator.sendBeacon to send the new metrics since it's recommended for that, but it doesn't let us set custom headers which means that we can't set the CSRF token header that we'd need to pass that check
2024-05-15 14:53:05 -04:00
Jesse Hallam
cd51dec6e5
Centralize the GetPackagePath (#27004) 2024-05-15 12:05:13 -03:00
MeHow25
298fd6e839
[MM-57877] Fix issue #26841 (#26956)
* Add new error message

* make i18n-extract

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
2024-05-13 19:55:12 +00:00
Jesse Hallam
630bd40141
Eliminate MM_SERVER_PATH (#24968) 2024-05-10 18:13:05 -03:00
Ibrahim Serdar Acikgoz
f0121d4f23
Change client metrics api path to client_perf (#26985) 2024-05-09 22:19:08 +02:00
Ibrahim Serdar Acikgoz
5590e1604a
Add new Metrics API (#26919) 2024-05-09 20:49:02 +02:00
Jesse Hallam
cd28902984
avoid segfault in TestDeleteChannelBookmark (#26969) 2024-05-07 18:40:25 -03:00
Ben Schumacher
732932f51f
[MM-58059] Remove PostPriority feature flag (#26929) 2024-05-06 10:11:28 +02:00
Nick Misasi
f1019d076e
[CLD-7567] Deprecate Self Serve: Second Pass (#26853)
* Deprecate Self Serve: First Pass

* Fix ci

* Fix more ci

* Remmove outdated server tests

* Fix a missed spot opening purchase modal in Self Hosted

* Fix i18n

* Clean up some more server code, fix webapp test

* Fix alignment of button

* Fix linter

* Fix i18n server side

* Deprecate in product true up

* Add back translation

* Remove client functions

* Put back client functions

* webapp deprecation

* Deprecate Self Serve: Second Pass

* Fix various pipeline issues

* Fix linter

* Fix pipelines

* Fix handlers_test.go

* Fix console.error around hostedCustomer in reducer

* PICKY LINTER PLEASE

* Fix webapp tests, various other fixes for the CI pipelines

* Fix i18n

* Updates to accomadate enterprise code removal

* Fix mocks

* More removal

* Fix

* Adjustments from PR

* Fixes for QA Feedback

* Update

* Add migrations to remove true up review history

* Fix migrations check

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: maria.nunez <maria.nunez@mattermost.com>
2024-05-02 09:15:15 -04:00
Anna Os
48b047aa0c
[GH-16199] add IsValid to model OpenDialogRequest (#26526)
* [GH-16199] add IsValid to model OpenDialogRequest

* [GH-16199] add IsValid to model OpenDialogRequest, revert remove of translations

* [GH-16199] fix tests after revert

* [GH-16199] add IsValid to model OpenDialogRequest

* [GH-16199] revert validation of icon url

* [GH-16199] update go sum

* [GH-16199] log warning for invalid dialog

* [GH-16199] log error for invalid dialog

* [GH-16199] log warning for invalid dialog

* [GH-16199] fix golang-ci

---------

Co-authored-by: Lukas Eipert <git@leipert.io>
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-30 18:27:07 +02:00
Ben Schumacher
5746bb8df3
Updated permanentDelete to receive user context as the first argument (#26884)
Co-authored-by: Ezekiel <ezekielchow94@gmail.com>
2024-04-29 10:44:55 +02:00
Devin Binnie
60c15c821f
More notification metrics fixes (#26889)
* Explicitly have the client tell the server when it should expect an ACK

* Don't count missing profile errors for your own posts, added comment

* Fix test

* Make postedAck a parameter in WebSocketClient

* Snapshot fixes

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-25 15:07:12 -04:00
Ben Schumacher
30d450c4d8
Cleanup usage of global logger (#26835) 2024-04-24 11:52:33 +02:00
Devin Binnie
9cf5a4bccb
Notification metrics fixes (#26854)
* Ensure your own posts are never ACKed

* Don't ACK mobile websocket notifications

* Add counter for the unsupported Desktop Apps

* Count only push messages when checking for acks

* Fix generated

* Add tests, fix comment

* Fix help string

* Check for nil session
2024-04-23 21:31:17 +00:00
Nick Misasi
437f90e184
[CLD-7421][CLD-7420] Deprecate Self Serve: First Pass (#26668)
* Deprecate Self Serve: First Pass

* Fix ci

* Fix more ci

* Remmove outdated server tests

* Fix a missed spot opening purchase modal in Self Hosted

* Fix i18n

* Clean up some more server code, fix webapp test

* Fix alignment of button

* Fix linter

* Fix i18n server side

* Add back translation

* Remove client functions

* Put back client functions

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-23 14:25:37 -04:00
Devin Binnie
a40550136f
[MM-56266] Use ListTeamChannels for member count permission for public channels (#26820) 2024-04-23 09:24:59 -04:00
Ben Schumacher
8348acac49
[MM-57826] Make sure the original errors are wrapped when AppErrors are returned (#26771)
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2024-04-22 12:03:28 +02:00
pacop
9e6da03ab1
MM-57391: improve error message (#26630)
The error reporte when moving channels and failing has been improved to show
that the problem was the repeated name on the team.
The error message has been unified with MM-53756

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-22 07:40:08 +00:00
Julien Tant
ffc08858cf
[MM-54730] Don't use old hardcoded rule for validating imported posts (#25823)
* don't use old hardcoded rule for validating imported posts

* fix http verb in doc

* Use client config

* Handle local mode

* E2E tests

* Enforce default if unable to use real limit

* Unit tests

* Fix tests

* Use model.PostMessageMaxRunesV2 as lower default

* Update direct post message length validation

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: streamer45 <cstcld91@gmail.com>
2024-04-19 11:45:32 -06:00
Devin Binnie
02e23a3275
[MM-57066][MM-57329] Added metrics for all notification stopping points, consolidated categories between metrics and logging (#26799)
* [MM-57066] Add metric counters for notification events

* Some small changes

* Account for Metrics() sometimes being nil

* Fix test (again)

* Fix more tests

* A few changes from testing - added success counter

* Missed a mock

* Lint

* Add feature flag for notification monitoring
2024-04-18 10:30:08 -04:00
Harshil Sharma
b4a1b33d39
Added post limit warning (#26793)
* Renamed user limit API to app limit API

* Added post warning limit

* Added tests

* Fixed types

* Renamed AppLimits to ServerLimits

* Fixed tests and review fixes

* Updated generated code

* Updated server i18n

* Fixed TestCreateUserOrGuest test

* Exclude deleted posts from post count for liims

* Reduced limits for ease of testing

* Restored original limts
2024-04-18 11:50:30 +05:30
Claudio Costa
4b508eed46
[MM-57010] Include client type in websocket connections metric (#26763)
* Include client type in websocket connections metric

* Unexport field
2024-04-16 10:49:49 -06:00
Agniva De Sarker
effb99301e
MM-56402: Introduce a pluginID to track RPC DB connections (#26424)
Previously, we relied on the plugin to close the DB connections
on shutdown. While this keeps the code simple, there is no guarantee
that the plugin author will remember to close the DB.

In that case, it's better to track the connections from the server side
and close them in case they weren't closed already. This complicates
the API slightly, but it's a price we need to pay.

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

```release-note
We close any remaining unclosed DB RPC connections
after a plugin shuts down.
```


Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-16 18:53:26 +05:30
Ben Schumacher
df75277a0c
[MM-55323] Allow end users to fetch the group members list of groups which allow @-mentions (#26551)
* Allow end users to fetch the group members list of groups which allow @-mentions

* Update server/channels/api4/group_test.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

* Fix test name

* Move into subtest

---------

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2024-04-12 19:41:50 +02:00
Ben Schumacher
b336fb9a45
Fix MM-57090 (#26589) 2024-04-12 17:15:01 +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
Ben Schumacher
0ffbc75cfd
Fix MM-55314 (#26595) 2024-04-10 13:38:56 +02:00
Ezekiel
9fee0393c3
Gh 24291 api meesage unclear when parameters are incorrect (#26457)
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-10 11:04:41 +02:00
Arya Khochare
a040618485
Added log to show which URL is blocked by CORS. (#26347)
---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-04-06 08:25:50 +05:30
Ben Schumacher
71e26b8df2
[MM-56653] Improve license loading errors (#26050) 2024-04-05 16:59:19 +02:00
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