Граф коммитов

2915 Коммитов

Автор SHA1 Сообщение Дата
Ashish Bhate
d40d216b57 [MM-43073] broadcast post unread websocket when CRT off (#19927)
* [MM-43073] broadcast post unread websocket with CRT off

* clean up debug

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-06 16:42:31 -04:00
Mylon Suren
77ec4aa404 [MM-41041] Remove requirement for create_at in UpdateUser (#19597) 2022-04-06 14:42:52 -04:00
Michel Engelen
2813a1caac fix for adjusting post editing time limit to not need a server license anymore (#19890) 2022-04-04 13:07:42 -04:00
Nick Misasi
650ad3b3ae [MM-42822] Check for and return HTTP 451 for all trial requests (#19873)
* Check for and return HTTP 451 for all trial requests

* Use constant in another spot too

* add a test

* Update test name
2022-04-04 09:48:14 -04:00
Fareck Allony
3f5eb5f6f7 Adding is_pinned attribute to post and direct_post objects when doing bulk import (#19487)
* refactor: added is_pinned attribute to post and direct_post objects when doing bulk import

* fix: handling IsPinned nil value in post and direct_post objects import

* refactor: added pinned post tests for post and direct_post objects import

* refactor: TestImportimportMultiplePostLines code enhancements + added pinned post tests in TestImportImportDirectPost

* fix: test message text

* fix: typo Post => DirectPost

* fix: typo Post => DirectPost

* refactor: remove redundant test

* refactor: test enhancements

* refactor: remove print statements.

* refactor: using require instead of assert

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-04 15:29:42 +03:00
Ashish Bhate
9521797b15 MM-40148: threadsOnly query param for user threads (#19833)
* MM-40148: threadsOnly query param for user threads

Currently we always calculate counts when fetching user threads.
Those counts include total, unread replies, and unread mentions,
and are potentially expensive to calculate.

This commit adds a new query param 'threadsOnly' which won't calculate
any counts and just return threads.

Co-authored-by: koox00 <3829551+koox00@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-04 17:50:13 +05:30
Ibrahim Serdar Acikgoz
b1b9774efa app/post_metadata: add a type cast check for OpenGraph images (#19877)
* app/post_metadata: add a type cast check for OpenGraph images

* change log level

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-04-04 13:27:18 +03:00
Allan Guwatudde
c17e210dd0 [MM-40962-2] - Fix unnecessary logging in license expiration check (#19826)
* [MM-40962-2] - Fix unnecessary logging in license expiration check

* skip check for TE

* document

* feedback impl-1

* fix logic

* remove saving of renewal token

* fix lint

* remove commented code

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-31 18:25:46 +03:00
Allan Guwatudde
fa56ee9d9a [MM-42713] - Remove cloud user limit restrictions (#19835)
* [MM-42713] - Remove cloud user limit restrictions

* remove unused code

* fix translations

* feedback impl-1

* enterprise code clean up

* feedback impl-2

* fix mocks

* fix translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-31 18:24:38 +03:00
Julian Mondragón
baf9f69c27 MM-41407_Remove FF for MM-39053 Default Notifications (#19851) 2022-03-30 12:07:03 -05:00
Allan Guwatudde
82c8bd33ed [MM-42703] - Add configuration setting to disable Inactive Server email notification (#19831)
* [MM-42703] - Add configuration setting to disable Inactive Server email notification

* remove log

* add config to telemetry

* fix lint
2022-03-30 11:31:46 +03:00
Ibrahim Serdar Acikgoz
0efb7bf07d app/teams: add getMember method (#19862) 2022-03-30 09:54:46 +03:00
Ibrahim Serdar Acikgoz
a4a6fe0a94 app: add posts wrapper (#19816) 2022-03-29 12:44:52 +03:00
Ibrahim Serdar Acikgoz
d33ef8d79c app/products: add dependency resolver (#19847)
* app/products: add dependency resolver

* reflect review comments
2022-03-29 11:58:29 +03:00
Julien Tant
0babc01749 [MM-41998] Channel Info RHS: display number of files for a channel (#19822)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-25 13:28:14 -07:00
Ibrahim Serdar Acikgoz
1c49366f00 app/user: ensure that user gets sanitized while calling plugin hooks (#19808) 2022-03-25 12:39:11 +03:00
Agniva De Sarker
c1f3827801 MM-38164: Paginate the GetPostThread API (#19485)
We implement a cursor based pagination model
to page through the posts in a given thread.

The cursor is a combination of the post.CreateAt+
post.Id to differentiate multiple posts in a given
timestamp.

Some additional parameters like direction, fromPost,
fromCreateAt and perPage were introduced to implement
this.

```release-note
NONE
```
2022-03-24 12:51:41 +05:30
Ashish Bhate
2385bbdd50 MM-42535: Set ThreadAutoFollow to true by default (#19797)
Summary
A number of performance improvements shipped in v6.5 to support CRT with the ThreadAutoFollow bookkeeping enabled but the frontend features disabled. To prepare for a later enabling of the frontend features by default, we want to encourage customers to re-enable ThreadAutoFollow, and plan to enable this by default in v6.6.

Ticket Link
https://mattermost.atlassian.net/browse/MM-42535
2022-03-23 21:00:53 +05:30
Ibrahim Serdar Acikgoz
42125bff4a app: add plugin-api/cluster interface provider (#19720) 2022-03-21 21:38:48 +03:00
Carrie Warner (Mattermost)
dcd66d2146 MM-41988 Updated links to legacy domain about.mm.com (#19552)
* Updated links to legacy domain about.mm.com

* Legacy link updates

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* Reverting - only need to change en.json

* about.mm.com URL updates

* mattermost.org URL updates

* forum.mm.org URL update

* Update .github/ISSUE_TEMPLATE.md

* Update .github/ISSUE_TEMPLATE.md

* Un-deleted language files

* Update README.md

* Update tests/test-config.json

* fix some test due to url updating (#19787)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2022-03-16 19:47:57 +08:00
Ben Schumacher
7710a2fe37 [MM-40735] Add MattermostAppID to OAuth app (#19214) 2022-03-15 18:00:27 +01:00
Ben Schumacher
8d72cabee8 Update session cache if a plugin extends a session (#19178) 2022-03-15 17:38:09 +01:00
Agniva De Sarker
4da98cb51a Kill gorp (#19786)
* Kill gorp

Gorp is dead. Long live Gorp.

```release-note
NONE
```
2022-03-15 19:49:19 +05:30
Ibrahim Serdar Acikgoz
b03d87af40 [MM-41576] Add schema version to the client configuration (#19757)
* revamp db version and add applied migrations endpoint

* replace old schema version with new

* add db version subcommand

* add to local api

* reflect review comments

* log errors

* remove setting the version from model.CurrentVersion

* fix a test

* use different field for schema version

* add build hash and current version to the support packet

* add tests

* update test to use new assets
2022-03-15 16:39:23 +03:00
Jesse Hallam
47c44a9b7d break up getThreadsForUser, leverage errgroup (#19709)
* MM-42282: handle teamId parameter correctly

As per https://community-daily.mattermost.com/core/pl/ugs7ue6e4j8a7cgegk1bxje8to, `ThreadStore.GetThreadsForUser` accepts a `teamId` parameter, but incorrectly handles an empty value of `""` as looking only for channels with an empty `teamId` (aka DMs and GMs) instead of finding all channels and effectively ignoring the team property.

Fixes: https://mattermost.atlassian.net/browse/MM-42282

* break up getThreadsForUser, leverage errgroup

This change breaks up `GetThreadsForUser` in the `ThreadStore` into its constituent `GetTotalUnreadThreads`, `GetTotalThreads`, `GetTotalUnreadMentions`, and the original `GetThreadsForUser` but now solely returning the thread structures. Instead of a monolithic method at the store level, the application layer now handles calling bulk requests, leveraging `errgroup` for simpler parallelization.

This change brings with it a few benefits:
* Simpler code, including more idiomatic usage of squirrel
* Simpler SQL, joining tables only when configured conditions require same. (No performance benefit here, since an unused LEFT JOIN generally has no overhead.)
* Discrete Grafana metrics for each store method, giving us better insight into the performance characteristics in play.
* **Performance boost**: reduced overhead when clearing push notifications.

This last point is what prompted the re-re-reactoring in this PR. As I broke things up, I realized that `clearPushNotificationSync` only used the `TotalUnreadMentions`, but asked for the count of total threads and total unread threads. By exposing the discrete methods, this code path avoids two aggregate queries. We clear notifications when marking a thread as read, and when marking a channel with unread mentions as viewed, so I expect we'll see at least a modest boost to performance from simply not wasting these cycles anymore.

No performance improvements are expected from this PR for the general case of using `GetThreadsForUser` to populate the threads view.

* never discard errors from building queries

* no MustSql

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-15 10:29:00 -03:00
Guillermo Vayá
4bf3d6a7f5 [MM-40179] Go into directories when trying to export attachments (#19249)
* MM-40179 traverse directories when trying to export

* fix test

* fix s3 to behabe the same way

* add test for paths way too deep

* test recursion only on localstorage

* make list directories non recursively the default approach

* fix linting error

* fix non-recursive case

Co-authored-by: = <=>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-15 12:57:29 +01:00
Nathaniel Allred
3531432738 Mm 42465 (#19771)
* when plugins are disabled, still allow onboarding to complete
2022-03-11 09:08:49 -06:00
Agniva De Sarker
7664c9d709 MM-40818: Pass filestore to channels (#19677)
We move away from referencing server struct
but pass the filestore service to Channels
explicitly.

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-10 19:49:05 +05:30
Agniva De Sarker
856f9b11af MM-40817: Use license interface in Channels (#19678)
* MM-40817: Use license interface in Channels

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-10 09:00:29 +05:30
Pablo Andrés Vélez Vidal
4deedbbfd3 MM-42049 - license endpoint not working (#19686) (#19748)
Automatic Merge
2022-03-08 19:16:58 -04:00
Jesse Hallam
a2a78577e9 Revert "[MM-41576] Revamp database schema version (#19586)" (#19746)
* Revert "[MM-41576] Revamp database schema version (#19586)"

This reverts commit 645fee3fe3.

* Revert "MM-42049 - license endpoint not working (#19686)"

This reverts commit 4fe89e5847.
2022-03-08 16:28:28 -04:00
Pablo Andrés Vélez Vidal
4fe89e5847 MM-42049 - license endpoint not working (#19686)
Automatic Merge
2022-03-08 20:14:19 +02:00
Allan Guwatudde
12308f3612 [MM-42121] - Inactive Server Email Notification sends duplicate emails of every admin to original admin (#19668)
Automatic Merge
2022-03-08 18:14:20 +02:00
Ibrahim Serdar Acikgoz
645fee3fe3 [MM-41576] Revamp database schema version (#19586)
* revamp db version and add applied migrations endpoint

* replace old schema version with new

* add db version subcommand

* add to local api

* reflect review comments

* log errors

* remove setting the version from model.CurrentVersion

* fix a test
2022-03-08 18:13:37 +03:00
Agniva De Sarker
05503440a6 MM-42378: Fix server crash while loading license (#19733)
* MM-42378: Fix server crash while loading license

The user service needs to be created before
loading license.

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

```release-note
NONE
```

* Further fix

```release-note
NONE
```
2022-03-08 22:58:29 +08:00
mkraft
21f1d2aabc MM-42201: Enforce group is not the same as username. (#19660)
* MM-42201: Enforce group is not the same as username.

* MM-42201: Adjust test for change to translation id.
2022-03-08 09:14:22 -05:00
Mylon Suren
23f3a55cb6 [MM-41815] Fix custom status not handling update user errors (#19588)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-07 19:16:45 -05:00
Doug Lauder
b12ec9c7c4 Exclude bots when restricting DMs to team members. (#19713)
* Exclude bots when restricting DMs to team members.
2022-03-07 17:23:44 -05:00
Agniva De Sarker
a2fc602bc2 MM-40813: Use config service more extensively (#19679)
https://mattermost.atlassian.net/browse/MM-40816

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-07 20:48:55 +05:30
Agniva De Sarker
84a733ed56 Move cluster init during server start (#19684)
After refactoring the channels init, the
config service under channels won't have
the config hash until the product gets
started. This caused an issue during
cluster initialization.

Therefore moved it after the product start.

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-07 19:41:52 +05:30
Claudio Costa
897e7bb9e7 Only set cluster if unset (#19683) 2022-03-07 10:24:23 +01:00
Jesse Hallam
f5b5a3c746 MM-40302: CRT, fix performance of MarkAllAsReadInChannels (#19566)
* deadcode: remove UpdateChannelLastViewedAt

* deadcode: remove ThreadStore.(Save(Multiple)|Update|Delete)

* deadcode: followThead in App.MarkChannelAsUnreadFromPost

* document ThreadMembership, Thread structs

* maintain LastUpdated consistently

Whenever we touch a `ThreadMembership` record, we should be setting `LastUpdated` to the current timestamp. The mobile client relies on this to detect changes to these records.

* simplify: never updateThreads from `App.MarkChannelAsUnreadFromPost`

Change all invocations of `ChannelStore.UpdateLastViewedAtPost` from `App.MarkChannelAsUnreadFromPost` to pass `updateThreads` as `false`. When `ChannelStore.UpdateLastViewedAtPost` was invoked with `updateThreads` as `true`, it would in turn call `ThreadStore.UpdateUnreadsByChannel` but pass `updateViewedTimestamp` as `false`. This effectively updated the `LastUpdated` field of the corresponding thread memberships but never touched any of the actual data (such as `LastViewed`).

The overall CRT feature continued to work, because `App.MarkChannelAsUnreadFromPost` directly updates the relevant thread memberships via `ThreadStore.MaintainMembership`.

* deadcode: updateThreads in ChannelStore.UpdateLastViewedAtPost

* simplify: never updateThreads from App.SendNotifications

Change all invocations of `ChannelStore.IncrementMentionCount` from
`App.SendNotifications` to pass `updateThreads` as `false`. When `ChannelStore.IncrementMentionCount` was invoked with `updateThreads` as `true`, it would in turn call `ThreadStore.UpdateUnreadsByChannel` but pass `updateViewedTimestamp` as `false`. This effectively updated the `LastUpdated` field of the corresponding thread memberships but never touched any of the actual data (such as `UnreadMentions`).

The overall CRT feature continued to work, because `App.SendNotifications` directly updates the relevant thread memberships mention counts via `ThreadStore.MaintainMembership`.

* deadcode: updateThreads in ChannelStore.IncrementMentionCount

* fix & rename ThreadStore.UpdateUnreadsByChannel

Rename `ThreadStore.UpdateUnreadsByChannel` to `ThreadStore.UpdateLastViewedByThreadIds`, making it unconditionally set the `LastViewed` for the given threads (as well as `LastUpdated`).

All previous invocations of this method that passed `updateViewedTimestamp` have been previously removed.

* unrelated gofmt -w -s changes to satisfy linter

* always set LastUpdated to model.GetMillis()

* deadcode: ThreadStore.SaveMembership

* fix TestMarkUnreadWithThreads

* MM-40302: CRT, use updateThreads param vs. MarkAllAsReadInChannels

`MarkAllAsReadInChannels` was the subject of a significant performance regression in v5.37 and is known to be very inefficient, by virtue of always writing to an ever increasing number of rows, and doing so on common events like simply viewing a channel.

Fortunately, `ChannelStore.UpdateLastViewedAt` already supported an `updateThreads` parameter that implemented the start of an improved algorithm: query the set of threads with newer posts, and then update only /those/. Missing was the need to reset the `UnreadMentions`, but thanks to the previous simplifications in #19523, we can make this change largely without impacting other semantics.

Fixes: https://mattermost.atlassian.net/browse/MM-40302

* fix MySQL

* remove another JOIN

* remove outdated comment

* unit tests
2022-03-06 19:55:59 -04:00
Moises Sanchez
c114aba628 [MM-41170] Disable bot accounts from getting notification emails (#19447) 2022-03-05 16:10:25 +01:00
Shaz Amjad
1b41957239 API includes sort_order, and WebSocket includes data (#19157)
* API includes sort_order, and WebSocket includes data

* Adds sort_order API test

* MM-40470: Tests that new WS payload is sent after categories are updated via API.

* Update api4/channel_category_test.go

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>

Co-authored-by: Martin Kraft <martin@upspin.org>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2022-03-04 13:25:15 +01:00
Ben Schumacher
275adc8c30 [MM-41981] Always install the latest compatible version via the Marketplace (#19613) 2022-03-03 22:53:01 +01:00
Julien Tant
71db595173 [MM-41844] Warn cloud admin about workspace deletion at end of trial (#19672)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-03 10:56:45 -07:00
Christopher Speller
4ecd071275 Add new playbooks permissions. (#19661) 2022-03-03 08:10:41 -08:00
Agniva De Sarker
ab8de49f0a MM-40818: Refactor product initialization to happen late (#19658)
This is more of a general refactor of the initialization
process which should allow us to pass services more
easily.

The changes are minimal to keep the scope limited.
For now, the objective is to pass the file service
to the Channels product. For that, it was required
to move some of the enterprise interfaces under Channels
from Server.

We also create a filestore field in the server to
avoid creating filestore reference every time
we make a filestore operation. This will be later
passed on to the Channels product.

Also removed an unnecessary test. 
The test was working so far because we were creating
the filebackend every time for every request. But
we should go via UpdateConfig call which would fail,
were we to assign an invalid filestore name.

So we were actually testing for a different thing.
Therefore, removed the test.

```release-note
NONE
```
2022-03-03 12:22:10 +05:30
Agniva De Sarker
768fe43d3a MM-41752: Batch update mention increment (#19596)
Previously, we were incrementing mentions one-by-one
all concurrently in an unbounded fashion.

This would cause a big spike in memory usage if there
were an `@all` mention in a large channel.

We fix this by changing the SQL query to take all userIDs
at once.

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-03 08:50:19 +05:30
Julien Tant
dd100a3a69 [MM-41785] Show error in invitation popin when email can't be send (#19617)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-02 14:26:57 -07:00