* 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
* use string constants for record keys
* new audit api calls for api4/bot
* `Auditable` interface implementations for model classes
* New audit calls for channel api
* New audit calls for channel_local
* renamed receivers for required style reasons
* New audit calls for api4/command
* renamed receiver
* New audit calls for api4/command_local
* renamed receiver
* fix unit test to reflect changes in the Auditable implementation of the user class
* new audit calls for compliance
* new audit calls for configs
* remove auditRec.addMeta from updateConfig and patchConfig
* new audit calls for config_local
* new audit calls
* new audit calls for ldap, license apis
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* fix linter error
* fixed linter error
* fixed "user update" test
* Don't include all of config when audit logging config changes. Also fix unit test on TestUpdateConfigDiffInAuditRecord
* address review comments
* Added Auditable() method for UserPatch
* Fix duplicative method declaration from merge
* Fix styling and API changes issues introduced with merge
* Fix broken test
Co-authored-by: Daniel Schalla <daniel@schalla.me>
* 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
* MM-45174 - split validate business email logic
* remove unnecessary interface method
* check for error just after the cloud call to prevent server panic
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
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
```
* 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>