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

1189 Коммитов

Автор SHA1 Сообщение Дата
Agniva De Sarker
6487d0ca91 MM-31062: Rewrite empty string checks to be more idiomatic (#16587)
https://mattermost.atlassian.net/browse/MM-31062

```release-note
NONE
```
2020-12-22 19:20:59 +05:30
Agniva De Sarker
1a131b54af MM-31064: Simplify indentation (#16565)
* MM-31064: Simplify indentation

Reduce indentation where possible.

```release-note
NONE
```

Command ran to verify:
golangci-lint run --disable-all --enable golint --max-issues-per-linter=10000 --max-same-issues=100000 ./... | grep "block ends with a return state"

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

* incorporate review comments

* enable golint for outdent rule

* fix remaining issues

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-21 18:50:47 +03:00
Jesús Espino
7419898449 Remove usages of AppError on filesstore service (#15841)
* Remove usages of AppError on filesstore service

* Fixing a golint error

* Fixing shadowed variable

* Adding err.Error() to the NewAppError calls

* Fixing tests

* Adding missed translations

* Fix error handling and updating the translation that affects it

* Fixing two typos
2020-12-20 12:53:07 +01:00
Mario de Frutos Dieguez
94fe01dc1d [MM-30539] New renewal link logic (#16539)
* New renewal link logic

Endpoint and logic that returns the renewal link to be used to start the
license renewal process.

* Limit access for restricted sysadmins

* Include active users in the renewal token
2020-12-18 16:40:46 +01:00
Martin Kraft
d2ad98bffd MM-30005: Require manage_system to patch system_admin role. (#16096)
* MM-30005: Require manage_system to patch system_admin role.

* MM-30005: Updates logic to include other new system roles.

* MM-30005: Removes unused translation.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-16 13:01:15 -05:00
Miguel de la Cruz
35e459227b [MM-30016] Allows to create incoming and outgoing webhooks for a different user (#16425)
* [MM-30016] Allows to create an incoming webhook for a different user

* [MM-30021] Allows to create an outgoing webhook for a different user

* Fix update test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-15 15:56:42 +01:00
Haardik Dharma
0b012ad468 [MM-31079]: Change receiver name for (me *TestHelper) in api4/apitestlib.go to be more idiomatic (#16501)
Automatic Merge
2020-12-12 05:15:17 +01:00
Claudio Costa
6c976c3b06 Generate preview regardless of HasPreviewImage value (#16535)
Automatic Merge
2020-12-11 00:15:17 +01:00
Ibrahim Serdar Acikgoz
5d41bffe5e [MM-30092] api4/image: add support for protocol rel. urls (#16189)
* api4/image: add support for protocol rel. urls

* reflect review comments

* Update api4/image.go

Co-authored-by: Juho Nurminen <juho.nurminen@mattermost.com>

* api4/image: prevent opaque urls to be processed

Co-authored-by: Juho Nurminen <juho.nurminen@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-10 09:54:13 +03:00
Florent Peterschmitt
349b83f23a implement and use striped LRU cache to lower mutex contention (#15764)
* Implement Striped LRU cache

* ci

* fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-09 19:25:14 +05:30
Scott Bishel
f548ecbee1 MM-27688-OpenId Connect (#16222)
* implement openid connect

* update error strings

* handle OpenIdSetting.Secret as FAKE SETTING

* add openid to telemetry

* update config defaults, add telemetry

* fix bug with Office365

* Retrieve Office365 AuthData from IdToken

* fix linter

* add feature flag, reset defaults for config

* fix build error

* fix unit tests

* add authentication permission to Feature
Flags

* turn off feature flag

* set default button color

* set default button color only on openid

* fix for merging FeatureFlags in config

* remove feature flag

* revert config changes

* remove debug statements

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-08 19:58:37 -07:00
Hossein
d666bb8b3d Add Billing Permissions (#16364)
* add billing permissions

* update store.go

* Update permission.go

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-08 12:41:28 -05:00
Eli Yukelzon
86e228b6c6 MM-30558 - Add unreadReplies and unreadMentions to thread membership (#16304) 2020-12-06 10:02:53 +02:00
Nick Misasi
fa5a033f66 [MM-30984] Missing payment email on billing day if no CC is present (#16442)
* Adding email and scaffolding for payment failure in case where customer has not added payment method

* Adding email template

* Remove unused boolean

* Fix error

* Add Email Us verbiage

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-03 16:02:43 -05:00
Claudio Costa
df906cad9d [MM-28422] Enable processing of import files through API (#16062)
* Implement unzip function

* Implement FileSize method

* Implement path rewriting for bulk import

* Small improvements

* Add ImportSettings to config

* Implement ListImports API endpoint

* Enable uploading import files

* Implement import process job

* Add missing license headers

* Address reviews

* Make path sanitization a bit smarter

* Clean path before calculating Dir

* [MM-30008] Add mmctl support for file imports (#16301)

* Add mmctl support for import files

* Improve test

* Remove unnecessary handlers

* Use th.TestForSystemAdminAndLocal

* Make nouser id a constant
2020-12-03 11:38:00 +01:00
Jesús Espino
a74fe05695 Removing supplier concept from the sql store (#16355)
* Removing supplier concept from the sql store

* Removing other metions to supplier

* Fixing gofmt

* Fixing gofmt

* Renaming NewSqlStore to New

* Fixing tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-02 12:06:23 +01:00
John Tzikas
3fdc6cb531 Fix misspellings and enable misspell on ci (#16285)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-12-01 16:27:05 +01:00
Eli Yukelzon
c2036f614e MM-30970 Add Basic unreadMentions support for collapsed threads (#16407)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-01 17:20:23 +02:00
Nick Misasi
9b6ee63a1e [MM-29845] Add CWS Webhook endpoint and payment failed email (#16351)
* Add a new handler to allow authentication via CWS API Key

* Make error better

* Add tests and cases for new handler functions

* Move some code around

* Add test for GetCloudSession function

* unset the env after test completion

* Remove white space

* Add CWS Webhook endpoint and email code

* handle returned errors from email sending function

* Change FailureCode to FailureMessage

* Remove unnecessary translations

* Fix translations

* Forgot to add template

* Update api4/cloud.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Update api4/cloud.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Update api4/cloud.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* PR changes

* Update app/email.go

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Close body in proper spot

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>
2020-11-25 15:45:15 -05:00
Agniva De Sarker
912d059658 MM-30706: Skip racy test TestWebSocket (#16357)
* MM-30706: Skip racy test TestWebSocket

We just skip the test for now

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

```release-note
NONE
```

* Add empty line

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-24 21:56:10 +05:30
Maria A Nunez
8a92888190 MM-30900 - Dropped condition of RestrictAdmin for filtering cloud_restrictable (#16365) 2020-11-24 09:03:34 -05:00
Nick Misasi
3099128bbd [MM-29845] Add a new handler to allow authentication via CWS API Key (#16319)
* Add a new handler to allow authentication via CWS API Key

* Make error better

* Add tests and cases for new handler functions

* Move some code around

* Add test for GetCloudSession function

* unset the env after test completion

* Remove white space

* Change Info to Warn

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-23 14:34:10 -05:00
Eli Yukelzon
cf4df5fcd2 MM-30048 added thread related socket messages (#16234)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-20 11:00:52 +02:00
Nick Misasi
887ef0b5e1 [MM-29515] Don't allow slack imports in cloud installations (#16271)
* Don't allow slack imports in cloud installations

* Update api4/team.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Add a test case for when the import is restricted in cloud

* Update api4/team_test.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Check for cloud license instead of restrictsystemadmin

* fix tests

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-17 12:56:17 -05:00
Agniva De Sarker
221f70a6cb MM-29487: Fix racy TestMuteCommandSpecificChannel (#16290)
The code was doing `go fakeApp.UpdateProductNotices()`
due to which the Store object was accessed in a racy manner
when it was reset if the localcachelayer flag was set.

We fix this by using the StoreOverride functionality
to pre-define what store to use while initializing the server
itself so that there isn't a need to reset the store _after_
the server is set.

We also apply the same fix in the app and api4 layers too
to prevent similar things from happening there.

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-17 21:13:35 +05:30
Rodrigo Villablanca
95221d9ace GroupStore migration (#15795)
* Migration completed

* Fix tests

* Fix tests

* Fix tests

* Suggestions

* Trigger CI

* Suggestions

* Merge with master

* Migration completed

* Fix typo

* fix err check

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-11-17 09:02:36 +05:30
Harrison Healey
2ebc8ec90f MM-20897 Add category muting (#16225)
* Make UpdateSidebarCategories return the original categories

* MM-20897 Add category muting

* Prevent muting the DMs category

* Fix muted state not being stored in the database

* Address feedback

* Address some feedback

* Fix unit tests

* MM-20897 Mute/unmute channels in the database in bulk

* Satisfy golangci-lint
2020-11-16 15:19:01 -05:00
Miguel de la Cruz
6c857a4525 [MM-30436] Add support for configuration custom defaults (#16265)
* [MM-30436] Add support for configuration custom defaults

* Addressing review comments

* Addressing PR comments

* Soft fail if the configuration defaults cannot be read

* Directly print error in log message

* Fix linter

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-16 15:25:48 +01:00
Agniva De Sarker
c82c37a36e MM-28067: Optimize app server startup in tests (#16263)
* MM-28067: Optimize app server startup in tests

For every test, we would wipe out the database and then start
the server again. This would run through all the migrations
and create new rows in Systems and Roles table every time.
As a result, this was consuming a lot of setup time for every test.

We optimize this by preloading the DB with dummy data in the roles
and systems table so that the server code just skips over those migrations.
This is completely forward compatible and adding new migrations does not
need to generate the sql files again. Only in case of schema changes to the
roles or systems table, this would need to be done.

It is unlikely the Systems table schema will get changed. The Roles table
might change in future but it's a comparatively rare event. Given the reduction
in CI runtime we are seeing, it's a worthy optimization.

We also apply some more optimizations:
- Coalesce multiple UpdateConfig calls into a single one. Each UpdateConfig call
has to do a json marshal which would take precious CPU cycles. It's much more
efficient to do everything in a single call.
- Remove unnecessary debug.FreeOSMemory in reload config. This was an artifact
from old days and is no longer required.

Numbers:
Results show a full **2 minutes** shaved off the test runtime. Earlier, tests
would take around 16 minutes. Now they take 14 minutes.

```release-note
NONE
```

* fix app package
2020-11-16 13:55:32 +01:00
Dexter Chua
e162c6c787 Indicate deleteBy in post_deleted websocket event (#15332)
This lets the client know who deleted the post. This information is
stored in the database, but cannot be retrieved from an API endpoint
because the API does not return information about deleted post.

Currently, the information is only sent to system administrators.
2020-11-16 11:56:29 +01:00
Farhan Munshi
c9a4a475d3 [MM-28717] Refactor applyMultiRoleFilters to use sq builder (#15500)
* Refactor apply multi role filters and add role filters to get all profiles

* Add some tests

* Fix tests

* Fix lint

* Trigger CI

* Rename param to make more sense

* Tie get filtered user stats to usermanagement read users

* Dont filter out other system roles when searching for team members or team admins only filter out system admins

* add new permissions

* add migration

* fix test

* remove system roles as default permissions

* implement changes discussed with dennis

* add read only and fix i18n

* use model consts instead of strings

* turn the permissions into pseudo constants

* Update read only default permissions

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>
2020-11-13 10:57:57 -05:00
Eli Yukelzon
45e340b5be MM-29987 Implement new collapsed threads API (#16091) 2020-11-08 10:36:46 +02:00
Joram Wilander
483441cea2 Soft fail on cloud user limit warnings when creating user (#16230) 2020-11-07 11:39:32 -05:00
Scott Bishel
3b580c03e9 MM-29223-Retrieve Compliance (#15825)
* Revert EN JSON stuff

* updat en.json

* Update en.json

* add unit test, update download for filename

* update to use filepath.Join

* linter errors

Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>
Co-authored-by: Hossein Ahmadian-Yazdi <hahmadia@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-06 17:56:56 -07:00
Miguel de la Cruz
d2ec53f1e9 Local mode migration for webhook endpoints (#16094)
* Migrate update/list/show webhook endpoints to local mode

* Fix shadow errors

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-06 11:09:41 +01:00
Ikko Ashimine
122acc3dd7 Fix typo in comment (#16208)
enviroment -> environment
2020-11-04 10:14:08 +01:00
Nick Misasi
714435fc4c Pass the filename from CWS on to the client (#16203) 2020-11-03 13:11:18 -05:00
Agniva De Sarker
325bff1176 MM-30041: Return correct error message for user save (#16117)
* MM-30041: Return correct error message for user save

We were collapsing all types of user conflict into a single
error message. Fixed it by inspecting the field of the invalidError type
and returning the correct message.

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

```release-note
NONE
```

* Fix test errors

* Fix wrong message in test when comparing error messages

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
2020-10-30 11:14:06 +05:30
Christopher Speller
1aadd36644 MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)
* Add feature flag managment system using split.io and remove viper.

* Fixing tests.

* Attempt to fix postgres tests.

* Fix watch filepath for advanced logging.

* Review fixes.

* Some error wrapping.

* Remove unessisary store interface.

* Desanitize SplitKey

* Simplify.

* Review feedback.

* Rename split mlog adatper to split logger.

* fsInner

* Style.

* Restore oldcfg test.

* Downgrading non-actionable feature flag errors to warnings.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-29 15:54:39 -07:00
Harrison Healey
8bb772638c MM-29067 Add deterministic IDs for default sidebar categories (#16030)
Automatic Merge
2020-10-29 10:24:01 -04:00
Mario de Frutos Dieguez
f5531a5a43 [MM-29523] EmailVerified flag can be user as parameter (#16031)
* EmailVerified flag can be used as a parameter

But only when if the user creator is an admin
2020-10-27 10:41:20 +01:00
Ben Schumacher
76f1bfb941 [MM-29361] Send cloud flag with Marketplace requests (#15913) 2020-10-26 21:57:19 +01:00
Nick Misasi
3697f92045 [MM-28363] User Limit Overage Warning Emails (#16053)
* Adding files, commit of UI in good shape

* Translations added, working with activation and deactivation

* Add check for error

* Fix i18n?

* Push without subscription check so Steve and Matt can look at it

* Fix font-weight in chrome

* Fix font-weight on button

* UX fixes

* Fixes for PR

* Add back subscription stuff

* Fix tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-26 13:24:26 -04:00
Mario de Frutos Dieguez
b68f171162 [MM-29157] Cloud invoices logic (#16056)
* Cloud invoices logic

This commit includes all the code needed to get and print invoices
from CWS
2020-10-26 18:17:55 +01:00
Rodrigo Villablanca
96f1739f8f UserStore migration (#15563)
* Migration completed

* Fix tests

* Fix tests

* Fix tests

* Suggestions

* Trigger CI

* Suggestions

* Merge with master

* Trigger CI

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-10-26 15:11:27 +05:30
Claudio Costa
e5e2dbdf1a [MM-29731] Fix panic in saveUserTermsOfService (#16044)
* Fix panic in saveUserTermsOfService

* Remove unneeded initialization
2020-10-21 17:08:33 +02:00
Devin Binnie
73a1c95137 [MM-28218] API hookup for updating company info and address in MM app (#15974) 2020-10-20 11:46:58 +02:00
Nick Misasi
90738de75f Add webhook event for when user status changes from activated to deactivated and vice versa (#15990)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-19 10:29:43 -04:00
Nick Misasi
e27a75fba6 [MM-29646] Add check for IsPaidTier, and don't send emails over limit for guest invites (#15958)
* Add check for ispaidtier to email invites

* Add same check for guest emails

* Update api4/team.go

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Update api4/team.go

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Check for an error and return if there is one

* Fix tests

* Remove test to move to enterprise repo

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>
2020-10-14 19:44:44 -04:00
Nexus Web Development
5b16ac7f13 Update file.go (#15751) 2020-10-13 15:35:19 +02:00