Commit graph

1695 commits

Author SHA1 Message Date
Jesse Hallam
e39b485c4b
Fail vs. fatal on store startup (#24170)
If the store fails to initialize (e.g. run a migration), it would `log.Fatal` and then `os.Exit`. Unfortunately, this trips up `TestMain`, which happily keeps running tests, now guaranteed to fail.

Avoid this by instead returning an error from the store initialization, handling appropriately at the layer above.
2023-08-04 23:05:01 -03:00
Jesse Hallam
c030bb44f5
MM-53905: Skip racy test testGetUptoNSizeFileTime (#24173) 2023-08-04 13:27:08 -03:00
Jesse Hallam
d9edb84523
Revert s3 path prefix normalization for plugins (#24184)
This reverts 0af0a4eff4. During the [implementation](https://github.com/mattermost/mattermost/pull/15910) we [discussed](https://github.com/mattermost/mattermost/pull/15910#issuecomment-705925227) fixing the underlying issue. When we did [fix](https://github.com/mattermost/mattermost/pull/15949) the underlying issue, we didn't revert these changes.

Revert it now to simplify the code.
2023-08-04 11:24:53 -03:00
Julien Tant
d1691833ad
[MM-53881] Make sure export filestore won't use bifrost (#24169) 2023-08-02 09:44:20 -07:00
Agniva De Sarker
ce92ab7e1c
Update vacuuming parameters for some tables (#23997)
After some analysis of vacuuming statistics of our large
Postgres customers, it was observed that the default vacuuming
thresholds for some tables are not optimal enough for our workload.

We need more frequent vacuuming for some tables. The analysis
showed that the top 4 tables that needed rectification
were posts, preferences, threadmemberships and fileinfo.

So we reduce the threshold by half for those tables, triggering
autovacuum and autoanalyze doubly often.

```release-note
NONE
```
2023-08-02 21:18:18 +05:30
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
Claudio Costa
a47af39d80
Include connection ID in webconn related logs (#24143) 2023-07-27 08:24:39 -06:00
Agniva De Sarker
b47754e268
MM-53747: Do not start if job is in-progress as well. (#24115)
We missed this out last time. It's possible in an HA
scenario for a second pod to start later while the other
job is in-progress. In that case, it would schedule
two jobs.

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

```release-note
NONE
```
2023-07-26 20:32:50 +05:30
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
Agniva De Sarker
6d6e589c11
MM-53747: Create job to encode older image paths (#24073)
Bifrost now encodes all image paths. Due to this
one-way translation, we need to encode all the older
image paths as well.

After this is done, we can remove the double-lookup.

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

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-25 08:38:35 +05:30
Agniva De Sarker
29bd0c9357
Revert "MM-42810: Introduce a channel hook for a websocket event (#23812)" (#24107)
Automatic Merge
2023-07-24 19:16:57 +03:00
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
Alejandro García Montoro
dbf63214ac
Fix duplicated channel's name error (#24080)
* Fix duplicated channel's name error

* Test the SQL store layer instead of the API layer

* Remove unused variable and query
2023-07-24 11:04:54 +02:00
Harshil Sharma
f1468a1958
Renamed channel index fix migration key (#24061)
Automatic Merge
2023-07-21 23:16:56 +03:00
Ibrahim Serdar Acikgoz
a307fd9da3
[MM-53408] server/user_store: avoid antijoin for IsEmpty query (#23966) 2023-07-20 18:50:28 +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
4803889158
Improves notify props validation (#24031)
* Adds the channel member notify props max runes restriction

* Fix translations
2023-07-18 17:25:11 +02:00
Agniva De Sarker
3c31629813
MM-53669: Use the cache layer for EmojiStore.GetMultipleByName (#24030)
There was already a cache present for emoji names. But we weren't using
it for the GetMultipleByName method. Now we implement that method
to look up the cache for every emoji name passed.

Secondly, a bigger problem was that we were making the DB call for system
emojis as well. Since system emojis aren't stored in the DB, it would
fall through the cache layer and always make a redundant DB call. In the
profiles, this should up as taking 16% of the total time to serve
a getPostsForChannel API endpoint.

We fix this by filtering the emojis to only custom emojis
before making the call.

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

```release-note
NONE
```
2023-07-18 20:27:48 +05:30
Devin Binnie
a6a9664e53
[MM-53192] Patch Show Full Name issue in Insights team_members API (#24027)
* [MM-53192] Patch full name leak in Insights team_members API

* Update server/channels/app/team.go

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

---------

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2023-07-18 09:41:16 -04:00
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
Agniva De Sarker
b20ef95b91
MM-42810: Introduce a channel hook for a websocket event (#23812)
Sometimes a broad distinction of just a channelID or a userID
is not enough to efficiently send a websocket event to users.

In several cases, depending on the user and channel, we might
need to modify the message. Therefore, we introduce the
concept of a channel hook that will get executed if the scope
is set to a channel. This hook can be populated at the app layer
to perform any application specific logic to the event.

Care must be taken to avoid race conditions as the passed event
is not deep copied. It is left to the user to treat it carefully.

For this issue, the main problem was that since we don't know
which users have permissions to which channels, we had to go through
_all_ members of a channel to figure that out. This was redundant
since a large portion of those users might not even be connected
at that time.

We solve this with the channel hook where we push this check
to be performed later while actually sending the event. This
reduces the computation to be done only for _connected_ users
rather than _all_ users of a channel.

The next iteration of this should be to use websocket subscriptions
to monitor exactly which users are on that channel to even
trim down that list. That is a larger initiative to be taken later.

Tested locally with a channel of 50 users. Here are rough results:
```
With PR:
patchPost 97ms
createPost 90ms

Master:
patchPost 306ms
createPost - 298ms
```

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

```release-note
Improve  performance while sending messages
with permalinks to channels with large number of users.
```
2023-07-15 08:14:16 +05:30
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
Ibrahim Serdar Acikgoz
51c6e77972
[MM-53407] server/user_store: avoid antijoin for AnalyticsActiveCount query (#23993) 2023-07-12 17:40:34 +03: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
f45f774ece
update for guest demotion and sysadmin edits (#23920)
* update for guest demotion and sysadmin edits

* update unit test

* update unit test

* use existing disabled flag

* remove commented line

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-11 16:10:44 -06: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
Agniva De Sarker
da3d5c73fe
MM-53406: Fix userstore.count to avoid antijoin (#23953)
For MySQL, a query for type LEFT JOIN .. IS NULL
leads to a nested antijoin which leads to poor performance.

We fix this by rewriting the query to avoid the antijoin.

See the JIRA epic for more context behind this.

We also make another improvement to remove the DISTINCT
clause. It didn't serve any purpose since userids would
already be unique.

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

```release-note
NONE
```
2023-07-10 10:19:44 +05:30
Agniva De Sarker
49e1d039f5
Reduce number of calls to IsCRTEnabled (#23963)
In a single createPost flow, there were
3 separate calls to App.IsCRTEnabled. This
showed up very slightly in the CPU profiles.

Not a big deal, but good to get it out of
the way.

```release-note
NONE
```
2023-07-10 10:18:55 +05:30
Maria A Nunez
96d3e5864f
Removed Post Priority feature flag (#23735)
* Removed post priority feature flag

* linting

* Update feature_flags.go
2023-07-07 11:42:57 -04:00
Maria A Nunez
5779bd49d5
Remove Global Drafts Feature Flag (#23767)
* Remove global draft feature flag

* More removal - in progress

* Removed the rest in webapp

* Removed the rest in webapp

* Fix tests

* Update feature_flags.go

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-07-05 12:18:30 -04:00
Agniva De Sarker
15eac83923
MM-52646: Fix data race on product notices (#23910)
The UpdateProductNotices method runs in a separate goroutine
which modifies a global structure called noticesCache.
This creates race condition when one test finishes
but the goroutine hasn't finished running.

To fix this, we simply prevent the spawning of the goroutine
by disabling the feature in the config.

Ideally, we'd not have global state in the first place.
But that's a separate matter.

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

```release-note
NONE
```
2023-07-05 20:36:14 +05:30
Jesse Hallam
8abc8ed65c
MM-53358: Revert Threads Everywhere (#23882)
Remove changes related to the unshipped threads everywhere feature, including commits b8da473da7 and 9f9e19e05d.

Since a version of Playbooks shipped calling this experimental API, keep a `nil` implementation to avoid breaking compatibility. We remove the hooks altogether, but keep the numbering again to avoid breaking compatbility.

Fixes: https://mattermost.atlassian.net/browse/MM-53358
2023-06-30 15:31:25 -03:00
Scott Bishel
d74ee1a3da
don't allow deletedAt to be set when creating user (#23914) 2023-06-30 10:10:10 -04:00
Harshil Sharma
05cd245e97
Fixed a bug that prevent post deletion (#23908)
* Fixed a bug that prevent post deletion

* lint fix:
2023-06-30 10:29:27 +05:30
Agniva De Sarker
29466bd33a
MM-53452: Skipping some flaky tests (#23911)
https://mattermost.atlassian.net/browse/MM-53452

```release-note
NONE
```
2023-06-29 22:23:46 +05:30
Miguel de la Cruz
4b1a37137d
Disable skipping SendNotifyAdminPosts test (#23874) 2023-06-29 13:23:35 +02:00
Sinan Sonmez (Chaush)
385bf19972
Update testlibrary helper.go to reflect Monorepo (#23848) 2023-06-29 11:32:25 +03:00
Miguel de la Cruz
dcb9fb9f29
Set license for group mentions flaky test (#23873) 2023-06-28 10:51:32 +02:00
Maria A Nunez
4e92dde5b3
Remove Permalink Preview Feature Flag (#23731)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-27 17:42:55 -04:00
Pablo Andrés Vélez Vidal
887ba95cc1
MM-53088 - remove autoshow linked board (#23783)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-26 14:13:14 +02:00
Felipe Martin
cad2df1259
[MM-52943] fix: enable Elasticsearch properly on restart (#23806)
* fix: enable elasticsearch properly on restart

* use correct method under IsEnabled

* Empty-Commit to retrigger workflow

---------

Co-authored-by: Antonis Stamatiou <stamatiou.antonis@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-23 14:59:56 +02:00
Scott Bishel
644381b35e
MM-53092 Fix for Updating SysAdmin user. (#23750)
* check retrieved user for role and permissions

* add unit tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-22 10:40:21 -06:00
Matheus
d12812b6f3
add & to chars that must be treated as spaces (#23786)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-20 15:52:03 +02:00
Felipe Martin
f3a9f166bb
[MM-52869] Update and fix links in the system console (#23694)
* Updated privacy policy link

* Removed broken link from fa language

* Updated terms of use link

* Updated pricing links

* Updated self hosted billing links

* Updated terms-of-use links

* Updated privacy-policy links across the project

* Updated pricing links in e2e tests

* Updated cloud billing docs

* Fixed upgrading mattermost server links

* Updated ssl client certificate links

* Updated configure session lenghts links

* Updated configure site url links

* Updated elasticsearch links

* Update data retention policy links

* Updated ldap links

* advanced-permissions

* Updated anchor ServiceSettings.ListenAddress

* Updated anchor #SystemSettings.Forward80To443

* Updated link desktop managed resources

* Updated elasticsearch links

* Updated file content extraction links

* Updated HA Cluster inks

* Updated setup image proxy link

* Updated push notification links

* Update performance monitoring links

* Help links

* Updated about mattermost links

* updated report a problem links

* Updated download apps links

* Updated mobile apps links

* Update share messages links

* Updated format messages links

* Updated in product notices links

* Updated multi factor auth links

* Updated LDAP links

* Updated setup saml links

* Updated saml/ldap configuration links

* Updated plugins URL

* Updated plugin signing links

* Updated webhook links

* Updated slash commands links

* Updated oauth2 links

* Updated webhook links

* Update enable oauth2 links

* Updated personal access tokens list

* Updated experimental links

* Updated snap files

* check-style

* privacy/terms links in about modal
2023-06-19 18:46:52 +02:00
Ibrahim Serdar Acikgoz
0904be43f8
[MM-53195] services/telemetry: regen client config right after assigning diagnostic ID to platform (#23773) 2023-06-19 18:48:29 +03:00
Julien Tant
86f0877799
[MM-53086] Remove SendWelcomePost A/B test and feature (#23733)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-16 12:13:23 -07:00
Agniva De Sarker
747b4cf26c
MM-53058: Move cache layer out of timer layer (#23660)
Having cache layer as part of the store call
Prometheus metrics can be somewhat misleading
because cache-backed methods can have very high
volume and yet not cause any load on the DB at all.

However, if the admin is not aware which calls
are cache-backed and which are not, then
it can be hard to understand why a store call
of high volume isn't causing any stress on the DB at all.

Therefore, for simplicity we reorder the layers
such that cache layer is handled outside the timer layer.

We already have cache related metrics like hit/miss
which can be used to monitor cache usage.

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

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-15 21:08:14 +05:30
Doug Lauder
d655ab94a3
Sanitize post for audit with preview links (#23745)
* sanitize post for audit with preview links

* add unit test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-15 08:23:56 -04:00
Miguel de la Cruz
44a99d1736
Move playbooks to plugin (#23732)
* Remove build references

* Remove playbooks webapp and server, and add the prepackaged plugin

* Remove translations

* Add ProductSettings to the playwright type

* Restore playbooks as a prepackaged plugin for cypress e2e tests
2023-06-14 23:33:26 +02:00
Harshil Sharma
79abeb6382
[MM-53026] - Disabled insights by default (#23702)
* Insights disabled by default

* fixed tests

* fixed tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-14 19:40:12 +05:30
Maria A Nunez
4021098456
Removed onboarding feature flag (#23726) 2023-06-14 08:58:02 -04:00
Pablo Andrés Vélez Vidal
6a5bb53963
[MM-52969] Revert "MM-51482_Create Apps Category and link to bots DM (#22918)" (#23647)
* Revert "MM-51482_Create Apps Category and link to bots DM (#22918)"

This reverts commit 1051925eec.

* Revert "MM-51711_Feature flag: APPS sidebar category (#22766)"

This reverts commit 9156205178.
2023-06-14 11:05:21 +02:00
Agniva De Sarker
c249ba4a66
MM-52532: Fix golangci warnings (#23709)
https://mattermost.atlassian.net/browse/MM-52532

- Replace golint with revive
- Add makezero linter
- Fix all the required linter failures

Some issues in enterprise and public modules
are yet to be fixed. We send this to expediate things.
2023-06-13 14:08:36 +05:30
Claudio Costa
62a3ee8adc
[MM-52924] Implement ConfigurationWillBeSaved plugin hook (#23567)
* Implement ConfigurationWillBeSaved plugin hook

* Add comment

* Update comment

* Fix potential nil dereference if plugin environment is unset

* Address PR review
2023-06-12 18:23:02 -06:00
Nick Misasi
37196a6a26
Enforce PermissionSysconsoleWriteBilling in self serve workspace deletion (#23691) 2023-06-12 10:33:11 -04:00
Ibrahim Serdar Acikgoz
4546a2eebb
[MM-47976] cmd/mattermost/db: add downgrade commands and enable plan saving (#21779) 2023-06-12 12:48:50 +03: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
8194817d54
disable coverage (#23686)
* disable coverage

This reduces runtime of the server test suite from ~30m to ~10m, and as far as I can see: we discarded the coverage output anyway.

* allow morph 60s to migrate when running tests
2023-06-09 12:29:08 +02:00
Julien Tant
cbfc14b2b4
[MM-52922] Fix a possible nil call to subscription.LastInvoice (#23540)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-08 11:41:40 -07:00
Doug Lauder
ac3c0da8ff
Support json.RawMessage in configuration env overrides (#23610)
* support json.RawMessage in env overrides
2023-06-07 17:21:58 -04:00
Jesse Hallam
305fac6507
Service environment (#23443)
* fix fileutils.TestFindFile on MacOS

* introduce model.ExternalServiceEnvironment

* pick license public key from external service env

* pick Stripe public key from external service env

* pick Rudder key from external service env

* configure Sentry DSN from external service env

* always log external_service_environment, Unsetenv

* clear faked BuildEnv, improve logging

* strip out unset GOTAGS

* fix Sentry tests

* simplify to just ServiceEnvironment

* relocate ServiceEnvironment in client config

* initialize CWS URLs based on service environment

* unset rudder key for boards dev

* harden service environment to avoid accidental production

* fix TestSentry again

* fix DEFAULT -> ENTERPRISE

* s/dev/test when naming playbooks rudder key

* simplify boards rudder key switch

* use uniform rudderKey variable names

* retain compatibility with existing pipeline

* reduce to just production/test

* unit test with valid test license

* simplify Playbooks telemetry initialization

* restore dev service environment

* emit ServiceEnvironment when running e2e tests
2023-06-07 10:15:33 -03:00
Ben Schumacher
6c82605df0
[MM-49989] Pass a context.Context to Client4 methods (#22922)
* Migrate all method in model/client4.go to accept a context.Context

* Fix th.*Client

* Fix remaining issues

* Empty commit to triger CI

* Fix test

* Add cancellation test

* Test that returned error is context.Canceled

* Fix bad merge

* Update mmctl code

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-06 23:29:29 +02:00
Doug Lauder
7116e9267a
fix typo in index name for idx_teammembers_create_at (#23632) 2023-06-06 10:50:16 -04:00
Julien Tant
0468e772a9
[MM-52926] Deprecating work templates (#23466)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-05 18:42:03 -07:00
Scott Bishel
22275fa0f5
MM-52818 - create config setting to enable/disable playbooks product (#23508)
* create config setting to enable/disable playbooks product

* fix to config name

* fix typo

* revert changes to package-lock.json

* update name of test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-05 15:18:20 -06:00
Ben Schumacher
3705d7af4d
Fix panic if JSON null value is passed as channel update (#23629) 2023-06-05 19:16:47 +02:00
KyeongSoo Kim
fbd6b5efe1
[MM-30432]: Allow users to specify different desktop notification sounds per channel (#21671) 2023-06-05 17:28:05 +05:30
Harshil Sharma
412109b02e
[MM-45802] Clear CRT notification on deleted reply (#23568)
* reduce the counter on post deletion

* add test

* change translations

* fix collecting mentions for DMs

* add translation texts

* extract logic for getting mentions

* send WS event

* add e2e tests

* tidy mod

* WIP

* Deleting notification async

* Fixed a unit test

* Added more tests

* Updated i18n

* CI

* mattermost-server -> mattermost

* mattermost-server -> mattermost

---------

Co-authored-by: Konstantinos Pittas <konstantinos.pittas@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-06-05 16:02:40 +05:30
Ben Schumacher
b6b561a8f1
[MM-52973] Avoid thundering herd problem in IsFirstUserAccount (#23549) 2023-06-05 10:32:23 +02:00
Ben Schumacher
9a55280d7a
[MM-52955] Fix panic for not found posts (#23561) 2023-06-05 10:00:06 +02:00
Konstantinos Pittas
4d41365fbe
[MM-52541] Mark files as deleted along with thread (#23226)
* mark thread files as deleted

* add missing check

* improve query

* Stopped rendering post preview if post is deleted

* Fixed lint error

* Fixed test

* updated types

* Removed deleted post from other post's embed data

* Added tests

* Apply suggestions from code review

Co-authored-by: Daniel Espino García <larkox@gmail.com>

* lint fix

---------

Co-authored-by: Konstantinos Pittas <konstantinos.pittas@mattermost.com>
Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Harshil Sharma <18575143+harshilsharma63@users.noreply.github.com>
Co-authored-by: Daniel Espino García <larkox@gmail.com>
2023-06-02 16:00:33 +05:30
Ben Cooke
e74b73e8ee
adding debug log when executing query (#23559) 2023-05-31 14:11:21 -04:00
Ben Schumacher
7a9a098ce4
Make used of typed atomic.Pointer (#23550) 2023-05-31 12:56:01 +02:00
Ben Cooke
427635a96f
Avoid calling the user count query in future if we get a count > 0 (#23545)
* Avoid calling the user count query in future if we get a count > 0

* re-adding mock session to avoid adding the old mitigation in future

* adjustments based on feedback
2023-05-30 21:34:01 -04:00
Vishal
fa1ba4717b
[MM-52527] (#23519)
* limit markdown size
2023-05-29 19:02:22 +05:30
Agniva De Sarker
289a855330
MM-52898: WS fix (#23489)
https://mattermost.atlassian.net/browse/MM-52898

```release-note
NONE
```
2023-05-24 23:40:12 +05:30
Agniva De Sarker
88d1743191
MM-52325: Bump morph (#23394)
This is needed to implement non-transactional migrations

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

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-24 15:53:04 +05:30
Amy Blais
cfa5be4d3e
Revert "Revert "[MM-51274] Remove deprecated PermissionUseSlashCommands (#22819)" (#23405)" (#23463)
Automatic Merge
2023-05-20 02:04:28 +03:00
Amy Blais
aef0f3c1bf
Revert "[MM-51274] Remove deprecated PermissionUseSlashCommands (#22819)" (#23405)
Automatic Merge
2023-05-19 21:04:30 +03:00
Vishal
9399ce8637
[MM-47751][MM-48102] MPA: Send Persistent Notifications (#21619)
* MM-46410: adds urgency on mention counts

We have introduced priority for posts in
https://github.com/mattermost/mattermost-webapp/pull/10951.
We do need to color the mention badges in the webapp with a prominent
color when a mention is posted in an urgent message.
A thread has urgent mentions if the root post is marked as urgent, and
the replies contain mentions to the user viewing the thread.

This PR adds two columns, urgentmentioncount, and isurgent, in
channelmembers, and threads tables respectively.
Furthermore when asking for team/thread mention counts, we also return
urgent mention counts for the user.

* Adds PostAcknowledgements table and apis

* job init and fetch mentions

* add-migrations

* delete-expired

* send-notifications

* Fetches post priority in batches

* stop-notifications

* stop-notification-on-reply

* MM-47750: Adds PostAcknowledgements table and apis

- Adds post acknowledgement api/app/store methods to be able to save and
delete post acknowledgements by users.
- Adds wesbsocket events for acknowledgement created/deleted
- Returns post acknowledgements in the post's metadata

* add-license-check

* add-pagination

* delete on channel and team

* validate guests

* add configs

* move create priority post check from app to api

* Add desktop notifications

* check status

* use config in job

* add IsUrgent check

* Add last-sent-at

* validate max recipients

* Update lastSentAt

* Validate min. recipient

* send email notification only once

* remove email notifications

* use latest time from config to run job

* Add notifications counter

* publish events to mentioned users only

* pickup license updates in scheduler

* don't allow post owner to stop notifications

* follow normal notifications behaviour

* Validates persistent notifications interval

* move logic of handling valid and expired posts into sql

* Adds persistent notifications in the webapp

---------

Co-authored-by: koox00 <3829551+koox00@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-18 23:44:12 +05:30
Harshil Sharma
da3dcf737c
Fixed hashtag search for DB search (#23313)
* Fixed hashtag search for DB search

* Fixed typo

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-17 12:01:31 +05:30
Harrison Healey
4cbf6e93d2
Remove Webpack dev servers for Boards/Playbooks (#23378)
* Add option to run web app build without dev servers

* Completely remove product dev servers

* Update unit test

* Fix another test
2023-05-15 16:18:10 -04:00
Scott Bishel
355bc6502c
MM-52477 - remove recovery tokens when creating a new one (#23171)
* remove recovery tokens when creating a new one

* add app layers, unit test, i18 extract

* lint fixes

* fix unit test
2023-05-15 11:28:54 -06:00
Doug Lauder
e4075dae18
MM-43077 Allow inline JSON in config.json for advanced logging config (#23324)
* add AdvancedLoggingJSON to LogSettings and deprecate AdvancedLoggingConfig
* allow embedded JSON in config for advanced logging.
2023-05-15 10:37:48 -04:00
Agniva De Sarker
0818bf448c
MM-52743: Skip racy test Test_SendNotifyAdminPosts (#23360)
https://mattermost.atlassian.net/browse/MM-52743
```release-note
NONE
```
2023-05-15 10:41:17 +02:00
Juho Nurminen
fc46a296ce
MM-52720: use an io.LimitedReader in gif frame counting (#23372)
* MM-52720: use an io.LimitedReader in gif frame counting

* Address review feedback

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-11 12:47:07 +03:00
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
Agniva De Sarker
a3e4ea2e7a
MM-52679: Bump up minimum postgres version to 11 (#23315)
https://mattermost.atlassian.net/browse/MM-52679
```release-note
NONE
```

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-10 08:26:59 +05:30
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
Julien Tant
d40689466d
[MM-51854] Onboarding Role selection screen (#23121)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-08 13:57:41 -07:00
Agniva De Sarker
9f1796f98b
Remove unnecessary blank imports (round 2) (#23310)
I mistakenly assumed that those packages are naturally imported.

And also atleast one test would have broken.

None of them are true. :)

So we just import it again at a better place

This reverts commit 30a053314b.

```release-note
NONE
```
2023-05-05 19:44:02 +05:30
Ibrahim Serdar Acikgoz
d030f681eb
[MM-52550] platform/web_conn: fix a possible data race issue (#23255)
* platform/web_conn: fix a possible data race issue

* reflect review comments

---------

Co-authored-by: Ibrahim Serdar Acikgoz <ibrahim@ibrahims-mac.local>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-05 10:01:18 +02:00
Vishal
d860548a76
[MM-37933] Channel preference to auto-follow all threads in the channel (#21430)
* Add auto-follow feature
---------

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-05 12:09:00 +05:30
Jesse Hallam
30a053314b
Revert "Remove unnecessary blank imports (#23283)" (#23302)
This reverts commit 76ad948b80.
2023-05-04 16:33:05 -03:00
Nathan
670b0e4c9f
[MM-44954] Regenerate default avatar (#22871)
* Regenerate default profile picture if username has changed

- Only actions is profile picture has not been changed
- Adjusts ResetLastPictureUpdate store function to store
-curTime instead of 0
    - This is to support updating the default picture while still
    retaining the ability to discern a default image from a set one.
- Changes SetDefaultProfileImage to leverage UpdateDefaultProfileImage
- Test updates around updating user default profile pictures

* App interface updates

* Only display picture update date if non-negative

- Ensures we don't display negative timestamps (default images)
- Change ported for mono-repo changes

* Remove duplicate test assertion

---------

Co-authored-by: Nathan Geist <ngeist@spiria.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-04 10:14:26 -04:00
Agniva De Sarker
76ad948b80
Remove unnecessary blank imports (#23283)
They aren't necessary after the monorepo

```release-note
NONE
```
2023-05-04 19:36:41 +05:30
Agniva De Sarker
efbee8ad56
MM-37691: Harden interactive dialog action (#22783)
We strengthen some checks, forcing them to be changed
only via config.

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

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-04 15:08:55 +05:30
Ibrahim Serdar Acikgoz
b2e0aa7088
server/utils: verify trusted ip headers are valid ip addresses (#23140)
Co-authored-by: Ibrahim Serdar Acikgoz <ibrahim@ibrahims-mac.local>
2023-05-04 09:29:21 +03:00
na
60234d0880
[MM-47492] - Don't count system messages as replies to a thread (#23022)
* [MM-47492] - Don't count system messages as replies to a thread

* Add test assertion

* revert store changes`

---------

Co-authored-by: Nevyana Angelova <nevyangelova@Nevyanas-MacBook-Pro.local>
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-04 13:24:14 +07: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
Vishal
698613c002
[MM-51517] Sentry crash fix (#22985)
* add cloud limit check

* add test

* add warning for the inaccessible root-post

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-05-03 16:12:57 +05:30
Ben Cooke
5adbf6c612
[MM-52288] Oauth2 postgres migration issue (#23036)
* fixing migrations that caused some oauth2 issues
2023-05-02 12:32:30 -04:00
Nathaniel Allred
a34d873acb
update test public key (#22835)
* update test public key
2023-04-28 09:20:12 -05:00
Harshil Sharma
3db6bb016e
Channel index fix (#22947)
* WIP

* Fetched ES index for type checking

* WIP

* Moved migration key to model

* CI

* CI

* Fixed existing tests

* Updated einterface mocks

* CI

* WIP

* Reverted test makefile changes

* Fixed error level

* CI

* Not attempting to launch job if not enterprise ready

* CI

* Fixing job trigger condition

* CI

* Updated eemocks

* CI
2023-04-28 11:11:34 +05:30
Julian Mondragón
1051925eec
MM-51482_Create Apps Category and link to bots DM (#22918) 2023-04-27 19:44:14 -05:00
Mattermost Build
a599a5feab
Merge branch 'master' into MM-51858-fix-workspace-deletion-telemetry 2023-04-27 17:36:11 +03:00
Ben Schumacher
f9836ee26a
[MM-51274] Remove deprecated PermissionUseSlashCommands (#22819)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-25 00:04:17 +02:00
Ben Schumacher
e8915b3182
[MM-45296] Fix installation of pre-packaged plugins that are not in the Marketplace (#21895)
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2023-04-25 00:02:51 +02:00
Julien Tant
94cb2867a7
[MM-52271] Add recommended tag to Work Template integrations (#23016) 2023-04-24 09:59:01 -07:00
Conor Macpherson
405b2091d6 lint. 2023-04-24 09:48:01 -04:00
Agniva De Sarker
94de9c8175
MM-52352: Limit channel search results (#23070)
https://mattermost.atlassian.net/browse/MM-52352

```release-note
NONE
```
2023-04-22 10:14:54 +05:30
Agniva De Sarker
67735be261
MM-52216: Trim errors (#23040)
https://mattermost.atlassian.net/browse/MM-52216
```release-note
NONE
```
2023-04-21 22:23:56 +05:30
Conor Macpherson
c98c43456e
Merge pull request #22657 from mattermost/MM-50966-in-product-expansion-backend
MM-50966 - In Product Expansion Backend
2023-04-20 10:38:47 -04:00
Allan Guwatudde
87555aa242
[MM-52158] - Don't show deprecation/move to annual banners to some clients (#22963)
* [MM-52158] - Don't show deprecation/move to annual banners to some clients

* create const

* feedback impl

* update test names

* update banner text

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-20 17:04:41 +03:00
Jesse Hallam
89f2ebc836
Channels/api4 testing improvements (#22938)
* api4/post_test: fix missing TearDown

* api4/plugin_test: dont test timeout, saving 120s

* api4/channel_test: dont try to delete town square

* api4/channel_test: check public channel names deterministically

* api4/file_test: fix darwin assertions on go files

* api4/notify_admin_test: fix expect/actual order

* api4/team_test: make TestGetAllTeams deterministic

* api4/plugin_test: avoid nested test helpers

* api4/post_test: avoid nested test helpers

* api4/websocket_test: externalize log buffer

* testlib/helper: unset common env

* linting issues

* simplify TestGetFileHeaders

* team_test: leverage ElementsMatch
2023-04-20 09:52:59 -03:00
Julien Tant
0a2a39773c
[MM-52152] Expose license SkuShortName to all users (#22955) 2023-04-19 10:38:56 -07:00
Tanmay Datta
1f57819054
[MM-51089] Fix sorting value of category in CreateSidebarCategoryForTeamForUser (#22455)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-19 09:59:49 -04:00
Pablo Andrés Vélez Vidal
b5c48e75b3
MM 50960 - Add company name and invite members pages to preparing-workspace for self-hosted (#22838)
* MM-50960 - store system organization name

* restore the preparing workspace plugins and invite screens

* add back the page lines for the design

* add lines back and organize styles

* set back documentation to monorepo style and disable board as a product

* fix organization link and style skip button

* create team on organization name screen continue button click

* make sure there are not already created team and if so just update team name

* update the team display name if team has already been created

* cover error scenarios during team creation

* add pr feedback and add a couple of unit tests

* fix translation server error; make sure only update display name if it has changed in the form

* temp advances

* rewrite unit tests using react-testing library; fix unit tests

* fix translations

* make sure the launching workspace finish in cloud installations

* remove redundant validation

* fix unit tests

* remove unintended config value left after merge conflict
2023-04-19 15:31:47 +02:00
Conor Macpherson
3ca789979a remove other use of relfection to determine error. 2023-04-19 09:23:45 -04:00
Kyriakos Z
a24111f9bd
MM-45009: Delete ThreadMemberships from "left" channels (#22559)
* MM-50550: Filter out threads from "left" channels v2

Currently leaving a channel doesn't affect the thread memberships of
that user/channel combination.
This PR aims to filter out all threads from those channels for the user.

Adds a DeleteAt column in the ThreadMemberships table, and filter out
all thread memberships that are "deleted".
Each time a user leaves a channel all thread memberships are going to be
marked as deleted, and when a user joins a channel again all those
existing thread memberships will be re-instantiated.

Adds a migration to mark all existing thread memberships as deleted
depending on whether there exists a channel membership for that
channel/user.

* Added migration files into list

* Fixes tests

* Fixes case where DeleteAt would be null

* Guard thread API endpoints with appropriate perms

* Deletes ThreadMembership rows upon leaving channel

* Minor style changes

* Use NoTranslation error

* Refactors tests

* Adds API tests to assert permissions on Team

* Adds tests, and fixes migrations

* Fixes test description

* Fix test

* Removes check on DM/GMs

* Change the MySQL query in the migration

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-19 15:20:34 +03:00
Agniva De Sarker
c34a50a6c7
MM-50427: Make MM survive DB replica outage (#22888)
We monitor the health of DB replicas, and on a fatal error,
take them out of the pool.

On a separate goroutine, we keep pinging the unhealthy replicas,
and on getting a good response back, we add them back to the pool.

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

```release-note
Mattermost is now resilient against DB replica outages and will
dynamically choose a replica if it's alive.

Also added a config parameter ReplicaMonitorIntervalSeconds
whose default value is 5. This controls how frequently unhealthy
replicas will be monitored for liveness check.
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-19 17:03:18 +05:30
Ben Schumacher
84a3042249
Update slash command permission (#22468)
* Update slash command permission

* Fix permission
2023-04-18 21:54:20 +02:00
Conor Macpherson
f0ed400732 remove use of reflection to detect app err. 2023-04-18 13:47:35 -04:00
Conor Macpherson
adb4ef04c1 Merge branch 'master' into MM-50966-in-product-expansion-backend 2023-04-18 12:07:48 -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
Conor Macpherson
98aa1f070b Merge branch 'master' into MM-50966-in-product-expansion-backend 2023-04-17 16:32:54 -04:00
Conor Macpherson
a1605d51f6 Remove checks for self hosted expansion featue flags/configs, add copy of the self hosted confirm handler specifically for expansions. 2023-04-17 16:02:04 -04:00
Conor Macpherson
61456b6846
Merge pull request #22917 from mattermost/MM-51907-route-true-up-telemetry-to-cws
MM-51907 - Route True-Up Review Telemetry to CWS
2023-04-17 15:47:21 -04:00
Conor Macpherson
a47c3cf859 Merge branch 'master' into MM-50966-in-product-expansion-backend 2023-04-17 15:39:37 -04:00
Conor Macpherson
aa7939264f Check if telemetry is disable, and only submit the true up profile if it is disabled. 2023-04-17 15:09:54 -04:00
Agniva De Sarker
56bf1b695a
MM-49984: Displaying active search backend in system console (#22721)
This will be shown in the system console to let users know
which search backend is active.

Implemented via adding an extra param in the ping response.

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

```release-note
The database section in the system console now has an additional
read-only section which shows the active search backend in use.

This can be helpful to confirm which is the currently active
search engine when there are multiple of them configured.
```
---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-14 14:28:50 +05:30
Agniva De Sarker
470e4c9d66
MM-51786: Sentry crash while installing a blocked plugin (#22804)
We would return "nil, nil" if a plugin was on the blocklist.
This would cause a nil dereference panic while trying to add
struct fields from manifest to the audit logs.

To avoid it, we return an error explicitly and ignore the
error ids to unnecessarily have it log an error.

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

```release-note
NONE
```
2023-04-14 13:32:05 +05:30
Ibrahim Serdar Acikgoz
a2e70eb71c
server/channels: remove newWebConn method (#22933) 2023-04-14 09:56:05 +03:00
Agniva De Sarker
574e61bcc1
MM-52009: Fix hub data race (#22925)
After the monorepo integration, the boards product
was started before we started the hub.

This led to a data race where the GetHubForUserId was actually
called before the hub was initialized.

To fix this we initialize the platform first, and then the products.

https://mattermost.atlassian.net/browse/MM-52009
```release-note
NONE
```
2023-04-13 19:39:16 +05:30
Conor Macpherson
27d959485e move setup/teardown into each test. 2023-04-13 09:54:58 -04:00
Conor Macpherson
7cc866ed89 actually fix tests through mocks. 2023-04-13 09:34:48 -04:00
Sinan Sonmez (Chaush)
35d3e3e91e
GH21563: Add the request context and logger to all public methods in app/admin.go (#22898)
* migrate mlog

* fix linter issue
2023-04-13 14:21:11 +05:30
Konstantinos Pittas
40349cddd4
[MM-51401] Add an extra check for the schema (#22531)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-13 11:00:55 +03:00
Julien Tant
2dafc51be2
Work Template: use mattermost-server/playbooks package instead of old playbook repo (#22908) 2023-04-12 13:53:22 -07:00
Conor Macpherson
0b731f4330 fix tests. 2023-04-12 16:22:10 -04:00
Conor Macpherson
eebd57ead1 Add ok response code to hopefully fix tests. 2023-04-12 15:06:55 -04:00
Conor Macpherson
dab14be745 fix mocks 2023-04-12 14:44:33 -04:00
Conor Macpherson
dcdc9c5f4b Merge branch 'master' of github.com:mattermost/mattermost-server into MM-50966-in-product-expansion-backend 2023-04-12 14:26:59 -04:00
Conor Macpherson
4bd3701363 remove new model in favor of making self hosted confirm payment method request more generic. 2023-04-12 14:15:11 -04:00
Conor Macpherson
451f169fea use a more generic model for self hosted confirm payment method. 2023-04-12 14:12:28 -04:00
Conor Macpherson
77e1fbfbc8 Change error upon failure of true up review submission to CWS. 2023-04-12 10:12:33 -04:00
Conor Macpherson
382894b41c revert change to show true up review when telemetry is enabled, always send true up data to CWS for telemetry capture. 2023-04-12 09:56:46 -04:00
Claudio Costa
b00ca20abe
[MM-50827] Detect content-type if missing in response during link metadata generation (#22885)
* Detect content-type if missing in response during link metadata generation

* Initialize buffer only when necessary
2023-04-12 07:53:03 -06:00
Ben Schumacher
4cc370098e
[MM-26398] Remove deprecated model.CommandArgs.Session (#22815) 2023-04-12 01:10:59 +02:00
Conor Macpherson
33d3c90654 Add mocks/layers. 2023-04-11 14:15:56 -04:00
Conor Macpherson
dd2e325c24 Ensure admins can send true up telemetry, even if telemetry is disabled. 2023-04-11 12:52:54 -04:00
Agniva De Sarker
bf952e690b
MM-52088: Skip Flaky test (#22910)
https://mattermost.atlassian.net/browse/MM-52088

```release-note
NONE
```
2023-04-11 21:40:42 +05:30
Julien Tant
6e7759b314
[MM-51844 & MM-51843] Work template permissions check (#22825) 2023-04-10 09:51:20 -07:00
Agniva De Sarker
bcf115e315
Upgrade mockery to fix errors (#22892)
Mockery started to throw errors like "Unexpected package creation during export data loading".

This was consistently reproducible locally and on upgrade, it has gone away.

```release-note
NONE
```
2023-04-10 14:20:57 +05:30
Jesse Hallam
4b7f6cb974
bind to localhost:0 for tests (#22839)
* bind to localhost:0 for tests

Explicitly bind to `localhost:0` instead of just `:0` to avoid binding to all available interfaces and in turn avoid triggering firewall warnings on MacOS.

* fix Playbooks to use dynamic port

* TestMetrics: handle ipv4 localhost too

* TestMetrics: linting
2023-04-06 09:59:58 -03:00
Rohitesh Gupta
7325c38c39
Fixes MM-50733 (#22784) 2023-04-05 21:58:21 +02:00
Konstantinos Pittas
7029d88443
[MM-51034] Sanitize embedded posts transmitted over WS (#22424)
Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-05 21:43:22 +03:00
Nick Misasi
62e6f29638
Undo accidental merge (#22848) 2023-04-05 11:24:32 -04:00
Nick Misasi
6fce376e7b
[MM-51905] Fix: Successful trial request shows error modal (#22800)
* License public key to test env for mono-repo

* Fix error modal showing on a successful trial request
2023-04-05 10:53:07 -04:00
Jesse Hallam
28ad1c80cd
fix various copy/paste/typos (#22823) 2023-04-05 10:18:50 -03:00
Allan Guwatudde
ed36e8bd64
[MM-51236] - Add opt-in checkbox in self-hosted account creation page (#22709)
* [MM-51236] - Add opt-in checkbox in self-hosted account creation page

* add server impl

* fix lint and translations

* add tests

* improvents

* fix model

* fix mocks

* feedback impl

* update text color

* handle error

* fix tests
2023-04-04 13:57:32 +03:00
Saturnino Abril
8d301c0d64
fix: /test url and json (#22780) 2023-04-04 06:04:11 +08:00
Ben Cooke
af4c98cdf9
[MM-51724] (#22740)
* createUserAccessToken updates

* lint
2023-04-03 14:30:07 -04:00
Agniva De Sarker
dacac2e3ed
MM-51768: Scrub username/password from SQL datasource (#22731)
https://mattermost.atlassian.net/browse/MM-51768
```release-note
NONE
```
2023-04-03 23:41:51 +05:30
Kyriakos Z
4d2ed469bf
MM-49564: Drafts upsert in the Store vs App layer (#22530)
* MM-49564: Upsert in the Store vs App layer

Refactor drafts so that Upserting a draft would happen in the DB and not
in the app layer.

* Fixes mocks

* Fixes tests

* Fixes translations

* Fixes tests

* Update tests

* Fixes tests

* Addresses review comments

- renames Save => Upsert
- removes Sleep from tests

* Fixes flaky test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-04-01 10:32:40 +03:00
Maria A Nunez
4a3c853636
Update Work Templates content and images (#22716)
* Enabled Work templates by default

* Remove board as product condition

* Removed playbook as a plugin condition

* Removed backend condition for playbook plugin/board product

* remove boards from templates

* Removed unnecessary translations after booards templates removal

* Removed template with no playbook or integration

* Updated entrypoint wording

* update texts

* update thumbnails

* update bigger pictures

* reorder i18n

* Copy updates. Add menu order

* Remove changed translations

* Updated casing for add menu

* Restored boards

* fix i18n

* Fix missing capital in text

* Added missing boards in template

* Updated feature release playbook image

* Updated channel preview for create a project

* Update title copy

* Updated create project thumbnail

* Generate updated work templates

* Updating snapshot

---------

Co-authored-by: Julien Tant <julien@craftyx.fr>
Co-authored-by: Julian Mondragon <bugshoo+github@gmail.com>
2023-03-31 16:12:56 -04:00
Doug Lauder
99467c6b68
MM-51792 Replace Boards feature flag with env var (#22739)
* remove Boards feature flag from server, makefile, and docker

* Update server/boards/server/boards_service_util.go

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>

---------

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
2023-03-31 10:29:29 -04:00
Nick Misasi
957f999266
[MM-51233] Updates for Trial Requests (#22620)
* Add new trial form to enrich trial requests with more customer info

* Update snapshots

* One more addition

* Fixes from PR feedback

* Fix types, i18n, update e2e tests

* Fix linter

* Fix i18n?

* Fix blank translation

* update snapshot

* Update snapshot properly

* Remove inapplicable test

* Fix business email validation only happening once

* UX Feedback

* Fix linter

* Fix linter again, not working locally

* FIX LINTER

* Move isvalid check until after some fields are set

* Fix for overlapping modals

* Fix linter

* UX feedback

* UX Feedback

* Fix typo in error modal

* [MM-51551] Add new Trial Form to Playbooks trial requests (#22650)

* Playbooks start trial entrypoints opens new trial form modal

* Fix style

---------

Co-authored-by: Mattermost Build <build@mattermost.com>

* [MM-51347] Trial form error modal for embargoed and air gapped entities (#22656)

* Playbooks start trial entrypoints opens new trial form modal

* Add support for air gapped environments when making trial requests

* Add specific handling for embargoed entities

* undo some code

* Fix linter

* Fix types

* Fix style

* Updates because TE has to upgrade to E0 before it can activate a trial

---------

Co-authored-by: Mattermost Build <build@mattermost.com>

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-03-30 14:57:07 -04:00
Harshil Sharma
22b3d9e4cb
Fixed MM-51060 (#22532)
* Fixed MM-51060

* Minor improvements

* Breaking bigger loops

* CI

* Removed an unintended line change

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-03-30 07:38:53 +05:30
Doug Lauder
40da76ddc8
MM-51705 Fixes Shared Channels issue due to SELECT('*') (#22660)
* remove all select('*') from shared channels store

* remove left join when fetching user
2023-03-29 11:17:51 -04:00
Allan Guwatudde
c70d85c9bc
[MM-51330] - Sentry Crash: nil pointer dereference in getSelfHostedProducts (#22569)
* [MM-51330] - Sentry Crash: nil pointer dereference in getSelfHostedProducts

* feedback impl

* fix bool

* remove double check

* fix failing tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-03-29 18:11:45 +03:00
Harshil Sharma
5da458a16f
Allowed searcginbg users by substring in admin console (#22505) 2023-03-29 17:11:55 +05:30
Conor Macpherson
dd7e84aca2 Add missing checks for self hosted expansion config enabled. 2023-03-28 14:46:27 -04:00
Mattermost Build
30921f5e52
Merge branch 'master' into MM-50966-in-product-expansion-backend 2023-03-28 20:45:40 +03:00
Agniva De Sarker
2287dff298
MM-51700: Suppress websocket warnings with a threshold (#22637)
We log warnings whenever our websocket buffer sizes exceed
certain thresholds. The problem with that is, when this happens,
the logs are completely spammed with these lines
making it annoying for the customer.

To improve the situation, we use a timer that only gets reset
every minute.

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

```release-note
NONE
```
2023-03-28 09:04:09 +05:30
Christopher Speller
ae6416e357
Remove configuration auto enable. (#22625)
* Remove configuration auto enable.

* i18n

* Fix diff tests.
2023-03-27 14:02:18 -07:00
Allan Guwatudde
0140e94d77
[MM-49751] - Turn off Inactive Server Email (#22648)
* [MM-49751] - Turn off Inactive Server Email

* remove unused var

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-03-27 22:38:19 +03:00
Conor Macpherson
1b9d97209d Merge branch 'master' of github.com:mattermost/mattermost-server into MM-50966-in-product-expansion-backend 2023-03-27 13:29:20 -04:00
Jesse Hallam
80c1431983
Revert testing workarounds (#22630)
* Revert "fix store issue take two"

This reverts commit 59f943c2c7.

* Revert "fix store override issue"

This reverts commit 29c346757a.

* Revert "Fix TestPushNotificationRace"

This reverts commit 6d62dddf86.

* Revert "fix default DSN for CI"

This reverts commit e0e69cdbb0.

* Revert "disable playbooks from more unit tests"

This reverts commit a1e97a9e96.

* Revert "disable playbooks for more tests"

This reverts commit 4d2dc74f05.

* Revert "disable playbooks for TestSAMLSettings"

This reverts commit 35c1a4312d.

* Revert "disable playbooks for more unit tests"

This reverts commit c049631a14.

* Revert "disable playbooks for mocked enterprise tests"

This reverts commit 829317fddb.

* Partially revert "disable playbooks for channel/apps mocked tests"

This reverts commit 52b4a0a6cf.

* Revert "fix TestUnitUpdateConfig"

This reverts commit 8f134f2a8a.

* Revert "add plugin mock to TestUnitUpdateConfig"

This reverts commit 3ec5419092.

* Revert "disable Boards for more test helpers"

This reverts commit 5d4d0d02d9.

* Revert "disable boards at correct place in test helpers"

This reverts commit 0c9e175f79.

* Partially revert "disable boards for slash cmd tests"

This reverts commit fad8d9de93.

* Revert "disable Boards for channels web tests"

This reverts commit 15540fdfc0.

* Revert "Adds a teardown function to playbook server tests to disable and reenable boards"

This reverts commit 9a46e3d0f4.

* Revert "Test disable boards through feature flag"

This reverts commit 787044add8.

* TestUnitUpdateConfig: restore callback check

* Revert "Revert "fix default DSN for CI""

This reverts commit 01b879d55a.
2023-03-27 13:19:29 -03:00
Nathaniel Allred
b7f2c00554
return 404 if the enterprise library error returned is 404 (#22628) 2023-03-27 08:21:29 -05:00
Allan Guwatudde
ee068726bc
[MM-51467] - NotifyAdmin job reports an error for unlicensed servers (#22568)
* [MM-51467] - Reduce frequency for notify install plugin job

* [MM-51467] - NotifyAdmin job reports an error for unlicensed servers

* .

* fix imports
2023-03-27 10:50:45 +03:00
Conor Macpherson
ff01fabc32 add mocks. 2023-03-24 16:30:26 -04:00
Conor Macpherson
9d8597b399 add self hostded expansion mm-server parts. 2023-03-24 15:11:17 -04:00
Agniva De Sarker
176a58617d
MM-51504: Control compliance export goroutine (#22604)
Spawn a goroutine from the server layer to have better
control for compliance tests.

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

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
2023-03-24 13:56:19 +05:30
byigorv
017c51c246
fix mem leak in hubConnectionIndex (#22560) 2023-03-24 11:22:37 +05:30
Agniva De Sarker
56b18ca7bf
MM-45956: Optimize FileInfo stats query (#22603)
* MM-45956: Optimize FileInfo stats query

We Denormalize Post.ChannelId on FileInfo.ChannelId

```release-note
The file info stats query is now optimized by denormalizing the channelID column into the table itself. This will speed up the query to get the file count for a channel on clicking the RHS.

Migration times:
On a MySQL 8.0.31 DB with
1405 rows in FileInfo and 11M posts, it took around 0.3s

On a Postgres 12.14 DB with
1731 rows in FileInfo and 11M posts, it took around 0.27s
```

https://mattermost.atlassian.net/browse/MM-45956
2023-03-23 22:14:04 +05:30
Agniva De Sarker
19c7c6fa7a
MM-51486: Implementing UTS 46 to check for preview blocklist (#22601)
There is a standard IDNA2008 which defines how unicode characters
in domain names can be compared using UTS (Unicode Technical Standard) 46.

We use that to convert any links in messages to ASCII and
then compare with the domain list in config.

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

```release-note
NONE
```
2023-03-23 13:03:59 +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