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

1560 Коммитов

Автор SHA1 Сообщение Дата
Amy Blais
6aa57e6242 Revert "MM-45272: Fix getPostThread permissions (#20565)" (#20811)
Automatic Merge
2022-08-12 18:43:49 +03:00
Martin Kraft
55b3961b98 MM-45120: Track team join times. Add API to retrieve new team members since a given time. (#20708)
* 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.
2022-08-11 10:38:52 -04:00
Tim Scheuermann
1738bd6e92 [MM-45991] Check and return JSON errors (#20735) 2022-08-10 10:56:58 +02:00
Tim Scheuermann
b4570afa90 Replace deprecated ioutil with io and os (#20776)
* Replace ioutil with io and os

* Replace ioutil in utils/file.go

* Minor fix to tests and excluded files

Co-authored-by: Tim Scheuermann <tim.scheuermann@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-08-09 14:25:46 +03:00
Agniva De Sarker
97b3ffd7ea MM-43202: Change some 501 response codes to fix SLO violations (#20767)
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
```
2022-08-08 20:02:49 +05:30
Agniva De Sarker
b826421716 MM-45534: Fix flaky TestCreateGroupChannel (#20781)
The returned elements weren't in a specific order.
Therefore, we need to perform an order insensitive match.

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

```release-note
NONE
```
2022-08-08 14:14:18 +05:30
Pablo Andrés Vélez Vidal
e7156476fa MM-45542 - do not fail if site url is not set when requesting trial (#20713)
* MM-45542 - do not fail if site url is not set when requesting trial

* remove unnecessary text

Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-08-03 23:54:43 +02:00
Ibrahim Serdar Acikgoz
ac79a887a2 Move metrics under platform service (continued) (#20732)
* move metrics into platform

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2022-08-02 10:59:29 +03:00
Vishal
276594608c Remove the read_channel permission to unfollow a thread (#20662) 2022-08-02 12:12:41 +05:30
Agniva De Sarker
55f64195b1 MM-45195: Use api4/bot and app/bot to use logger context (#20729)
https://mattermost.atlassian.net/browse/MM-45195

```release-note
NONE
```
2022-08-01 13:48:45 +05:30
Agniva De Sarker
887bc0173e MM-45715: Fix incorrect permissions (Round 2) (#20731)
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
```
2022-07-29 09:58:44 +05:30
Tim Scheuermann
832736da37 [MM-45990] log JSON parsing errors in API4 (#20724) 2022-07-28 17:05:03 +02:00
Ashish Bhate
04cd6d35e9 MM-45272: Fix getPostThread permissions (#20565)
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
2022-07-28 20:25:20 +05:30
Pablo Andrés Vélez Vidal
0ee05ce054 MM-45713 - change 500 error to json object (#20682)
* 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>
2022-07-28 15:07:54 +02:00
Agniva De Sarker
0e75cecc4f Fix bad merge due to https://github.com/mattermost/mattermost-server/pull/20674 (#20728)
```release-note
NONE
```
2022-07-28 10:34:02 +05:30
Agniva De Sarker
d4b710b3ab MM-45194: Switch app/user and api4/user to logger context (#20674)
```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-28 10:04:21 +05:30
Agniva De Sarker
90c6350410 Revert "move metrics server into platform service (#20683)" (#20726)
This reverts commit b18a42313b.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-27 21:30:25 +02:00
Tim Scheuermann
f199be6aa5 [MM-45715] Check for correct permission when requesting teams (#20715) 2022-07-27 19:17:02 +02:00
Tim Scheuermann
eba08cbb11 Replace ioutil.Discard with io.Discard (#20707) 2022-07-27 11:40:33 +02:00
Julien Tant
1044fba449 [MM-45817] Set cloud cookies whenever user gets logged in (#20692) 2022-07-26 07:47:09 -07:00
Agniva De Sarker
20cb042362 Hackathon: Post Reminders (#20555)
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.
2022-07-26 16:12:56 +05:30
Nathaniel Allred
77881fc357 Mm 43609 (#20657)
* return first inaccessible post time instead of has inaccessible posts
2022-07-25 16:01:59 -05:00
Ibrahim Serdar Acikgoz
b18a42313b move metrics server into platform service (#20683)
move metrics into platform
2022-07-25 16:54:06 +03:00
Claudio Costa
9255671222 [MM-45862] Set size and extension to fileinfo (#20681)
* Set size and extension to fileinfo

* Remove unnecessary check
2022-07-22 09:14:01 +02:00
Riccardo Santoni
3d7859396d [MM-42194] Get file information from a deleted post (#20279)
* Introduced inlcude_deleted query parameter to allow admins to retrieve contents of post regardless of deletion status

* Introduced new client route and tests for getting file info of deleted posts

* Fixed tests due to caching of posts

* gofmt

* Small formatting updates

* Invalidating file infos cache on delete of post if post includes files

* Including deleted in migration flow

* Moved invalidating of cache

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-21 11:11:08 -04:00
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