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

3078 Коммитов

Автор SHA1 Сообщение Дата
Martin Kraft
55b3961b98 MM-45120: Track team join times. Add API to retrieve new team members since a given time. (#20708)
* MM-45120: Starts tracking team join time. Adds API to retrieve team members who joined after a given time.

* MM-45120: Updates json casing to match model.User.
2022-08-11 10:38:52 -04:00
Tim Scheuermann
1738bd6e92 [MM-45991] Check and return JSON errors (#20735) 2022-08-10 10:56:58 +02:00
Tim Scheuermann
b4570afa90 Replace deprecated ioutil with io and os (#20776)
* Replace ioutil with io and os

* Replace ioutil in utils/file.go

* Minor fix to tests and excluded files

Co-authored-by: Tim Scheuermann <tim.scheuermann@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-08-09 14:25:46 +03:00
Ashish Bhate
15b6046a62 MM-44922: Flush log buffer before assert (#20795)
Summary
Flush log buffer before asserting log text.

Ticket Link
https://mattermost.atlassian.net/browse/MM-44922
2022-08-09 16:49:43 +05:30
Agniva De Sarker
97b3ffd7ea MM-43202: Change some 501 response codes to fix SLO violations (#20767)
There were lots of cases where we were using the code 501
in an incorrect manner, and since 5xx codes are considered
as SLO violations, these were flagged by our monitoring incorrectly.

These were the guidelines to change the codes:
1. Any case of missing license or config not correctly enabled
is set as Forbidden. The logic is that the user is correctly
authenticated with a session, but does not have enough privileges
to have the higher license, or hasn't changed the config correctly.
2. Any case of incorrectly formed request is obviously a 400.

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

```release-note
NONE
```
2022-08-08 20:02:49 +05:30
Ibrahim Serdar Acikgoz
f0e4794cda Move config store into Platform Service (#20718)
* update config methods
2022-08-08 16:52:31 +03:00
Agniva De Sarker
14246abdef MM-45993: Return errors during sending websocket messages (#20760)
During attaching an object to a websocket message, we would
marshal it to json and attach the string output. But if the
marshalling failed, we would just log a warning and move on.

This would add an empty string to the message. But the client
assumes that the object is correctly attached and would
fail silently if it cannot find it.

So we become more strict and return the error so that
it reaches the caller.

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

```release-note
NONE
```
2022-08-05 08:49:01 +05:30
Agniva De Sarker
151f295d82 MM-45021: Fix flaky testGetFlaggedPostsForUser (#20769)
The method a.postRemoveFromChannelMessage was being called
from a goroutine. Therefore, when SystemAdminClient.GetFlaggedPostsForUser
was being called later in the test with a mock post store,
it would naturally fail because the store would now be a
different store but the goroutine was supposed to be finished.

A hacky solution would be to add a sleep before
starting the mocked API call. But a deeper question
is why was the method run in a goroutine in the first place.

Removing a user from a channel is not a very common operation
and even if we look at the method, if the user is trying to
remove themselves, that message happens synchronously, but if
they are removing another user, that runs in a goroutine.

This seems like a very weird behavior. Therefore, to be consistent
I have just removed the goroutine and made everything synchronous.

The next step would be to stop logging an error and just return
the error upwards instead. Because that's what happens in the other
condition. But that would be exceeding the scope too much. Maybe
in a separate PR.

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

```release-note
NONE
```
2022-08-04 22:07:19 +05:30
Tim Scheuermann
2365f1286b [MM-46054] Log missing default channels (#20738) 2022-08-04 11:15:54 +02:00
Agniva De Sarker
6cc9933b58 Fix minio client breakage with bifrost round 2 (#20758)
* Revert "Revert "MM-43828: Pass object length for some image operations (#20711)" (#20740)"

This reverts commit c7ae090dad.

* Fix to work in bifrost mode

```release-note
NONE
```
2022-08-04 11:21:51 +05:30
Pablo Andrés Vélez Vidal
e7156476fa MM-45542 - do not fail if site url is not set when requesting trial (#20713)
* MM-45542 - do not fail if site url is not set when requesting trial

* remove unnecessary text

Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-08-03 23:54:43 +02:00
Agniva De Sarker
f07c31c5d9 MM-45196: Migration api4/command and app/cmd to logger context (#20730)
```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-08-02 20:48:54 +05:30
Ibrahim Serdar Acikgoz
ac79a887a2 Move metrics under platform service (continued) (#20732)
* move metrics into platform

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2022-08-02 10:59:29 +03:00
Agniva De Sarker
55f64195b1 MM-45195: Use api4/bot and app/bot to use logger context (#20729)
https://mattermost.atlassian.net/browse/MM-45195

```release-note
NONE
```
2022-08-01 13:48:45 +05:30
Agniva De Sarker
c7ae090dad Revert "MM-43828: Pass object length for some image operations (#20711)" (#20740)
Automatic Merge
2022-07-29 17:53:14 +03:00
Agniva De Sarker
887bc0173e MM-45715: Fix incorrect permissions (Round 2) (#20731)
We missed a case to return if there are no
items in the slice. Otherwise it falls through
and returns false incorrectly.

Rectified the tests to trigger the case.

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

```release-note
NONE
```
2022-07-29 09:58:44 +05:30
Tim Scheuermann
832736da37 [MM-45990] log JSON parsing errors in API4 (#20724) 2022-07-28 17:05:03 +02:00
Agniva De Sarker
d4b710b3ab MM-45194: Switch app/user and api4/user to logger context (#20674)
```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-28 10:04:21 +05:30
Agniva De Sarker
90c6350410 Revert "move metrics server into platform service (#20683)" (#20726)
This reverts commit b18a42313b.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-27 21:30:25 +02:00
Agniva De Sarker
072c859219 MM-43828: Pass object length for some image operations (#20711)
For user profile and plugin upload, we use a bytes.Buffer.
In that case, we know the object size and can find
it out from the length of the buffer.

This helps reduce multi-part uploads.

This approach can also be taken in thumbnail and preview
images. However, they use an io.Pipe to directly upload
the image as it is being encoded. We could make the whole
process in separate parts of writing the full image in the
buffer and then upload it. But taking a conservative approach
for now.

Also, while here, removed some unused code.

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

```release-note
NONE
```
2022-07-27 19:02:24 +05:30
Tim Scheuermann
eba08cbb11 Replace ioutil.Discard with io.Discard (#20707) 2022-07-27 11:40:33 +02:00
Julien Tant
1044fba449 [MM-45817] Set cloud cookies whenever user gets logged in (#20692) 2022-07-26 07:47:09 -07:00
Agniva De Sarker
20cb042362 Hackathon: Post Reminders (#20555)
This PR adds the post reminder backend work.

We add a new API endpoint via which a user can set a reminder for a post. An ephemeral message will be sent down the line to let the user know about the action. And then after the time is over, the system admin bot will send a DM message to the user about the reminder post.
2022-07-26 16:12:56 +05:30
Agniva De Sarker
7441a26b6d MM-45871: Do not try to extract content from images (#20698)
This creates faulty requests to Bifrost and results in
errors and warnings in the logs. Even without Bifrost,
this would make unnecessary requests to S3.

We only extract info from documents and therefore we can
safely avoid this.

```release-note
NONE
```
2022-07-26 12:17:23 +05:30
Nathaniel Allred
77881fc357 Mm 43609 (#20657)
* return first inaccessible post time instead of has inaccessible posts
2022-07-25 16:01:59 -05:00
Ibrahim Serdar Acikgoz
b18a42313b move metrics server into platform service (#20683)
move metrics into platform
2022-07-25 16:54:06 +03:00
Agniva De Sarker
fa9477d332 MM-45000: Upgrade to new opengraph module path (#20701)
https://mattermost.atlassian.net/browse/MM-45000

```release-note
NONE
```
2022-07-25 14:25:32 +05:30
Claudio Costa
9255671222 [MM-45862] Set size and extension to fileinfo (#20681)
* Set size and extension to fileinfo

* Remove unnecessary check
2022-07-22 09:14:01 +02:00
Riccardo Santoni
3d7859396d [MM-42194] Get file information from a deleted post (#20279)
* Introduced inlcude_deleted query parameter to allow admins to retrieve contents of post regardless of deletion status

* Introduced new client route and tests for getting file info of deleted posts

* Fixed tests due to caching of posts

* gofmt

* Small formatting updates

* Invalidating file infos cache on delete of post if post includes files

* Including deleted in migration flow

* Moved invalidating of cache

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-21 11:11:08 -04:00
Michael Kochell
bc7f961d75 Store plugin OnActivate errors and include them in PluginStatus response (#20430)
* store plugin OnActivate errors, and include in PluginStatus

* write test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-21 10:55:57 -04:00
Lev
dc366bc1e2 MM-45208: strip post meta for plugins (#20686)
Try two...

* Revert "Revert "Removed the opengraph type dependency for plugins by stripping post Metadata (#20612)" (#20684)"

This reverts commit 32dee6d449.

* Fixed race condition

* PR feedback

* lint
2022-07-21 07:11:18 -07:00
Agniva De Sarker
32dee6d449 Revert "Removed the opengraph type dependency for plugins by stripping post Metadata (#20612)" (#20684)
This reverts commit da7a8a4552.
2022-07-20 20:09:03 +05:30
Ibrahim Serdar Acikgoz
6376f7ff55 app/platform: add initial platform service skeleton (#20679) 2022-07-20 15:04:26 +03:00
Lev
da7a8a4552 Removed the opengraph type dependency for plugins by stripping post Metadata (#20612) 2022-07-20 04:50:56 -07:00
Tim Scheuermann
cb6cee1883 [MM-45769] Properly initialize the request.Context for imports and tests (#20659) 2022-07-18 10:58:06 +02:00
Doug Lauder
2aaf4cf0fb Fix broken master; ensure all product service APIs have correct implementations (#20663)
* fix broken master; ensure all product service APIs are implemented by the structs passed to products

* use zero allocation interface checks
2022-07-15 13:20:40 -04:00
Ossi Väänänen
0c5c74904b Audit logging - new schema (#20447)
* Audit logging - new schema added, old schema removed.

* fix linter error by running goimports

* Address review comments

* Address review comments

* Example usage of new audit logging API for the updateUserAuth call

* fixed unit test on auditing updating user record

* Changed the `TestUpdateConfigDiffInAuditRecord` testcase---it failed, because this PR changes how the `meta` field is serialized into the audit log records.

* fix linter error
2022-07-14 11:19:33 +02:00
Tim Scheuermann
6dc897b04f MM-45193 Use context for channel logging (#20575) 2022-07-14 11:01:29 +02:00
Agniva De Sarker
5f4da3f308 MM-45725: Skip BusySet (#20647)
https://mattermost.atlassian.net/browse/MM-45725

```release-note
NONE
```
2022-07-14 12:17:52 +05:30
Martin Kraft
1f34e8ba2e MM-44351: Creates new Custom Group Admin system role. (#20573)
* MM-44351: Creates new Custom Group Admin system role.

* MM-44351: Adds missing test mock.

* MM-44351: Adds missing mocks.
2022-07-13 09:38:07 +02:00
Agniva De Sarker
049e67b863 MM-45535: Batch optimize auth checks in GraphQL (#20634)
We create two new auth checks which take multiple channels
and teams. They can be used to check whenever a user needs
access to multiple entities.

These are then access in dataloaders to ease the load in the
database.

```release-note
NONE
```
2022-07-12 23:26:48 +05:30
Agniva De Sarker
1d2cb7c805 Fix incorrect dead queue clear logic (#20624)
We were incorrectly returning from the method without
resetting the pointer.

Fixes https://github.com/mattermost/mattermost-server/issues/20622

```release-note
NONE
```
2022-07-11 23:26:47 +05:30
Doug Lauder
ba9f82e010 Additional APIs for Focalboard multi-product architecture (#20608)
- adds HasPermissionToChannel to permissions service
- adds GetChannelsForTeamForUser to channel service
2022-07-11 13:43:15 -04:00
Martin Kraft
a46840e96b MM-45395: Exclude bot and webhook posts from Top Team Channels. Exclude webhook posts from My Top Channels. (#20599)
* MM-45395: Exclude bot and webhook posts from Top Team Channels. Exclude webhook posts from My Top Channels.

* MM-45395: Adds missing error test.

* MM-45395: Adds missing whitespace.
2022-07-11 08:58:40 -04:00
Nathaniel Allred
f639122376 Usage: Round messages to 1K, files to 100MB (#20603) 2022-07-11 07:21:29 -05:00
Claudio Costa
76583344c0 [MM-45504] Improve GIF preprocessing logic (#20595)
* Improve GIF preprocessing logic

* Prefer io to ioutil

* Avoid color palette allocation
2022-07-11 09:34:49 +02:00
Nathaniel Allred
ad181532af ComputeLastAccessiblePostTime returns error interface (#20598) 2022-07-07 15:01:50 -05:00
Vishal
e5ee5eecd8 [MM-44488] Cloud limits: enforcing messages (#20362)
* Add new Job to keep updating the last_accessible_post time

* Filter out posts for funcs returning PostList model

* Separate methods to get and compute cache

* filter pinned posts

* For posts with sorted CreateAt order, support a faster form of filtering.

* Add inaccessible header for getPost and getPostsByIDs APIs

* replace manual binary search with the std. library

* in-place filter posts

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Nathaniel Allred <neallred@protonmail.com>
2022-07-06 11:56:39 +05:30
Lev
c62d4bee5f Moved UserHasJoinedTeam callback to after the processing (#20410)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-05 16:51:22 -07:00
Martin Kraft
b99bd0d049 MM-45204: Enables Insights feature flag by default. (#20509)
* MM-45204: Enables Insights feature flag by default.

* MM-45204: Update test.
2022-07-05 09:16:44 -04:00