Commit Graph

16 Commits

Author SHA1 Message Date
Harshil Sharma
e4aa729a0c MM-34437 Preventing infinite trial requests (#17472)
* MM-34434: Added 'is_trial' boolean to all trial license requests and to the License struct.

* MM-34434: Generalized the concept of a license request.

* MM-34434: Verifies JSON field of license instance is set.

* MM-34434: Added missing client param.

* MM-34434: Added some tests of the request trial API endpoint.

* MM-34434: Removed comment.

* fix broken test (#17348)

* Add missing wrapped errors (#17339)

* Improve document extraction and including a document extraction command (#17183)

* Add extract documents content command

* Adding the extraction command and making the pure go pdf library as secondary option

* Improving the memory usage and docextractor interface

* Enable content extraction by default in all the instances

* Tiny improvement on archive indexing

* Adding App interface generation and the opentracing layer

* Fixing linter errors

* Addressing PR review comments

* Addressing PR review comments

* Update en.json (#17356)

Automatic Merge

* adding new feature flag (#17308)

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>

* Bump no_output_timeout to 2 hours (#17358)

* log invalid username (#17345)

Automatic Merge

* MM-34434: Added missing client param.

MM-34434: Added some tests of the request trial API endpoint.

MM-34434: Removed comment.

* MM-34434: Switched to a hard-coded true value.

* MM-34434: Reverts test change.

* MM-34434: Removes unnecessary field.

* MM-34434: Tests that is_trial is hard-coded by TrialLicenseRequest.

* MM-34434: Removed accidental commit.

* MM-34434: Removes unnecessary is_trial key from JSON payload.

* MM-34434: Reverts to old pointer receiver variable name.

* MM-34434: Removes test.

* #MM-34437 Initialized license service

* ##MM-34437 Verified at all points if server is trial elligible

* WIp

* #MM-34437 removed unused commented code

* MM-34437 make a log less severe

* #MM-34437 generated einterface mocks

* #MM-34437 added license on new file

* #MM-34437 removed unused translation

* #MM-34437 some refactoring

* Update api4/license.go

* Update api4/license.go

* #MM-34437 made a variable name consistent

* #MM-34437 Added mocks for lince validator

* #M--34437 Added license validator test framework

* #MM-34437 Renamed isTrial method to isTrialLicense to avoid conflict with newlya dded field

* #M--34437 Allowed sales-sanctioned trials

* #MM-34437 fixed trial license API tests

* Added tests for add license API

* #MM-34437 fixed ValidateLicense test

* #MM-34437 Added util tests

* #MM-34437 using NoError for checking no error

* #MM-34437 using NoError for checking no error

* Added dummy piblic key for testing

* Fixed tests

* #MM-34437 udpaetd trial license URL for testing

* #MM-34437 adjusted times for licences generated through admin portal

* Reverted test-only changes

Co-authored-by: Martin Kraft <martin@upspin.org>
Co-authored-by: Hossein <hahmadia@users.noreply.github.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: Amy Blais <amy_blais@hotmail.com>
Co-authored-by: Ben Cooke <benkcooke@gmail.com>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Max Erenberg <max.erenberg@mattermost.com>
2021-06-17 17:37:34 +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
Agniva De Sarker
181b5632bf MM-26883/26884: properly identify interface name for test services (#15040)
* MM-26883/26884: properly identify interface name for test services

We were just hardcoding to dockerhost which would only work inside
a CI environment. This PR generalizes the logic to use fallbacks
if dockerhost is not available.

* Incorporate review comments
2020-07-17 14:32:07 +05:30
Jesús Espino
a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00
Miguel de la Cruz
2259b7f2a8 [MM-19948] Set version on module file and internal paths (#13186)
* [MM-19948] Set version on module file and internal paths

* Fixes after merge

* Fix i18n checker error
2019-11-28 14:39:38 +01:00
Agniva De Sarker
2db6823f5d Refactor more code to use testutils.WasCalled (#13054)
* Refactor more code to use testutils.WasCalled

* incorporate review comments

* Revert watcher_test.go changes

The file is in config package and the other tests use config_test.
So it is not visible.
2019-11-13 16:11:26 +08:00
Agniva De Sarker
8ab0e80b77 MM-19022: Convert config/watcher_test.go t.Fatal calls into require calls (#12524)
* Convert config/watcher_test.go t.Fatal calls into require calls

* Moved wasCalled to a public helper function

Now the testutils package has a new function WasCalled
that can be used by anywhere.
2019-10-02 18:57:43 +02:00
Lev
3ad901b50b MM-10516: Added support for PostActions in ephemeral posts (#10258)
* Added support for PostActions in ephemeral posts

The general approach is that we take all the metadata that DoPostAction
needs to process client DoPostActionRequests, and store it in a
serialized, encrypted Cookie field, in the PostAction struct.

The client then must send it back, and it is then used to process
PostActions as a fallback top the metadata in the database.

This PR adds a new config setting, `ServiceSettings.ActionCookieSecret`.
In a cluster environment it must be the same for all instances.

- Added type PostActionCookie, and a Cookie string to PostAction.
- Added App.AddActionCookiesToPost.
- Use App.AddActionCookiesToPost in api4.createEphemeralPost,
  App.SendEphemeralPost, App.UpdateEphemeralPost.
- Added App.DoPostActionWithCookie to process incoming requests with
  cookies. For backward compatibility, it prefers the metadata in the
  database; falls back to cookie.
- Added plugin.API.UpdateEphemeralPost and plugin.API.DeleteEphemeralPost.
- Added App.encryptActionCookie/App.decryptActionCookie.

* Style

* Fixed an unfortunate typo, tested with matterpoll

* minor PR feedback

* Fixed uninitialized Context

* Fixed another test failure

* Fixed permission check

* Added api test for DoPostActionWithCookie

* Replaced config.ActionCookieSecret with Server.PostActionCookieSecret

Modeled after AsymetricSigningKey

* style

* Set DeleteAt in DeleteEphemeralPost

* PR feedback

* Removed deadwood comment

* Added EXPERIMENTAL comment to the 2 APIs in question
2019-03-01 10:15:31 -08:00
Christopher Speller
8429add371 Cleanup related to context refactor (#9988) 2018-12-17 08:51:46 -08:00
Harrison Healey
749a3e7538 MM-10417 Improve HTTPService for use in image proxy (#9966)
* Replaced httpservice with proper http.Client

* Added HTTPService.MakeTransport

* Expose timeouts used by HTTPServiceImpl

* Add additional documentation to HTTPService

* Remove MockedHTTPService

* Fix missing license
2018-12-12 11:39:14 -05:00
Christopher Speller
da265fbaf7 Moving app from singular to being created for every request (#9889)
* Moving app from singular to being created for every request.

* Automatic refactor

* Adding license header

* Feedback fixes
2018-11-28 10:56:21 -08:00
Harrison Healey
d07def5169 Merge branch 'master' into post-metadata 2018-11-14 09:58:56 -05:00
Christopher Speller
418a0ec10e Fixing formatting. (#9801) 2018-11-06 16:28:55 +08:00
Harrison Healey
2959b53d98 MM-11272 Add OpenGraph and image dimension metadata to posts (#9313)
* Move OpenGraph code into its own file

* Move OpenGraph image proxying to app layer

* Move test file code out of api4 package

* MM-11272 Add OpenGraph and image dimension metadata to posts
2018-11-01 15:25:11 -04:00
Andreas Linz
cf9b9802a8 Set a proper HTTP user-agent header (#9482)
Previously, mattermost-server would always request with the default
user-agent of Go's net/http package that is `Go-http-client/1.1` or
something similar.
This has several disadvantages, one is that the default user-agent
made it pretty hard to distinguish mattermost requests from other
service requests in a network log for example.

Now a user-agent of the form `mattermost-<current-version>` is set in
the client.

- [x] Added or updated unit tests (required for all new features)
2018-10-03 10:28:44 -07:00
Harrison Healey
4e59a27293 Move HTTPService and ConfigService into services package (#9422)
* Move HTTPService and ConfigService into utils package

* Re-add StaticConfigService

* Move config and http services into their own packages
2018-09-26 12:42:51 -04:00