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

2224 Коммитов

Автор SHA1 Сообщение Дата
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
20e44399c7 SystemStore migration to return plain errors (#14835)
* SystemStore migration to return plain errors

* Fix nilness

* Fix translations

* Fix merge

* Fix layers

* Fix merge errors

* Lint: remove unnecessary use of sprint

* Fix merge errors

* Fix i18n

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-08-13 20:32:57 +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
Rodrigo Villablanca
909cda6d49 Pluginstore migration (#14971)
Automatic Merge
2020-08-13 01:35:57 -04:00
Jesús Espino
19173ea6ff Migrating Team.SaveMember/SaveMultipleMembers into errors (#14924)
* Migrating Team.SaveMember/SaveMultipleMembers into errors

* Removing copy/paste comments

* Fixing another small thing

* Fixing tests

* Addressing PR review comments

* Fixing some tests

* Fixing golangci-lint

* Fixing linter

* Regenerating store layers

* Fix lint error after merge

* Other lint error fixed

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-12 21:02:41 +02:00
Jesús Espino
1b141678fe Adding initial retry layer version (#14954)
* Adding initial retry layer version

* Some simplification around the generated code

* Generating retry layer again

* Improving naming generation in store generated layers

* Address PR review comments

* Updating store layers

* Addressing PR review comments

* fixing lint errors

* Updating store layers

* Adding license header

* Applying the retry layer to the reaction_store

* Regenerating retry layer
2020-08-12 20:05:16 +02:00
Rodrigo Villablanca
5566395032 First part of PostStore migration (#15123)
Automatic Merge
2020-08-12 13:35:57 -04:00
Agniva De Sarker
d9ee26a47b MM-26575: Move app initialization inside Websocket router out of handler (#14991)
* MM-26575: Move app initialization inside Websocket router out of handler

The websocket router struct is shared amongst multiple handlers. Therefore,
there is a race condition while setting the app field and reading from it.

We move the initialization of the app field when the router struct is initialized.

And we also remove the initializations of some app fields which caused race
conditions by being written from multiple goroutines. They are already being
written once inside the AppInitializedOnce.Do method and it's redundant
to set them again to the same value.

* Add missing fields in server connector

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-12 22:10:19 +05:30
Jesús Espino
1f09d86f42 Moving slash-commands out of app package (#14979)
* Moving slash-commands out of app package

* Fixing golint checks

* Fixing golangci-lint

* Fixing golangci-lint errors
2020-08-12 18:29:58 +02:00
Jesús Espino
788c130774 Moving slack importer into a service (#14860)
* Moving slack importer into a service

* Adding missed license headers

* Fixing tests

* Adding license header
2020-08-12 18:29:36 +02:00
Ben Schumacher
aa88fb445c Log URL for requests to non-existing plugins (#15229) 2020-08-12 11:00:53 -04:00
Farhan Munshi
101c6c7c01 [MM-27623] Add new session prop for oauth (#15221)
* Add new session prop for oauth

* Make it isOAuthUser to differentiate better

* Fix up caps

* Fix tests

* Add tests for IsOAuthUser
2020-08-11 10:24:26 -04:00
Christopher Speller
4492549d80 MM-27572 permissions regression (#15215)
* Fix regression in HasPermissionToTeam

* Removing unessisary special case + verify system admins always have permissions.

* Fixing testing and bad cleanup.
2020-08-10 12:50:16 -07: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
Hossein Ahmadian-Yazdi
c3d945513c Token is not team and guest then error (#15193) 2020-08-07 08:03:30 -04:00
Christopher Speller
a22f02c867 MM-27412 Fixing /test command. (#15155)
* Fixing /test command.

* Add error handling to channels command.

* Switch to using app instead of client in some places.

* Fix lint being confused.

* Join channels automatically.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-06 16:18:47 -07: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
Rodrigo Villablanca
86290685ae RoleStore migration (#15017)
Automatic Merge
2020-08-04 16:37:21 +02:00
Jesús Espino
8b7e00f0f7 Fix empty string on app error (#15166) 2020-08-04 11:39:42 +02: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
Agniva De Sarker
339c5bae76 MM-26836: Remove some app fields which cause race conditions (#15019)
`(a *App) InitServer` was being called from multiple goroutines
and were modifying the fields of the App struct concurrently.
However, the fields were just reflecting the Server fields,
and we already have public getters for those fields.

Therefore, we remove those fields and just change the code to return
the server field directly.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-04 09:16:20 +05:30
Claudio Costa
4baf255dc2 Fix possible panic on server shutdown (#15140) 2020-08-03 10:28:47 +02:00
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
Christopher Poile
c5c6a5ce53 MM-26057 - Add CreateCommand plugin API (#14916)
Automatic Merge
2020-07-31 17:40:15 +02:00
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
Ibrahim Serdar Acikgoz
d03c4c777a app/notification_email_test: attempt to fix a flaky test (#15080)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-31 15:25:26 +02:00
Jesús Espino
ce82ff7e2b Add psd preview support (#15078)
* Add psd preview support

* Adding required vendor files

* Adding oov/psd license to NOTICE.txt file

* Adding the license notice for gopherjs to the NOTICE.txt

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-31 14:46:22 +02:00
Carlos Tadeu Panato Junior
390cade7fe admin/logs: Check if the license allows the cluster mode (#15138) 2020-07-31 12:05:44 +02:00
Agniva De Sarker
ff2455d05c MM-25050: Add gossip encryption to telemetry (#15137) 2020-07-30 22:18:54 +05:30
Agniva De Sarker
83974d8a8d preferencestore (#15018)
* Starting migration

* Migration finished

* Fix i18n

* Fix some tests

* Fix typos

* Remove overwite of http status

* Add i18n string

* Fix i18n

* fix breakages

* fix tests

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
2020-07-28 10:27:24 +05:30
Ben Schumacher
8f42177870 [MM-21703] Send telemetry for all Marketplace plugins (#14846) 2020-07-28 04:26:44 +02: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
Jesús Espino
2de5f75f47 Moving store layers into independent packages (#15004) 2020-07-27 15:14:16 +02: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
Agniva De Sarker
29c8b58fc7 MM-25478: Migrate compliancestore to plain error (#15074)
* ComplianceStore migration

* Fix imports

* Added one string

* fix go.tools.mod

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-27 15:23:02 +05:30
Agniva De Sarker
c0fa478cdd MM-27116: Drain push notification channel before closing (#15066)
* MM-27116: Drain push notification channel before closing

Without this, pending push notifications will not be sent when shutting down
or restarting the server.

* Fix race

* Re-arrange server shutdown

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-24 20:23:46 +05:30
catalintomai
d05fd5327b fix reference to non-instantiated error var (#15104)
Co-authored-by: Catalin Tomai <catalin.tomai@mattermost.com>
2020-07-23 21:05:13 -07: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
Agniva De Sarker
aad940e104 MM-27187: Use the correct page offset for cache clear methods (#15094)
* MM-27187: Use the correct page offset for cache clear methods

We were just using page and incrementing by 1. This would fetch pages
one by one like (1-100, 2-102, 3-103) rather than (1-100,100-200,200-300).

We fix that to update the correct page offset.

* Trigger CI
2020-07-23 19:55:16 +05:30
Rodrigo Villablanca
d9529183b2 UserAccessTokenStore migration (#15029)
* Migration completed

* Suggestions

* Fix no new var

* Fix another no new var in the left side
2020-07-23 14:28:49 +05:30
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
Doug Lauder
b372b98aca Removed (*App).Shutdown and updated all references. (#15088) 2020-07-22 13:30:11 -04: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
Agniva De Sarker
fea28821e3 MM-26052: Translate footer text in invite emails (#14956)
* MM-26052: Translate footer text in invite emails

We pass the user locale instead of the default locale to translate
the footer text too.

* Use default server locale
2020-07-22 09:41:30 +05:30
Ibrahim Serdar Acikgoz
263e5e8945 api4/user: convey redirect link through email verification (#15052) 2020-07-21 17:09:49 +03:00
dantepippi
aae3b9650f [MM-25477] - Migrate command webhook store AppError to error (#14703)
* Migrate command webhook store AppError to error

* Migrate command webhook store AppError to error

* Migrate command webhook store AppError to error

* Migrate command webhook store AppError to error

* Migrate command webhook store AppError to error

* Migrate command webhook store AppError to error

* Migrate command webhook store AppError to error

* Changes requested in the review.

* Changing http status

* fix i18n

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-07-19 08:42:03 +05:30
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
Harrison Healey
9805a594dd MM-26871 Add test for sidebar when moving channels between teams (#15021)
* MM-26871 Add test for sidebar when moving channels between teams

* Change require.NotNil to require.Error
2020-07-17 15:56:02 -04:00