Commit Graph

447 Commits

Author SHA1 Message Date
Agniva De Sarker
547bcff064 Allow HEAD requests on public files (#26047)
Fixes https://github.com/mattermost/mattermost/issues/25666

```release-note
NONE
```
2024-02-01 09:18:44 +05:30
Maria A Nunez
9b09652133 Update user limits error code (#26059)
* Updated user limits error code

* Webapp changes
2024-01-29 09:56:49 -05:00
Utsav Ladani
3ac6edb406 [GH-25484] Fix draft removal on post deletion (#25715)
* [GH-25484] Fix draft removal on post deletion

* [GH-25484] Add batch migration to remove orphan drafts

* [GH-25484] Fix tests of migration and draft store

* [GH-25484] Remove translation file changes.

* [GH-25484] Remove translation file changes.

---------

Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
2024-01-29 09:55:34 -05:00
Devin Binnie
435da9bea7 [MM-56616] Changes for the DM for batch reporting (#26019)
* [MM-56616] Changes for the DM for batch reporting

* Use requesting user's locale

* Fix lint

* Remove unnecessary test

* Move back to file attachment

* Add default API case

* Fix i18n

* Hardcode the CSV string
2024-01-29 09:52:33 -05:00
Daniel Espino García
409329c3d6 Fix issue where users may not follow links to private messages they belong to (#26001)
* Fix issue where users may not follow links to private messages they belong to

* Update tests
2024-01-24 16:10:01 +01:00
Agniva De Sarker
6d41ee171e MM-56611: Move license expiration check to be synchronous (#26010)
During server start, runLicenseExpirationCheckJob was being called
from a goroutine which would eventually call SetLicense and iterate
through the ps.licenseListeners.

But at the same time doElasticsearchFixChannelIndex would also
call AddLicenseListener and try to edit the ps.licenseListeners map,
leading to a race condition.

To fix this, we simply move the runLicenseExpirationCheckJob
to be synchronous. This fixes the race, and also improves
the correctness because after 1f431bf722
there was no license check being done synchronously during server boot.

So theoretically, the server might go on doing some stuff
until the Go runtime decides to run the license check goroutine.

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

```release-note
NONE
```
2024-01-24 11:59:42 +05:30
Agniva De Sarker
f246cd26b7 MM-56457: Update LastUpdateAt in UpdateMemberNotifyProps (#25984)
PR https://github.com/mattermost/mattermost/pull/18114
mistakenly left out updating the lastUpdateAt of the field.

We fix that here.

https://mattermost.atlassian.net/browse/MM-56457
```release-note
NONE
```
2024-01-23 16:31:25 -05:00
Devin Binnie
8dbe7aed79 [MM-56362] Disable post stats for MySQL (#25981) 2024-01-23 10:34:23 -05:00
Harshil Sharma
62064e3bf7 Used limited reader in user invite (#25943)
* Used limited reader in user invite

* Added tests
2024-01-23 11:11:10 +05:30
Matthew Straughn
ae33de57ff Mm 16623 fix all initialism errors in channels/app and channels/api4 and /store dir (#25787) 2024-01-22 14:35:16 +01:00
Agniva De Sarker
1f431bf722 MM-53879: Fix duplicate loading of license (#25442)
We take a second stab at fixing the issue. Last time,
we were a bit too aggressive in trying to fix a lot of stuff.

I believe changing the cluster event handler had an edge case
somewhere which caused things to fail. Taking a very conservative
approach this time to only fix what is obviously wrong.

Also tested locally in a HA setup.

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

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-22 11:04:15 +05:30
Agniva De Sarker
8364e30a2a MM-55524: Include deactivated users in DM export (#25695)
We were incorrectly excluding deactivated users
while getting channel members for a DM channel, whereas
we were actually exporting all users in the users array.

We fix this and also correctly honor the includeArchivedChannels
flag as well.

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

```release-note
Include deactivated members in a favorited DM channel export.
```


---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-20 08:47:47 +05:30
Devin Binnie
f7446d7443 [MM-55726] Create batch report worker, add batch report job for exporting users to CSV (#25832)
* Split out migration logic and create generic BatchWorker

* WIP

* WIP

* POC batch reporting

* Oops

* Job hookup

* Working export to file

* PR feedback

* Merge'd

* Fix error handling

* Add API to start report, translations, couple fixes

* Add DMs to send reports to users

* Merge'd

* Update types

* A bit of cleanup

* Some fixes

* Add missing API doc

* PR feedback

* Fix generated

* Fix bug with post creation

* PR feedback

* Add some tests

* PR feedback

* Fix lint

* Some test changes

* Fix tests

* Add comment to explain why we forcibly stop

* Rework of some tests

* Batch report test

* Restrict batch exports to Pro and Enterprise licenses

* Fix erroneous comment

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-19 15:22:17 -05:00
Devin Binnie
bbe432b3b0 [MM-56398] Fix date range query for user reporting (#25960)
* [MM-56398] Fix date range query for user reporting

* Missing debug stuff

* Fix tests
2024-01-18 14:06:30 -05:00
Harrison Healey
fd3a3081d4 Remove accidentally included trace logs (#25939) 2024-01-17 16:18:01 -05:00
Harrison Healey
21e82c4a8b MM-56565 Add filter to connectFakeWebSocket to fix flakiness (#25938) 2024-01-17 16:17:14 -05:00
Nick Misasi
7039176d31 [CLD-6536] Adjustments to cloud annual renewal announcement bar (#25927)
* Adjustments to cloud annual renewal announcement bar

* Add exclusion for trials

* Add more exceptions for when on trial during renewal period

* Add support for simulated_current_time_ms

* A few more changes to allow us to test this post-merge

* Fix tests, pipeline

* Final fix around emails

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-16 17:48:59 -05:00
Claudio Costa
d1e37783cc Include session id in request payload of WebSocketMessageHasBeenPosted plugin hook (#25928) 2024-01-16 14:17:31 -06:00
Agniva De Sarker
ff741a76e6 Skip flaky test SendNotifications_MentionsFollowers (#25931)
https://mattermost.atlassian.net/browse/MM-56565
```release-note
NONE
```
2024-01-16 14:46:36 -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
Julien Tant
6f1bbcd8ec [MM-54770] Add ability to export profile pictures and fix importing them (#25042)
* add ability to export pp and fix import

* remove unused nopSeeker

* remove debug log

* fix shadow vars

* generate a warning instead of an error when unable to export profile picture

* fix merge conflicts

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-15 14:29:45 -07:00
Scott Bishel
68be318fa2 MM-55608:check invite guest permission (#25708)
* check for invite_guest permission when inviting guests

* update description for invite_guest

* check team permission first

* update returned error

* update from review comments

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-15 08:51:50 -08:00
Agniva De Sarker
f2b488932d MM-56355: Use same number of hubs as CPUs (#25798)
We randomly used double the number of hubs. A proper test indicates
that using the same number of hubs as CPUs gives better performance.

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

```release-note
NONE
```
2024-01-13 08:56:16 +05:30
Maria A Nunez
f857af64f2 Fixed actived users and added mau in true up report (#24921)
* Fixed actived users and added mau in true up report

* Temp disable of true up calendar checks for testing

* Revert "Temp disable of true up calendar checks for testing"

This reverts commit 73055bdb25.

* Added unit test

* Linting

* Typo

* Forgot the pain of linting

* Added dau

* Create imports.go

* Fix merge error

* Fixed test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-11 21:28:58 -05:00
Harshil Sharma
3047700c0b Added count exceeded warning (#25817)
* Added count exceeded warning

* lint fix

* Updated message

* Update server/channels/app/user.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* added check for activating user

* Updated copy

---------

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
2024-01-12 06:48:52 +05:30
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
Nick Misasi
aafe7439af [CLD-6894] Add 60, 30, and 7 day reminder emails for Cloud Renewals (#25883)
* Add email notifications for Cloud Renewals

* Updates

* Updates

* Update app-layers

* make build-templates

* Add ability to set an env variable as a unix timestamp in s as the current date when getting DaysToExpiration

* Add a mechanism to ensure at least one admin receives every email

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Gabe Jackson <3694686+gabrieljackson@users.noreply.github.com>
2024-01-11 13:07:41 -05:00
Agniva De Sarker
04cf1ed114 Bump up the minimum required MySQL version (#25465)
MySQL 5.7 is at end of life.

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

```release-note
We bump up minimum MySQL version to be 8.0.0
```


Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2024-01-11 22:18:20 +05:30
Daniel Espino García
539412b353 Fix MM53643 (#25683)
* Fix MM53643

* Add test

* Remove unneeded part of a test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-11 10:52:39 +01:00
Agniva De Sarker
1d879ed0f4 MM-55295: Improve DB performance of some (Take 2) (#25865)
* Revert "Revert "MM-55295: Improve DB performance of some APIs (#25318)" (#25852)"

This reverts commit 077221a940.

* Fix the issue

```release-note
NONE
```

* lint fix

```release-note
NONE
```
2024-01-11 10:18:36 +05:30
Devin Binnie
43cca04f04 [MM-56174] Account for archived channels in channel member for post permission check (#25837)
* [MM-56174] Account for archived channels in channel member for post permission check

* Add tests
2024-01-10 15:50:00 -05:00
Devin Binnie
0a4e9eeb92 [MM-56399][MM-56397][MM-56456][MM-56269] Various changes for user reporting for admins (#25839)
* [MM-56399] Add user count endpoint for reporting

* [MM-56397] Added search term to user report filter

* Missing translation

* [MM-56456] Rename up/down to prev/next for reporting cursoring

* [MM-56269] Add DeleteAt, MfaActive and AuthService fields to UserReport

* PR feedback

* Fix test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-10 09:08:23 -05:00
Scott Bishel
82b8d4dc07 MM-55966 - Update ArrayFromJSON to use LimitedReader (#25510)
* update ArrayFromJSON to use LimitedReader

* update for bad merge

* fix lint errors

* update test code

* update unit tests

* update unit tests

* fix unit tests

* use consts, other cleanup

* add non sorting duplicate check

* set config to default value, then config setting if available

* fix lint errors

* fixes and debugs

* fix log test

* remove setting from Client, add unlimited Parser to client

* a couple more fixes

* another fix

* rename some variables

* remove superflous call

* check for valid MaximumPayloadSize

* update language file

* fix for e2e-tests

* update util function to return error

* lint fix

* update config property name to include unit

* fix for unit test

* add new config to telemetry

* call function to create LimitedReader

* Deprecate old function, use new function name

* return new AppError on failed parse

* return new AppError on failed parse

* return new AppError on failed parse

* add constant for i18n valid constants

* Update server/public/model/utils_test.go

Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>

* Apply suggestions from code review

Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>

* update error variable, remove unnecessary check

* Update function names

* fix errors from merge

* update unit test to create unique ids

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>
2024-01-09 10:04:16 -07:00
Doug Lauder
93351ff8a4 Fix error message when sharing already shared channel; also make idempotent (#25854)
* fix appError/error assignment bug

* make ShareChannel plugin API idempotent

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-09 12:42:11 +01:00
Doug Lauder
241e8edc2e Ping new shared channels remotes immediately (#25850)
* 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

* fix merge conflicts

* make modules-tidy

* revert accidental go.mod change

* revert accidental go.sum changes

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-09 12:35:05 +01:00
Doug Lauder
000aa0d891 Plugin API for Shared Channels: support auto invite (#25834)
* option for auto inviting plugin to all shared channels.

* auto-invite remotes to shared channels when flag set

* fix unit test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-08 18:12:18 +01:00
Jesse Hallam
b05093d508 Source available metrics (#24879)
* Expose metrics under a source available license

* do not assume Cluster()

* allow metrics if licensed or dev

* temporary vet override

* simplify BULID_TAGS handling

* auto clean old imports.go

* fix license listener

* e2e test metrics & license semantics

* update from enterprise

* switch back to mattermost-govet/v2@new now

* update metrics from upstream

* Update license_spec.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update license_spec.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update e2e-tests/cypress/tests/integration/channels/enterprise/metrics/license_spec.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update e2e-tests/cypress/tests/integration/channels/enterprise/metrics/license_spec.js

* split up specs

* require/delete license earlier in e2e test

* expanded expect to debug failures

* more logging

* Revert "more logging"

This reverts commit 0bc513fd92.

* e2e: try deleting license first

* update from enterprise

* toggleMetricsOn to work around license delete

* eslint

* ensure admin before deleting license

* update from enterprise

* updates from enterprise

* fix cypress logging

* temp: log at DEBUG for Cypress tests

---------

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-08 10:47:24 -04:00
Miguel de la Cruz
6184c36e0b Fix make permission error (#25860) 2024-01-08 14:45:48 +01:00
Miguel de la Cruz
e1a27cf57f Adds a team check to get groups by team (#25462)
* Adds a team check to get groups by team

* Update to take into account groups_by_channel and new permissions

* Update API docs
2024-01-08 13:28:51 +01:00
Nick Misasi
e52940cd08 Lock wrangler behind enterprise (#25703)
* Lock wrangler behind enterprise

* Run tests with SetupEnterprise so Thread Moving is unlocked. Tweak NewTestLicense to include a SkuShortName for 'enterprise'

* Don't set SkuShortName in NewTestLicense just in case. Fix up some old debug code in tests

* Remove checks on enterprise/e20 and just enforce that the workspace has any license

* Update admin_definition.tsx accordingly

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-01-05 13:20:37 -05:00
Devin Binnie
ac854498a4 [MM-56266] Check for public channels when getting channel member counts to avoid 403 errors (#25831)
* [MM-56266] Check for public channels when getting channel member counts to avoid 403 errors

* Fix test
2024-01-05 12:28:22 -05:00
Claudio Costa
077221a940 Revert "MM-55295: Improve DB performance of some APIs (#25318)" (#25852)
This reverts commit ec88ab4ee9.
2024-01-05 10:05:37 -06:00
Agniva De Sarker
ca94577cd5 MM-56260: connIndex: safely remove conns while iterating (#25785)
PR https://github.com/mattermost/mattermost/pull/22560
introduced a regression in the case where we had
multiple connections for a single user.

Because if connIndex.Remove was called during the iteration
from connIndex.ForUser, then the slice would be modified
during iteration and if a connection got removed,
then a good connection would move from the last index
to the current index. But since we would be actively
iterating, the last index would be read as nil and we would
never be able to reach the good connection.

We fix this by returning a copy of the original slice
if there are more than one elements in the slice.

https://mattermost.atlassian.net/browse/MM-56260
```release-note
Fix a bug where if there were multiple websocket
connections from a single user, then in case one connection
got removed during a broadcast, there was a possibility
that the other good connection might not get the event.
```
2024-01-04 13:36:22 -06: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
Ben Schumacher
edc305716f [MM-56284] Remove non-generic StoreResult (#25750) 2024-01-04 12:30:21 +01: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
Harshil Sharma
9016e30044 Fixed user reporting pagination (#25780)
* Fixed pagination and sorting for Postgres

* Updated tests
2024-01-02 10:41:00 -05:00
Felipe Martin
81a1d725a0 [WIP] [MM-55031] OAuth Outgoing Connection App integration (#25379)
* OAuthOutgoingConnection model

* added store

* make generated

* add missing license headers

* fix receiver name

* i18n

* i18n sorting

* update migrations from master

* make migrations-extract

* update retrylayer tests

* replaced sql query with id pagination

* fixed flaky tests

* missing columns

* missing columns on save/update

* typo

* improved tests

* remove enum from mysql colum

* add password credentials to store

* license changes

* OAuthOutgoingConnectionInterface

* Oauth -> OAuth

* make generated

* merge migrations

* renamed migrations

* model change suggestions

* refactor test functionsn

* migration typo

* refactor store table names

* updated sanitize test

* cleanup merge

* refactor symbol

* list endpoint

* oauthoutgoingconnection -> outgoingoauthconnection

* signature change

* i18n update

* granttype typo

* naming

* api list

* uppercase typo

* i18n

* missing license header

* fixed path in comments

* updated openapi definitions

* sanitize connections

* make generated

* test license and no feature flag

* removed t.fatal

* updated testhelper calls

* yaml schema fixes

* switched interface name

* suggested translation

* missing i18n translation

* address comments

* updated i18n
2023-12-26 10:46:20 +01:00
Harshil Sharma
d23c16b9aa Removed user bands (#25806) 2023-12-25 07:11:28 +00: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