* 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>
* 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>
There were 2 main problems after https://github.com/mattermost/mattermost-server/pull/20367.
1. The : wasn't escaped.
2. Empty search didn't work.
For 1, we escape the ':'. For 2, we just use
pattern search.
```release-note
NONE
```
* 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.
We use * instead of a column name to use
index-only scan always even when other column filters
are applied.
Right now, index-only scan will only get applied
in the basic query of "select count(p.id) as value
from posts p". But it won't get applied if the query
is "select count(p.id) as value from posts p where
p.deleteat=0".
So this is a minor optimization which improves
some corner cases.
This was found from the slow query monitoring.
```release-note
NONE
```
* MM-43939: fixes lastreplyat when deleting the last reply
Currently we are not updating the Threads.LastReplyAt when the last
reply gets deleted. This can lead to threads appearing unread when
actually there is no unread thread.
This commit updates the value of Threads.LastReplyAt when a reply gets
deleted, to the most recent post's timestamp in the thread.
* Updates ReplyCount to current value on post delete
* Addresses review comments
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
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.
We replace expected/received with the source of the collation.
This makes it more clear as to from where the values
were retrieved.
```release-note
NONE
```
* Denormalize Reactions to add ChannelId for top reactions insights query
* Remove hardcoded timestamps
* Fix store, api4 tests for reactions
* Fix tests
* Fix integrity tests, allow reaction to have ChannelId populated before calling store function
* Lint fixes
* Add ChannelId field to BulkGetForPosts, Delete store handlers
* Add index to mysql migration, add not null characteristic without a separate command
* Select channelId instead of fetching post via store.GetPost, add if exists to drop column
* Make updating of Reactions conditional to support pre-migration
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* 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>