* 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>
* [MM-43649] - Ability for end users to notify admin to upgrade workspace
* add test case
* move code to app layer
* feedback impl
* feedback impl-1
* feedback impl
* simplify logic
* fix typo and lint
* fix app layers
* Use a single critical section for users notified admin (#20488)
* Use a single critical section for users notifying admin
* change persistence mechanism
* add more tests
* change bot message
* fix translations
* update logic to notify once within cooloff period
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Nathaniel Allred <neallred@protonmail.com>
* MM-44863 - update trial details in product menu
* update the test to reflect the initial returned subscription
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
* Added webp package into app/emoji.go , also added a test
* fixed import order inside emoji.go
* Ran go mod tidy
* Conversion to png for Webp emojis that must be resized is implemented
* Deleted unused import
* Added reading mechanism for webp instead of creating
* fileutils and filepath are used while reading a webp file during test
* Deleted readtestwebp function and put it in emoji_test as requested
* Added webp image upload test inside api4/file_test.go
* Expect image is changed from false to true
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-44509 - subscription change not reflected after trial
* fix the tests
* receive the subscription id as param, defer the cache invalidation
* validate business email with body request
* update api request to accept json body payload
* fix unit tests
* fix tests after merge conflict fixes
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Add route endpoints, model, store functions, and tests for top threads
* Run make store-layers
* Make the following changes
- Fix top user threads query
- Fix passing parameters in api4/insights.go to handler in app
- Add top user threads test
* Add post-message, user_id, participants information to insights results
* model.TopThread.UserID -> model.TopThread.UserId, for compatibility with MySQL
* Rename name -> channel_name
* Add user information to response
* Link post in response, filter out deleted root posts from top threads
* Handle thread delete cases, add app tests for threads insights
* lint: fix typo
* lint: rename asserts
* lint: require.nil -> require.NoError
* Add integration tests for thread insights
* Add embeds and images to top posts
* Add license checks for top threads endpoints
* Query users in batch to populate post-creator
* Make the following changes
- Add license to test server in api4/
- Add tests for threads insights
- top team threads shouldn't include threads from other teams, DMs
- Test duration constraint
- Pagination testing for top threads in model/insights_test.go
* Add i18n-extract
* i18n fixes
* Add username, nickname to user_information
* Hide message, user_id, post_id, reply_count in depth=1 of top threads response
* Fix tests using response.reply_count to use response.post.reply_count
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Introduced search for channel id's
* Small fix to test case as it is not looking at count
* Introduced searching channels by id as a ChannelOpt. Defaulting to true for system console for the time being
* go fmt
* Modified whether to include search by id by passing it in as prop to search endpoint. Modified webapp to pass through search by id as well
* Fixed issue with full text search, as there is not always necessarily an index on Id.
* Modified test to verify count, and moved code inside conditional
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-43956: Adds post counts by day.
* MM-43956: Test data cleanup. Switch from Unix to UnixMilli.
* MM-43956: Changes from selecting date data types to strings in SQL.
* MM-43956: Fixes date format key.
* MM-43956: Adds missing user id scope for 'my' top channels graph.
* MM-43956: Adds the ability to group post counts by hour.
* MM-43956: Require enterprise or professional license. Reject guests.
* MM-43956: Adds license for tests.
* MM-43956: Renames function.
* MM-43956: Omits future hours from post counts by hour.
* MM-43956: Adjust API response grouping to users timezone.
* MM-43956: Adds translation.
* MM-43956: Adds user's timezone to the data tier for the grouping by day and hour.
* MM-43956: Fixes layers.
* MM-43956: Lint fix.
* MM-43956: Fix store layers.
* MM-43956: Switches to default name for time package; changes parameter names to avoid naming conflict.
* MM-43956: Updates mocks.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-42581: fixes unread threads on user channel add
Currently when we are adding a user to a channel we don't send previous
values for unread replies and mentions. This is resulting the thread to
not be marked as unread in the UI, since we rely on the previous values
for that.
This commit fixes the issue by returning previous unread values of 0.
* Adds test
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Prevent cloud limited installations from restoring teams when at or above the teams limit
* Code clean up
* fix i18n
* Actually fix i18n
* updates for govet
* Update model/client4.go
Co-authored-by: Vishal <vish9812@gmail.com>
* [MM-44397] Restrict team creation based on subscription limits (#20282)
* restrict team creation based on limits
* Update api4/team.go
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
* Fix tests
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
* Add additional field to teamsusage
* Fix
* remove useless test
* Fix error for team creation
* Remove apostrophe
* Add ReturnStatusOK to softDeleteTeamsExcept
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Vishal <vish9812@gmail.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
* MM-43666 - request bussiness email
* add the newValidEmail information
* revert ff model changes
* remove unnecessary pointer and fix test spelling
* fix unit tests and add a new one for when passing a valid email
* fix go lint
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* store: guests will only receive results of which channels they are in
* api4/channel_test: add test case for guest accounts channel autocomplete
* apply to searchengine and also for AutocompleteInTeam
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Prevent cloud limited installations from restoring teams when at or above the teams limit
* Code clean up
* fix i18n
* Actually fix i18n
* updates for govet
* Update model/client4.go
Co-authored-by: Vishal <vish9812@gmail.com>
* [MM-44397] Restrict team creation based on subscription limits (#20282)
* restrict team creation based on limits
* Update api4/team.go
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
* Fix tests
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
* Add additional field to teamsusage
* Fix
* remove useless test
* Fix error for team creation
* Remove apostrophe
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Vishal <vish9812@gmail.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
* Add a test for SetPostUnread-DM Channel
* assert early
* Unread post in DM thread
* Replace th.BasicUser with u1 var
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-43529 - start freemium trial
* change the method to put
* Add unit testing for the request-trial-endpoint
* use correct require
* add the translation texts
* fix texts
* remove unnecessary log
* change response status code to forbidden when non cloud
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Just a quick POC to move fast :P
We use a search pointer to keep track of
the next row to inesrt to. For every new search
we increment the pointer and do modulo 5.
This means that the value will always remain
between 0-4. And that way, we will always overwrite
the oldest entry on every search.
And while getting the results, we get
all results for that user.
The search parameters are json marshalled
and stored as a JSON blob. This is because
there is no need to search/filter them
in the DB.
Pending items:
Tests obviously.
To improve:
The client needs to send the channel ids
instead of channel names.
We add 2 new params to channel members query.
1. Filter by teamId.
2. Negate that filter.
We include some more optimizations like:
- Moved the team role checks inside the dataloader.
- Moved the channel pretty name computation inside the loader.
Now that we load less data on initial load, we can reduce
the concurrency requirement to be a bit on the safer side.
```release-note
NONE
```
Upgrading the user resolver to dataloader
meant that multiple goroutines would access
the user struct.
Hence we move the user struct sanitization inside
the dataloader itself so prevent access outside
the dataloader.
https://mattermost.atlassian.net/browse/MM-44044
```release-note
NONE
```
We were throttling the amount of concurrent resolvers
at a given time. The idea behind this was to avoid overloading
the database with too many requests.
However, with the introduction of dataloaders, this limitation
actually becomes a bottleneck because all DB calls are actually
batched, so we are unnecessarily throttling the amount of
items that can be processed in a single batch.
The only caveat with this is that now all resolvers
need to backed by dataloaders, or otherwise not be queried
as part of a loop.
In a subsequent PR, we will be removing channel stats
from under channel to be a top-level object to be returned
for a given channel.
```release-note
NONE
```
We increase the timeout further. Without this, there is
no reliable way to wait for a message.
Also consolidated the timeout values for other tests.
https://mattermost.atlassian.net/browse/MM-42997
```release-note
NONE
```