Commit Graph

10698 Commits

Author SHA1 Message Date
Jesse Hallam
72448d12a9 deprecate timezones.json (#10311) 2019-02-25 12:07:45 -04:00
κουκουλοφόρος
5b24c44e19 Add missing transaction rollbacks for SQL store (#9964)
* Add missing transaction rollbacks for SQL store

* Add `defer transaction.Rollback()` in SQL stores.

* abstract finalizeTransaction
2019-02-23 11:44:52 -08:00
Shobhit Gupta
b4d645f121 [MM-13746] Add GetTeamMembersForUser and GetChannelMembersForUser apis (#10269)
* Add GetTeamMembersForUser and GetChannelMembersForUser apis

* Address comments

* Fix tests

* Fix test

* Fix comment

* Fix minimum server version

* Change to []*model.ChannelMember

* Fix panic, add more tests

* Remove print statement
2019-02-23 11:41:19 -08:00
Daniel Schalla
0e50ec6a35 Use LogAudit instead of LogAuditWithUser for role/auth provider modification (#10312) 2019-02-22 16:20:59 +01:00
Jesse Hallam
7150b9aada einterfaces: simply saml.ConfigureSP error handling (#10306) 2019-02-21 09:51:25 -08:00
Katie Wiersgalla
659af08ee4 Update PRIVACY_POLICY.md (#10287) 2019-02-21 10:30:35 -05:00
Angela Chang
1018ead619 [MM-8421] Fix tiff preview - backend (#10170) 2019-02-21 09:06:59 +01:00
Daniel Schalla
26d3362eca Invalidate password recovery tokens on eMail change (#10302) 2019-02-21 00:48:28 +01:00
Daniel Schalla
ab812207ab [MM-13610] Fix Login Hooks for SAML (#10288)
* Fix Login Hooks for SAML

* Update unit tests

* Delete extra whitespace

Co-Authored-By: DSchalla <daniel@schalla.me>
2019-02-20 18:04:50 +01:00
Daniel Schalla
166ab15f38 Check whether self-deactivation is enabled in delete handler (#10300) 2019-02-20 16:56:26 +01:00
Daniel Schalla
f046163a12 [MM-13840] Change eMail as a post-verification action (#10253)
* Change eMail as a post-verification action

* Fix broken test

* comment for special behavior, tests

* govet

* Check for already existent eMails when require email verification is turned on before accepting update
2019-02-20 15:50:52 +01:00
Daniel Schalla
1218e774ba Make CSRF Logging less verbose if not enforced (#10279) 2019-02-20 15:21:19 +01:00
Hanzei
b057e9feef Let stale bot ignore pr further in the lifecycle (#10294)
* Let stale bot ignore pr further in the lifecycle

* Update per feedback
2019-02-19 09:21:33 -05:00
Carlos Tadeu Panato Junior
4646c38295 Dbups (#10297)
* upgrade db to 5.9

* Prepare db upgrade to 5.10
2019-02-19 09:20:37 -05:00
Sandeep Sukhani
29060acb45 [MM-13828] Initialize tests in each package with a new temp folder with all test resources (#10261)
* [MM-13828] Running tests from a new temp folder with all test resources

Possible fix for #10132

All packages which have a TestMain and use testlib.MainHelper will have a new current working directory which will have all the test
resources copied.

Note: default.json is copied as config.json as well to make sure tests don't have any impact due to changes in config by devs

* [MM-13828] Added TestMain to remaining packages to use testlib.MainHelper

This makes sure tests from all packages run with same test resources, setup in a new temp folder for each package

* Updated Jenkins file to not not config/default.json

This makes sure CI has same config files as a dev's machine

* [MM-13828] Changes requested from code review

Added accessor methods to testlib.MainHelper for accessing members
Fixed some broken tests due to change in cwd while tests run
Some other code refactoring and improvements

* [MM-13828] Added new factory method with options for creating test main helper and some code refactoring

testlib.NewMainHelperWithOptions supports options to turn on/off test dependencies and environment setup
Some other code refactoring

* Exporting members of testlib.MainHelper to make enterprise tests work

* Fixed gofmt error

* [MM-13828] removed unwanted dependency on plugins directory while setting up test resources

* [MM-13828] Fixed some tests failing due to them being running from temp folder

* [MM-13828] Some code changes suggested in PR review

* Fixed gofmt error
2019-02-19 09:20:11 -05:00
Adzim Zul Fahmi
f4249b5456 [MM-12304] Add channel search support in mattermost cli (#10093)
#### Summary
add command search on channel group.
it could search channel by name or id in general
and search channel with team by team name or id

#### Ticket Link
Fixes https://github.com/mattermost/mattermost-server/issues/9491
https://mattermost.atlassian.net/browse/MM-12304

#### Checklist
- [x] Added or updated unit tests (required for all new features)
2019-02-19 07:42:30 +01:00
Jesse Hallam
9bf5687311 MM-11262: database config store (#10281)
* vendor github.com/jmoiron/sqlx

* MM-11262: introduce a database store

* revert unnecessary fmt.Errorf

* simplify unit test helper methods

* remote TODO re: retry

* relocate initializeConfigurationsTable for clarity

* factor out a commonStore

* acquire database config lock on close for safety

* add missing header

* fix lock comment
2019-02-15 10:05:29 -04:00
Carlos Tadeu Panato Junior
898a3a289c add stale bot (#10143)
* add stale bot

* update per feedback

* update per feedback
2019-02-15 14:25:29 +01:00
Shreyansh Chouhan
39ceaa3e86 [MM-13833] Configured unit tests to log through t.Log (#10272)
* Rerouted the unit test logs through t.Log

* resolving merge confilvts

* Update testing.go

* Update helper_test.go

* Added godocs for NewTestingLogger

* Added go docs for NewTestingLogger

* Resolving conflicts
2019-02-14 13:52:11 -04:00
Daniel Schalla
a6d0b73c0d Keep current eMail verification status when updating the user password (#10284) 2019-02-13 22:08:37 +01:00
Carlos Tadeu Panato Junior
42356bc74f add codecov back (#10215)
* add codecov back

* add token

* remove option

* update codecov

* upddate codecov

* add back threshold

* add some configs

* update per feedback

* add error fallback

* fix error

* testing
2019-02-13 15:32:12 -04:00
Jesse Hallam
cd5d5f832c MM-14052: fix subpath yet again (#10278)
* MM-14052: fix subpath yet again

The server now emits a script-src directive that overrides the root.html
rewrite. Fix this by emitting the requisite sha-256 hash server-side as
well as rewriting root.html. We can't remove the root.html rewrite,
since the assets may be on a CDN instead and we use the same code path
to rewrite them (on demand).

Prior to this change, going from / -> /subpath -> / would leave changes
in root.html: the Content-Security-Policy header would still have the
sha-256 hash, and the inline script would still override the publicPath
but to the default subpath value. To avoid sending down a sha-256 hash
server-side when no subpath is required, change this to fully strip out
the subpath changes. This is the only unit test change, as the existing
coverage proves the algorithm still works.

* fix subpath concatenation in test

path.Join isn't meant to work with a URL + path, and my test was effectively working with the subpath "/localhost:8065/subpath" instead of just "/subpath". The CI servers presumably caught this due to a different configuration than my local development.
2019-02-13 11:30:02 -04:00
Miguel de la Cruz
e9089acb6c Logs the errors when indexing and deleting posts with elasticsearch (#10282) 2019-02-13 16:17:59 +01:00
Daniel Schalla
e8e4e94b37 Fix out of range error if Search Replicas > Replicas (#10280) 2019-02-13 12:47:55 +01:00
Andrew Braunstein
c08fda1337 Added the SearchPostsInTeam method to the plugin API (#10106) 2019-02-13 07:41:32 +01:00
Harrison Healey
87e36a3ecf MM-14146 Update CSP for local image proxy (#10277) 2019-02-12 15:27:17 -05:00
Jesse Hallam
285b646d67 MM-13893: introduce file store (#10243)
* config file store

Introduce an interface and concrete implementation for accessing the config.

This mostly maps 1:1 with the exiting usage in `App`, except for internalizing the watcher. A future change will likely eliminate `App.PersistConfig()` and make this implicit on `Set` or `Patch`

* experimental file test changes

* emoji: move file driver checks from api4 to app

It is no longer possible to app.UpdateConfig and provide an invalid configuration, making it hard to test this case. This check doesn't really belong in the api anyway, since it's a configuration validity check and not a permissions check. Either way, the check now occurs at the App level.

* api4: generate valid public link salts for test

* TestStartServerRateLimiterCriticalError: use mock store to test invalid config

* remove config_test.go

* remove needsSave, and have Load() save to the backing store as necessary

* restore README.md

* move ldap UserFilter check to model isValid checks

* remove databaseStore until ready

* remove unimplemented Patch

* simplify unlockOnce implementation

* revert forgetting to set s.Ldap

* config/file.go: rename ReadOnlyConfigurationError to ErrReadOnlyConfiguration

* config: export FileStore

* add TestFileStoreSave

* improved config/utils test coverage

* restore config/README.md copy

* tweaks

* file store: acquire a write lock on Save/Close to safely close watcher

* fix unmarshal_test.go
2019-02-12 10:19:01 -08:00
Christopher Speller
9cfcab2307 MM-14039 Improving password lockout functionality. (#10254)
* Improving password lockout functionality.

* Switching order of mfa password checks to passowrd -> mfa
2019-02-12 07:56:41 -08:00
Jesse Hallam
3a71709103 MM-13893: refactor config (#10230)
* refactor utils/config* to config/

* pull validateLdapFilter into app

* clean up Config/GetConfig/GetSanitizedConfig usage

Eliminate app.GetConfig() in favour of just using app.Config() directly,
but expose app.GetSanitizedConfig() for when the old behaviour was
required.

* web: isolate config setup

* TestInvitePeopleProvider: make config explicit

* regenerateClientConfig: avoid racey map access

* integrate watch flag into app.ConfigFile option

* make app.Option return an error

* release.mk: only cp static files from config/

* release.mk: fix cp static files from config/

* api4: TestPlugin cleanup

* s/c/cfg/ for clarity

* fix merge conflict

* testlib: allow customization of testlib driver name
2019-02-12 08:37:54 -05:00
Jesse Hallam
aca8914e35 MM-14052: Fix subpath rewrite again (#10252)
* actually log an error when subpath rewrite fails

* update subpath rewrite to accommodate dropping unsafe-eval
2019-02-11 21:21:23 -05:00
Yusuke Nemoto
93244fdaa1 Add authorization header to request from post action to plugin (#10165)
* Add authorization header to request from post action to plugin
2019-02-09 05:22:22 -08:00
Harrison Healey
0e31ce9110 MM-13997 Prioritize images over OpenGraph metadata when requesting metadata (#10241) 2019-02-09 10:44:38 +01:00
Dan Maas
4fef9fe9ea Update NOTICE.txt (#10218)
(this is the automated NOTICE.txt update for February 2019)

- add new dependencies (willnorris/imageproxy, Masterminds/squirrel)
- misc copyright owner updates
2019-02-09 10:44:14 +01:00
Christopher Speller
03a96d71d8 Fixing plugin API not having proper access to Cluster. (#10257) 2019-02-08 18:13:52 -08:00
Harrison Healey
4dbeaffdf0 MM-14037 Ensure deprecated image proxy settings are read correctly (#10249) 2019-02-08 10:08:36 -05:00
Harrison Healey
3a8e8739b2 MM-13996 Properly get image dimensions for OpenGraph images using secure_url (#10240)
For images in the OpenGraph metadata, we only looked for the `url` field, but we should've also been looking for the `secure_url` field for sites that defined it. We also set the `secure_url` field when proxying OpenGraph images as well, so we were not properly giving image dimensions for OpenGraph images.

#### Ticket Link
https://mattermost.atlassian.net/browse/MM-13996
2019-02-07 19:43:25 +01:00
Joram Wilander
5cc767fc1b Do not update channel message count for team add/remove message (#10225) 2019-02-07 12:32:38 -05:00
Yusuke Nemoto
06f384df6d Enable PluginJobs (#10198) 2019-02-06 08:25:07 +01:00
Carlos Tadeu Panato Junior
ac68236b88 add fallback to master (#10235) 2019-02-05 13:07:44 -08:00
Carlos Tadeu Panato Junior
5172591437 use $env.CHANGE_TARGET when switch branch (#10228) 2019-02-05 17:10:44 +01:00
tauu
bfe33d683b Fixed login hooks not being called during first OAuth login (#10206)
* Fixed login hooks not being called during first OAuth login

* prevent call AddUserToTeamByTeamId twice for new users in LoginByOAuth
2019-02-05 16:27:54 +01:00
Martin Kraft
afcb224a79 Adds configuration for separate reply-to email header. (#10144)
* Adds configuration for separate reply-to email header.

* Changes config setting name.

* Using a separate variable and value in test.

* Updates for config pointer changes in another PR.

* Adds new key to test config. Adds default value.
2019-02-04 17:01:05 -05:00
Daniel Schalla
ba7ab0b8d1 Indicate incorrect password compared to empty / invalid password field in the error response (#10223) 2019-02-04 18:54:57 +01:00
Harrison Healey
dbf54b3599 MM-13838 Bypass the HTTP client when getting image dimensions from the image proxy (#10208)
* MM-13838 Bypass the HTTP client when getting image dimensions from the proxy

* Add additional log messages to debug failing test

* Fix unit test to work on Jenkins
2019-02-04 12:43:30 -05:00
Daniel Schalla
85c60f1402 [MM-13839] Check for password when updating the eMail (#10207)
* Check for password when updating the eMail

* Require password for email change

* Enhance unit testing

* Restructure error handling for update email path

* govet
2019-02-01 19:06:49 -04:00
Martin Kraft
9a3dc21adc Changes signature of FirstLoginSync function. (#10211)
* First login fix (2).

* Adds cautionary note about 'sanitized' fields.
2019-02-01 18:37:11 -04:00
Daniel Schalla
145fa9a57b [MM-13891] Enable team domain restriction for AuthService users (#10209)
* Enable team domain restriction for AuthService users

* govet
2019-02-01 18:28:35 -04:00
Harrison Healey
46b05499cc MM-13932 Fix image metadata for invalid image links (#10217) 2019-02-01 18:23:04 -04:00
Daniel Schalla
a2f46c0466 [MM-13889] Limit OpenGraph data response size (#10213)
* Limit OpenGraph data response size

* Add LimitReader to Metadata Image
2019-02-01 18:55:43 +01:00
Christopher Speller
4e0840969b MM-13923 Fixing pulling from incorect cache. (#10216)
* Fixing pulling from incorect cache.

* Adding caching test.
2019-02-01 08:13:51 -08:00