* 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.
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
```
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
```
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
```
* 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
```
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
```
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
```
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.
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
```
* 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>
* 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
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
```
* 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.
* 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>