* add from_integration prop to oauth posts to:
- oauth app posts
- plugin posts
- slash command responses
- incoming webhook posts
* tests
* include check for bot posts
* use from_plugin and from_oauth_app props
* fix test
* avoid counting top channel posts for posts made by plugins and oauth apps
* MM-42191: Include deleted posts: Add includeDeleted query parameter for getPostsForChannel
* MM-42191: Fix error typo for includeDeleted query parameter
* MM-42191: Include deleted posts: Set permission error when deleted posts are requested by non system admins
* MM-42191: Include deleted posts: Refactor replyCountSubQuery and conditions when includeDeleted is not presented, refactor getRootPosts
* MM-42191: Include deleted posts: Refactor getRootPosts function along with skipFetchThreads and includeDeleted
* MM-42191: Include deleted posts: Rename includeDeleted to include_deleted param
* MM-42191: Include deleted posts: Fix failed posts unit tests
* MM-42191: Include deleted posts: Add missing include deleted option in multiple queries
* MM-42191: Include deleted posts: Add tests for include deleted option in TestGetPostsForChannel, TestGetPostsBefore, TestGetPostsAfter
* MM-42191: include deleted posts: Add tests cases for post store test
* MM-42191: Include deleted posts: Add extra unit test to ensure not returning deleted posts when IncludeDelete is false
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
The props map was being null, but the schema did not
allow nulls. Therefore, the whole response was being
set to null. There was no error which created more
confusion.
To avoid making the property nillable, which would
mean sending pointers to maps, we just create
empty maps if they are nil.
https://mattermost.atlassian.net/browse/MM-46869
```release-note
NONE
```
This PR makes 2 main changes to the tests:
1. User logins were a huge part of the total CPU time because of the constant hashing of the password. There were 3 logins every time for every `Setup()` call. We remove the `LoginSystemManager` from the Setup call as it wasn't used in a lot of tests, and call that as needed.
2. We add the new app migrations that got added after the last preload optimization was done.
This shaves off around 3 mins from the test runtime. They are down from ~18m to ~15m.
```release-note
NONE
```
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Adds OmitConnection parameter to broadcast
Currently we have no means to omit sending a websocket event to a
specific connection id.
This is needed mainly so that the initiator won't receive an event for
the action it just initiated.
Will be used for the global drafts feature, so that we won't update
drafts through ws when a user is typing.
This commit adds OmitConnection to the Broadcast struct and to the
NewWebSocketEvent function signature.
shouldSendEvent should return false for that specific connection.
* Return early only if connection id matches the omitted
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Add api endpoints, app layers for top inactive channels with dummy store calls
* Add store functions for top inactive channels
* Add model, store, app tests.
* Add client function and api tests
* Add participants information to TopInactiveChannel
* Translation fix
* Style fix while writing response
* Return channelmember IDs instead of profiles, query in batch avoiding inside the loop
* Make the following changes
- move DeleteAt to subqueries, to avoid select, group by
- Remove TeamId from response
- Count bots and webhook posts
* SQL query lint fix, store test fix to include bot messages
* make app-layers
* Fix empty participant lists being sent as [""]
* Track channel joins, to distinguish 0 activity channels vs new channels
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* 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
```
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
```
Summary
Fix permissions for the the getPostThread API Method.
User can view thread if user is member of the channel
User can view threads in public channels (in the user's team) that they're not a member of, only if compliance export is disabled.
Ticket Link
https://mattermost.atlassian.net/browse/MM-45272
* MM-45713 - change 500 error to json object
* validate possible encoding errors and follow standards
* replace normal debugging string with true string
* use bool type instead of string
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>