Граф коммитов

1535 Коммитов

Автор SHA1 Сообщение Дата
Agniva De Sarker
ae482e6214 GraphQL: Add missing fields (#20646)
Went through the model and added all missing fields.

Except user.Password/MfaSecret/AuthData and session.TeamMembers.

```release-note
NONE
```
2022-07-18 11:10:58 +05:30
Ossi Väänänen
8f44fbf89c Audit logging -- convert audit logs to use the new schema (#20526)
* 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>
2022-07-14 13:52:46 +02:00
Ossi Väänänen
0c5c74904b Audit logging - new schema (#20447)
* 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
2022-07-14 11:19:33 +02:00
Tim Scheuermann
6dc897b04f MM-45193 Use context for channel logging (#20575) 2022-07-14 11:01:29 +02:00
Pablo Andrés Vélez Vidal
059ea7eb44 MM-45174 - split validate business email logic (#20581)
* 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>
2022-07-13 12:05:35 +02:00
Agniva De Sarker
049e67b863 MM-45535: Batch optimize auth checks in GraphQL (#20634)
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
```
2022-07-12 23:26:48 +05:30
Tim Scheuermann
7bbf30d6bc MM-45168 GraphQL: add fields to Team (#20610) 2022-07-11 15:05:09 +02:00
Tim Scheuermann
0f21cfcd52 General GraphQL resolver optimizations (#20611) 2022-07-11 15:04:07 +02:00
Nathaniel Allred
f639122376 Usage: Round messages to 1K, files to 100MB (#20603) 2022-07-11 07:21:29 -05:00
Tim Scheuermann
662248291e [MM-45168] Added graphql fields for channel and channel_member (#20613) 2022-07-11 13:58:05 +02:00
Agniva De Sarker
b0327c2953 MM-45536: Track GraphQL queries in Grafana (#20609)
https://mattermost.atlassian.net/browse/MM-45536

```release-note
NONE
```
2022-07-08 14:45:05 +05:30
Vishal
e5ee5eecd8 [MM-44488] Cloud limits: enforcing messages (#20362)
* 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>
2022-07-06 11:56:39 +05:30
Martin Kraft
b99bd0d049 MM-45204: Enables Insights feature flag by default. (#20509)
* MM-45204: Enables Insights feature flag by default.

* MM-45204: Update test.
2022-07-05 09:16:44 -04:00
Ibrahim Serdar Acikgoz
717a4d04a9 Use any instead of interface{} (#20577)
* replace interface{} with any
2022-07-05 09:46:50 +03:00
Julien Tant
b45ff0be5d [MM-44159] Add user sort by admin status in channels (#20562) 2022-06-30 09:20:14 -07:00
Allan Guwatudde
1d9fa3c333 [MM-43649] - Ability for end users to notify admin to upgrade workspace (#20338)
* [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>
2022-06-30 09:24:42 +03:00
Allan Guwatudde
b445440600 [MM-45053] - Remove 'trial of Mattermost ending soon' product emails (#20550)
* [MM-45053] - Remove 'trial of Mattermost ending soon' product emails

* remove trial end warning email
2022-06-30 09:18:13 +03:00
Agniva De Sarker
bd6acf04a9 GraphQL: Create dedicated top-level filter for sidebar categories (#20353)
We add the excludeTeam switch to allow user to get
all sidebar categories from other teams excluding a given team.

```release-note
NONE
```
2022-06-28 20:28:50 +05:30
Pablo Andrés Vélez Vidal
78e2d457f8 MM-44863 - update trial details in product menu (#20534)
* 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>
2022-06-27 08:56:20 +02:00
Allan Guwatudde
411e4d979c Sanitize cloud products for non admin users (#20540) 2022-06-27 07:51:06 +03:00
Barış
ccab5be6c4 Mm-20223 Add webp emoji support (#20283)
* 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>
2022-06-21 10:08:02 +05:30
Pablo Andrés Vélez Vidal
2b8d63b606 MM-44509 - subscription change not reflected after trial (#20352)
* 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>
2022-06-21 01:40:27 +02:00
Shivashis Padhi
2cd83d2f8d [MM-44084] Feature: Top threads insights (#20195)
* 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>
2022-06-20 10:27:17 -04:00
Nathaniel Allred
d43c06ea75 remove freemium feature flag (#20491) 2022-06-17 11:13:22 -05:00
Riccardo Santoni
dd7067cbe9 [MM-44434] Introduced search for channel id's through system console. (#20259)
* 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>
2022-06-16 11:32:16 -04:00
Martin Kraft
182ae1234a MM-43956: Adds post counts by duration. (#20131)
* 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>
2022-06-13 16:22:34 -04:00
Agniva De Sarker
4b8cb4e272 MM-44806: Avoid pointers in JSON parsing in updateCategoryForTeamForUser (#20431)
Passing null is a valid JSON input for a pointer struct. So we avoid
passing pointer to pointer.

https://mattermost.atlassian.net/browse/MM-44806
```release-note
NONE
```
2022-06-11 00:24:23 +05:30
Agniva De Sarker
b443746e80 MM-44805: Avoid pointers in JSON parsing in createCategoryForTeamForUser (#20429)
Passing null is a valid JSON input for a pointer struct. So we avoid
passing pointer to pointer.

https://mattermost.atlassian.net/browse/MM-44805

```release-note
NONE
```
2022-06-11 00:24:04 +05:30
Michael Kochell
e18b1cf89f Check for cloud license and CWS error when checking integration freemium limits (#20387)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-06-09 15:57:02 -04:00
Ben Cooke
2c63e8dd08 [MM-43785] Hide insights feature intro for new users (#20214)
* tools updates

* Revert "tools updates"

This reverts commit 6293297b55803c5a263e200ebd80192899666ae9.

* hide insights modal by default for new users

* updating feature flag for test

* updating preference tests

* fixing lint

* fixing comment

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-06-08 14:56:34 -04:00
Kyriakos Z
5396c530bf MM-42581: fixes unread threads on user channel add (#20181)
* 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>
2022-06-08 14:01:58 -04:00
Ibrahim Serdar Acikgoz
c986693e4a Revert "config/diff: add utility function to get diffs scoped with struct tags (#20297)" (#20391)
This reverts commit a18934b042.
2022-06-08 17:28:35 +03:00
Vishal
27fc14201f [MM-42192] Include deleted posts in GetPost (#20358)
* Introduced include_deleted query param on get posts endpoint

* Update the correct func name in the comment.

Co-authored-by: santoniriccardo <santoni.riccardo@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-06-06 13:29:42 +05:30
Michael Kochell
7833e595aa [MM-44604] Ensure we return after setting error in api4/config.go (#20294) 2022-06-03 10:14:56 -04:00
Ashish Bhate
8f912b697e MM-43918: freemium limit for storage (#20225)
Summary
Adds an API end point to return storage usage

Ticket Link
https://mattermost.atlassian.net/browse/MM-43918
2022-06-03 11:48:29 +05:30
Nick Misasi
f42702e13e Add StatusOK return to the softDeleteTeamsExcept controller (#20340)
* 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>
2022-06-02 09:02:41 -04:00
Pablo Andrés Vélez Vidal
d5333603ab MM 43666 - request bussiness email (#20315)
* 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>
2022-06-01 23:36:03 +02:00
Ibrahim Serdar Acikgoz
fe3816cc20 store: guests will only receive results of which channels they are in (#20295)
* 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>
2022-06-01 09:18:59 +03:00
Nick Misasi
cffe921e62 [MM-44475] Team Unarchive: Do not allow to unarchive if workspace has reached the limit of teams (#20281)
* 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>
2022-05-31 15:06:54 -04:00
Ibrahim Serdar Acikgoz
a18934b042 config/diff: add utility function to get diffs scoped with struct tags (#20297)
* config/diff: add utility function to get diffs scoped with struct tags

* api4/config.go: check cloud accessible settings after merge
2022-05-31 17:10:32 +03:00
Vishal
57e9aa767c [MM-44263] Only include user posts in post count (#20250)
* Fetch users only posts

* Explicitly validate posts count before testing usage
2022-05-31 14:18:41 +05:30
Vishal
8e12d81f16 [MM-33123] Add a test for SetPostUnread-DM Channel (#20129)
* 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>
2022-05-27 15:53:37 +05:30
Christopher Speller
e284b811df Add subresource integrety (#20257) 2022-05-26 10:54:11 -07:00
Ashish Bhate
2315fcf05b MM-43780: Adjust getPostThread API for easier pagination (#20172)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-25 18:18:05 -04:00
Michael Kochell
ea5bfe3fd9 Cloud Freemium - Integrations (#20185)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-25 12:36:08 -04:00
Nick Misasi
50d069e86d [MM-44307] On Limits Change, archive or restore teams according to the limits (#20247)
Automatic Merge
2022-05-24 16:16:24 +03:00
Miguel de la Cruz
c100fc2135 Revert "config/diff: add utility function to get diffs scoped with struct tags (#20206)" (#20256)
Automatic Merge
2022-05-21 00:16:24 +03:00
Pablo Andrés Vélez Vidal
f08d65909f MM-43529 - start freemium trial (#20163)
* 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>
2022-05-18 10:19:38 +02:00
Vishal
fd703a365b [MM-43917] Cloud Freemium limits API: messages/posts (#20152)
* WIP - Add api and app funcs

* Add test cases

* Add utils testcases

* Exclude deleted posts

* Add doc for func

* Move api from cloud to usage

* Allow api access to authenticated users

* Change int to int64

* Fix lint issue

* Simplify err check

Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com>

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Ashish Bhate <ashish.bhate@mattermost.com>
2022-05-17 13:30:40 +02:00
Ibrahim Serdar Acikgoz
8802c6c9d6 config/diff: add utility function to get diffs scoped with struct tags (#20206) 2022-05-16 15:12:12 +03:00