Commit Graph

1089 Commits

Author SHA1 Message Date
Miguel de la Cruz
10d2fed795 [MM-27022] Add marketplace endpoints to local mode (#15053)
* [MM-27022] Add marketplace endpoints to local mode

* Fix test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-19 13:54:46 +02:00
Claudio Costa
58c6eabf95 [MM-27836] Fix possible panic when patching config (#15262)
* Fix possible panic when updating/patching config

* Remove un-needed check
2020-08-17 14:53:48 +02:00
Ibrahim Serdar Acikgoz
1fadfa9f33 app/testEmail: remove a setting that blocks testEmail (#15022)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-15 00:43:42 +03:00
Ibrahim Serdar Acikgoz
16ffb6712f [MM-25657] api4/config: add config migrate endpoint (#14928)
* api4/config: add config migrate endpoint

* api4/config: reflect review comments

* fix i18n lint error

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-14 18:26:23 +03:00
Ashish Bhate
d76039db23 [MM-25659] ability to permanent delete channel through client (#15202)
Summary

    Ability to permanent delete channel through client

Ticket Link

    https://mattermost.atlassian.net/browse/MM-25659
2020-08-14 14:12:39 +05:30
Agniva De Sarker
11513a8d0d MM-27507: Propagate rate limit errors to client (#15230)
* MM-27507: Propagate rate limit errors to client

We return an error from SendInviteEmails instead of just logging it
to let the client know that a rate limit error has happened.

The status code is chosen as 413 (entity too large) instead of 429 (too many requests)
because it's not the request which is rate limited, but the payload inside it which is.

Ideally, the email sending should have been implemented by a queue which would just return
an error to the client when full. That is also why we are not returning an X-Retry-After
and X-Reset-After in the headers because that would mix with the actual rate limiting.

A separate header X-Email-Invite-Reset-After might do the job, but it comes at an extra cost
of additional API surface and a clunky API. Instead, that information is contained in the error
response. The web client needs to just surface the error. An API client will have to do
a bit more work to parse the error if it needs to automatically know when to retry. Given that
an email sending client is not a very common use case, we decide to keep the API clean.

This decision can be revisited if it becomes problematic in the future.

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

* Fixing translations

* Added retry_after and reset_after in API response.
2020-08-13 22:19:05 +05:30
Rodrigo Villablanca
32b7d2b5f1 StatusStore migration (#14978)
* Finished!

* Typos

* Fix error

* Fix layers

* Lint: remove unnecessary use of sprint

* Fix shadowing err
2020-08-13 11:12:08 +05:30
Claudio Costa
c89c56ab2e [MM-27328] Upgrade minio-go to v7 (#15177)
* Upgrade minio-go to v7

* Update to v7.0.3

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-12 19:53:47 +02:00
Ibrahim Serdar Acikgoz
5ab06162dc [MM-27377] api4/team_local: add updateChannelPrivacy and restoreTeam to local mode (#15201)
* api4/team_local: add update ch privacy to local mode

* api4/team_local: add restoreTeam to local mode

* api4/team: add a test case
2020-08-12 18:20:53 +03:00
Ibrahim Serdar Acikgoz
3f19a8c011 [MM-27376] api4/channel: add move channel to local mode (#15200)
* api4/channel: add move channel to local mode

* app/channel: reflect review comments
2020-08-10 17:44:13 +02:00
Ibrahim Serdar Acikgoz
e8326fd7e8 api4/bot: fix permission check in convert handler (#15196) 2020-08-07 09:41:22 +03:00
Doug Lauder
7f64199a37 MM-27184 deprecate model.SetExpireInDays (#15165)
Mobile users were having their sessions unexpectedly expired, despite having ServiceSettings.ExtendSessionLengthWithActivity enabled. 

Every time a mobile app is opened it called `/api/v4/sessions/device` which calls attachDeviceId which calls `(*Session)SetExpireInDays`. This code above assumed the expiry should be relative to CreateAt which is incorrect when ExtendSessionLengthWithActivity is enabled. Therefore, every time the mobile app was opened, the maximum expiry was set in memory to CreateAt + session_length, even if the session was extended.

(*Session)SetExpireInDays is now deprecated and replaced with (*App)SetSessionExpireInDays which takes into account the ExtendSessionLengthWithActivity setting.
2020-08-04 16:10:37 -04:00
Farhan Munshi
d4dac31b04 MM-27407 Return archived channels even if view archived config is false for sysadmin endpoints (#15149)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-04 12:02:12 +05:30
Claudio Costa
38307c0b73 [MM-27293] Remove heap pre-allocation for file uploads (#15143)
* Validate Content-Length

* Avoid pre-allocating memory for file uploads

* Add small pre-allocation to help mitigate small uploads performance
2020-08-03 08:25:47 +02:00
Ashish Bhate
61cc7a8680 [MM-26576] fix flaky TestCreateUserInputFilter test (#15097)
- Summary
    fix flaky TestCreateUserInputFilter test by deleting created user between interations

- Ticket Link
    https://mattermost.atlassian.net/browse/MM-26576
2020-07-31 20:08:31 +05:30
Rodrigo Villablanca
1c5b6522e3 WebhookStore migration (#15042)
* Migration completed

* Fix tests

Co-authored-by: Jesús Espino <jespinog@gmail.com>
2020-07-31 15:53:10 +02:00
Harrison Healey
93dc68873a MM-27258 Cannot update categories with deleted channels (#15109) 2020-07-27 17:03:25 -04:00
Farhan Munshi
c511042c0f [MM-26969] Add team filters to search teams (#15065)
* Add team filters to search teams

Remove unneeded logs

Add team filters to search teams

* Use bool pointers for filters

Re-add include group constrained

Fix lint

Return the union of filters
2020-07-27 15:11:39 -04:00
Hossein Ahmadian-Yazdi
935ddaa251 [MM-19640] Retrieve Compliance files from the System Console (#14976)
* add query param for downloading file

* Address PR comments

* sanitize error messages

* revert error santization

* address PR comments

* Log Error

* Comment for clarification

* Add test + Opt In Option

* Fix typo

* Remove line number

* Check is downloadable in server

* Don't use constants

* Check for downloadExportResults in API

* make actiance export zip

* make i18n strings

* Remove translations

* Add translations

* Revert "Add translations"

This reverts commit adc5d28b3e.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-27 08:37:04 -04:00
Agniva De Sarker
77f7a97bee MM-25563: Add endpoint to fetch only archived channels (#15031)
Automatic Merge
2020-07-27 13:31:39 +02:00
Claudio Costa
e5edf2683d [MM-25652] Add /integrity endpoint to local mode API (#15033)
* Fix direct/group channel false positives

* Move public structures to model package

* Expose CheckIntegrity as a local API method

* Remove extra file

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-27 10:20:22 +02:00
Farhan Munshi
ed34468996 [MM-25990] Add filters to search all channels (#15009)
* MM-25990 Add filters to search all channels endpoint and clean up tests

* Add deleted filter

* Remove redundant private public query
2020-07-23 10:46:33 -04:00
Miguel de la Cruz
46207a35f5 [MM-27130] Add local implementations for get user related endpoints (#15070)
Automatic Merge
2020-07-23 12:53:35 +02:00
Miguel de la Cruz
b660e217d1 Add tests to get team local endpoints (#15071)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-23 12:21:33 +02:00
catalintomai
549e5b57cd Add metric warning support (announcement bar and DM) (#14483)
* Admin. Advisory: Add warning for number of active users metric status

Co-authored-by: Catalin Tomai <catalin.tomai@mattermost.com>
2020-07-22 20:32:21 -07:00
Doug Lauder
56fb31f06f MM-22784 Advanced logging config for audit (#15076)
Adds the advanced logging config for audit. Existing support for auditing to a single file remains for E0 and E10 licenses instances, and a new config item ExperimentalAuditSettings.AdvancedLoggingConfig is added that behaves like LogSettings.AdvancedLoggingConfig.

Supported destinations:

- file
- syslog (with out without TLS)
- raw TCP socket (with out without TLS)

ExperimentalAuditSettings.AdvancedLoggingConfig can contain a filespec to a config file, a database DSN, or JSON.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2020-07-22 18:48:46 -04:00
Miguel de la Cruz
6b5c0bb5d2 [MM-27170] Migrate verify user by id endpoint to local mode (#15091)
* [MM-27170] Migrate verify user by id endpoint to local mode

* Update api4/user_test.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2020-07-22 18:27:44 +02:00
Harrison Healey
14aba9bccb MM-26410/MM-26825 Improve syncing between favorites category and preferences (#15048)
* MM-26410 Allow moving channels into Favorites when they're favorited in prefs

* MM-26410 Fix management of Favorites category when updating preferences

* MM-26410 Add management of Favorites category when deleting preferences

* Address feedback 1

* Remove WHERE (1=1) from query

* Remove unnecessary sq.Expr

* Rewrite query to use left join

* Remove redundant where statement and add some more tests

* Fix linting issues

* Rename addChannelToFavoritesCategory to addChannelToFavoritesCategory
2020-07-22 09:04:40 -04:00
Ashish Bhate
7602dc0b19 [MM-25647]: ability to permanently delete users (#14944)
Summary:
    Config option to allow permanent user deletion ServiceSettings.EnableAPIUserDeletion
    Expose permanent user deletion through API
    Local mode for delete user for use in mmctl

Ticket Link:
    Server part of https://mattermost.atlassian.net/browse/MM-25647
2020-07-22 17:32:23 +05:30
Agniva De Sarker
4a2715974d MM-27149: optimize initBasic (#15063)
* MM-27149: optimize initBasic

Mostly, all tests just needed the user initialization part and not
the channel and group creation. So we move the user initialization inside
the Setup call. This avoids unnecessary DB calls which take around 250-300ms
on average.

And we make the login requests concurrently to shave off a few more ms.
According to my tests, the 2 login calls take 140 ms on average, which
shaves off 70ms.

So approximately, we shave off 350ms per test. And there are 114 occurences
of these. So around 39 seconds.

* make initlogin only for Setup/SetupEnterprise

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-22 13:50:33 +05:30
Ibrahim Serdar Acikgoz
263e5e8945 api4/user: convey redirect link through email verification (#15052) 2020-07-21 17:09:49 +03:00
Claudio Costa
484e813dca Return 400 error if limit_after is zero (#15049) 2020-07-20 10:08:52 +02:00
Siyuan Liu
c7f7bef9ec move cache2 package to cache (#14921)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-18 13:31:06 +05:30
Ashish Bhate
fe45e0a98b return error if option not set instead of soft delete (#15030) 2020-07-18 00:29:46 +08:00
Ibrahim Serdar Acikgoz
6a4e3293f8 [MM-25648] api4: add user/bot convert endpoints (#14877)
* api4: add user/bot convert endpoints

* api4: add convert user/bot to local mode

* api4: fix linting issues

* api4/bot: reflect review comments

* api4: update convert user endpoint paths

* remove shadow decl

* fix translation problems
2020-07-17 10:00:43 +03:00
Farhan Munshi
c0bfa58ec1 [MM-26574] Add role filters to get users, users search and add getFilteredUserStats endpoint (#14998)
* MM-26574 Add role filters to user search and get

* Add ability to get filtered user stats

Add support for include bots

* Add tests for user count with filters

Add tests

* Apply changes from code review

* Fix guest filtering

* Fix up tests related to guests

* Clean role names

* Trigger CI

* Trigger CI
2020-07-16 12:37:26 -04:00
Hossein Ahmadian-Yazdi
c53c9ed190 [MM-26720] Update testing names (#15015)
* update testing names

* fix typo
2020-07-16 10:36:29 -04:00
Miguel de la Cruz
5ddf8d4099 [MM-25089] Migrate server busy endpoints to local mode (#14883) 2020-07-16 10:26:46 +02:00
Ibrahim Serdar Acikgoz
bf664997a7 [MM-21464] api4/channel: add ability to force move channel by removing non-members (#14887)
* api4/channel: add ability to force move channel by removing non-members

* app/channel: add log to move channel for non taget team members

* app/channel: add tets for remove non-team members for channel

* Update api4/channel_test.go

Co-authored-by: Eli Yukelzon <reflog@gmail.com>

Co-authored-by: Eli Yukelzon <reflog@gmail.com>
2020-07-16 11:26:19 +03:00
Miguel de la Cruz
b916bae0f7 [MM-24602] Adds local patch channel endpoint (#15032) 2020-07-16 10:25:22 +02:00
Ibrahim Serdar Acikgoz
ec78168242 [MM-25651] api4/ldap: add migrateid (#14794)
* api4/ldap: add idmigrate

* api4/ldap: add migrateid to local api

* api4/ldap: improve migrate test

* api4/ldap: add licence check
2020-07-14 15:59:35 +03:00
Rodrigo Villablanca
8b6a5fc5d7 TokenStore migration to return plain errors (#14875)
* TokenStore migration to return plain errors

* Fix translations

* Fix: returned error is ignored and http.StatusBadRequest is always returned

* Fix

* Fix translations

* Suggestions

* Changed from BadRequest to NotFound

* Setting the correct http status

* Changed test to expect 404 status

* Fix error
2020-07-09 12:46:27 +05:30
Jesús Espino
b977017ca7 Extracting email functions into a service (#14802)
* Extracting email functions into a service

* Fixing two shadowing errors

* Address PR review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-07 10:03:21 +02:00
Harrison Healey
de6a57cdc3 Sidebar V2 Phase 2 (#14967)
* parent 48256721c4 (#14358)

author Eli Yukelzon <reflog@gmail.com> 1585814774 +0300
committer Eli Yukelzon <reflog@gmail.com> 1589111022 +0300

Sidebar caregories implemented

Apply suggestions from code review

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Update store/sqlstore/channel_store.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Update store/sqlstore/channel_store.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

code review suggestions

status messages

edge case

bugs...

timeout reverse

* MM-25126 Add a separate default sorting method for categories (#14575)

* MM-25158 Add user to initial sidebar categories when joining team (#14570)

* MM-25281  Place new categories in the correct position (#14609)

* MM-25277  Return channels that aren't in a category as part of the Channels/Direct Messages categories (#14601)

* MM-25276  Remove categories when leaving a team (#14600)

* Remove categories when leaving a team

* layers

* corrected cleanup function

* lint

* .

* corrected errors in postgres

* .

* MM-25280  Ensure that the "update category order" API call only contains real category IDs and isn't missing any IDs (#14626)

* Ensure that the "update category order" API call only contains real category IDs and isn't missing any IDs

* tests

* correct status code

* MM-25278  Change "update category" API to return 400 when changing unsupported fields (#14599)

* MM-25279  Change category migration to only populate channels in Favorites (#14627)

* MM-25157 Add API to delete custom categories  (#14574)

* MM-25157 Add API to delete custom categories

* get categories fix

* maxorder fix

* Use correct websocket event when deleting category

* Fix tests and remove debug code

* Actually use the right websocket event this time

* test cleanup

* Update test for new category order

Co-authored-by: Eli Yukelzon <reflog@gmail.com>

* MM-24914 Various fixes for sidebar channel handling (#14756)

* Fix checking for channel membership when reordering channels

* Remove unique constraint on SidebarCategories

* Set column sizes for SidebarCategories and SidebarChannels tables

* Allow changing the sorting method for non-DM categories

* Fix nil pointers in error handling

* Fix orphaned channels from other team being returned in Channels category

* Fix non-orphaned channels being duplicated in the Channels category

* Remove unique constraint on SidebarChannels

* Fix category/name of favorites preferences

* Fix testSidebarChannelsMigration

* Rename err to nErr and appErr to err

* Fix channel order returned by GetSidebarCategories on MySQL

* Fix adding/removing favorites preferences

* Remove leftover TODO

* Change SidebarCategoryType enums to use full names (#14786)

* Change SidebarCategoryType enums to use full names

* Fix Channels constant

* Remove leftover debug code

* MM-24914 Fix updateCategory endpoint returning the wrong type (#14795)

* MM-24914 Make some changes to UpdateSidebarCategories (#14806)

* Fix orphaned DMs not always being returned

* MM-24914 Make some changes to UpdateSidebarCategories

* Run updateSidebarCategoryOrderT in a transaction

* Fix deleting SidebarChannels based on order of arguments to UpdateSidebarCategories

* bump for api testing

* bump for api testing

* Change CreateInitialSidebarCategories to return a plain error

* Change MigrateSidebarCategories to return a plain error

* Remove usage of UpdateColumns when updating sidebar categories (#14843)

* Remove usage of UpdateColumns when changing category order

* Add a random test case

* Remove usage of UpdateColumns when updating sidebar categories (#14843)

* Remove usage of UpdateColumns when changing category order

* Add a random test case

* Remove usage of UpdateColumns when updating sidebar categories (#14843)

* Remove usage of UpdateColumns when changing category order

* Add a random test case

* MM-26343 Make CreateInitialSidebarCategories idempotent (#14870)

* Fix bad merge

* Fix another bad merge

* Fix unintentionally removed i18n string

Co-authored-by: Eli Yukelzon <reflog@gmail.com>
2020-07-06 18:20:35 -04:00
Dušan Panić
83a80a2422 Implemented AmazonS3PathPrefix (#14917)
* Implemented AmazonS3PathPrefix

* Remove unecessary method

* fix for test

* fix for test which are failing

* fix for test which are failing

* fix for test

Co-authored-by: Dusan Panic <dusan@salestrekker.com>
2020-07-07 00:20:13 +02:00
Ashish Bhate
af8b914c6c MM-23596: Ability to list private channels for team (#14925)
Summary:
store, app, api and go driver support for listing private channels

Ticket Link:
https://mattermost.atlassian.net/browse/MM-23596
2020-07-06 12:34:29 +05:30
Jesús Espino
a4fc0fcfb7 Adding terms_accepted and receive_emails_accepted params to request trial (#14937) 2020-07-03 12:17:34 +02:00
Christopher Poile
f5be738923 MM-26339 - Add context and CommandArgs to dynamic autocomplete calls (#14940)
* pass commandArgs and pluginContext to dynamic list suggestion calls

* update tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-02 08:08:58 -07:00
Hossein Ahmadian-Yazdi
4c50c7c59b [MM-25780] Fix incorrect session length when logging in through mobile using SSO (#14874)
* Pass device ID

* dont use device id as way of detecting

* fix spelling mistake

* update layers

* fix test

* fix linting

* save schema

* put columns in correct place

* fix linting

* update

* upgrade go change

* use props

* fix stuff

* update session tests

* address PR comments

* address PR comments
2020-06-30 10:34:05 -04:00
Ben Schumacher
43f7acd45a [MM-26507] Send license type for install plugin request (#14913) 2020-06-30 14:17:00 +02:00