Commit Graph

10180 Commits

Author SHA1 Message Date
Harrison Healey
ecfba2c2e9 MM-11175 Add logic to server to understand markdown images with dimensions (#9159) 2018-08-01 11:43:58 -04:00
Jesús Espino
d81a61398d Migrate all the api4 to handle errors in idiomatic way (#9143) 2018-08-01 16:55:18 +02:00
Jesús Espino
1f168263a2 Split app/import.go in multiple files (#9179) 2018-08-01 15:45:26 +02:00
der-test
f4fdd7835b Fixed inconsistencies (#9120)
* Fixed inconsistencies

See https://pre-release.mattermost.com/core/pl/339m9zipst8n7kc19fossntose

* Update en.json
2018-08-01 07:41:17 -04:00
Elias Nahum
be8b6177e3 translations PR 20180730 (#9191)
* translations PR 20180730

* Fix japanese
2018-08-01 07:40:19 -04:00
Jesse Hallam
0788cdcadf MM-11420: plugins: compute bundle hash on load (#9172)
* plugins: compute bundle hash on load

Use this hash to bust client caches whenever the plugin bundle changes.

* eliminate redundant pluginHandler

* switch to 64-bit FNV-1a

* Fix test
2018-07-31 16:29:52 -04:00
Jesús Espino
8c56f52d17 Migrate notification_push_test to table testing (#9195) 2018-07-31 20:29:57 +02:00
George Goldberg
a6c364822a MM-11516: Check channel ID in URL param and Body are same. (#9185) 2018-07-31 14:13:44 -04:00
Christopher Speller
82dfe9e61d Adding support for code split plugins. (#9184) 2018-07-31 07:44:44 -07:00
George Goldberg
8766690c81 MM-10502: Only cluster master should run job schedulers. (#9174)
* MM-10502: Only cluster master should run job schedulers.

* Use sync.Map for thread safety.

* Fix tests.
2018-07-31 07:40:23 -07:00
Jesse Hallam
fcb4ee935e gob register AppError (#9182)
This allows plugin hooks to return the result of calling the API as an
`error`.
2018-07-31 10:34:40 -04:00
Joram Wilander
867416b0e6 Add OAuth2 login hint for SAML (#9194) 2018-07-31 07:29:19 -07:00
Joram Wilander
709101c4df Save OAuth access token to DB for consistency with other flows (#9190) 2018-07-31 08:40:48 -04:00
Joram Wilander
cff9ac0df8 Add siteURL to WS origin check (#9183)
* Add siteURL to WS origin check

* Handle subpath

* Only add site URL if not *
2018-07-30 17:21:57 -04:00
Christopher Speller
de1ce2373d Fix build. (#9188) 2018-07-30 13:15:24 -07:00
Martin Kraft
5872bf9c2f Pr 9039 (#9187)
* MM-11065: Allow to search and get archived channels from the API

* Fixing more tests

* Add some unit tests

* Add includeDeleted parameter to session permissions check function

* More test fixing

* Adding archive channels list in channels search

* Add restriction for archived channel edition

* Reverting permissions checks modification

* Changed the query parameter to include_deleted

* Enable search archive channels as true by default

* Adding tests for verify search on deleted channels

* Allowing to override archive channels during the imports

* Fixed test

* Search in archive channels from the API must be explicitly requested

* Removing includeDeleted parameter from GetChannelByName and GetChannelByNameForTeam

* Back to ViewArchivedChannels config

* Fixing tests

* Reverting GetChannelByName parameter

* Add include deleted parameter on GetChannel functions in plugins api

* Fixing tests
2018-07-30 15:06:08 -04:00
Martin Kraft
65cd447a61 MM-11301: Validates listen address config value. (#9138)
* MM-11301: Validates listen address config value.

* MM-11301: Adds some invalid port test cases.

* MM-11301: Accept domain names.

* MM-11301: Fix for max port.
2018-07-30 14:59:08 -04:00
Daniel Schalla
d23ca07133 Login Hooks (#9177)
Tests; gofmt
2018-07-30 11:55:38 -07:00
Jesús Espino
08e54ed824 Split notifications file into different files (#9164) 2018-07-28 19:20:44 +02:00
Saturnino Abril
51dc5fa36e [MM-10621] Set createAt timestamp on file upload api call to secure upload order of files (#9170)
* set createAt timestamp on file upload api call to secure upload order of files

* fix test on plugin hooks
2018-07-28 14:27:55 +08:00
Joram Wilander
6ac82d5171 Implement OAuth2 implicit grant flow (#9178) 2018-07-27 17:35:43 -04:00
Joram Wilander
441c8741c1 Fix compile error caused by bad merge (#9176)
* Fix compile error caused by bad merge

* Fix

* Fix
2018-07-27 12:57:17 -04:00
Jesse Hallam
835c0871a0 MM-11431: handle plugin deadlocks (#9167)
* ensure plugin is always shutdown

Once we call `.client.Client()` the plugin has started, and must be shut
down. `newSupervisor` sometimes returned with an error (and without a
reference to the supervisor), leaving the client running indefinitely.

* Clarify the documentation to explain that plugin hooks will not trigger until `OnActivate` returns successfully, and will stop triggering just before `OnDeactivate` is called.

* test for plugin deadlock

* plugin/environment.go: switch to sync.Map

From: https://golang.org/pkg/sync/#Map

> If a goroutine holds a RWMutex for reading and another goroutine might call Lock, no goroutine should expect to be able to acquire a read lock until the initial read lock is released. In particular, this prohibits recursive read locking. This is to ensure that the lock eventually becomes available; a blocked Lock call excludes new readers from acquiring the lock.

The previous `RWMutex` was not safe given that we effectively acquired read locks recursively (hook -> api -> hook). This worked up until we activated or deactivated plugins, tried to acquire a write lock, and the plugin used the API to effectively trigger another hook.

Switching to sync.Map avoids this by divesting the need to lock at all, avoiding the potential for a recursive lock in the first place.
2018-07-27 11:37:17 -04:00
Jesse Hallam
1d9c144854 s/mlog/log/ in apiRPCClient (#9171)
We never actually initialized `log` on apiRPCClient, and it can't log
without making an RPC call anyway, so just switch to logging errors from
the plugin to STDERR instead.
2018-07-27 08:17:29 -07:00
Christopher Speller
026f0152a8 Adding FileWillBeUploaded plugin hook (#9169)
* Adding file upload hook.

* Adding hook test for FileWillBeUploaded

* Some debugging fixes.

* Fix typo.

* Fixing double close

* Fix capitalization on docs.
2018-07-27 08:25:53 -04:00
Christopher Speller
90e5e279c1 Fix file streaming to close files. (#9168) 2018-07-26 10:52:24 -07:00
Christopher Speller
bae26ec268 MM-11160 Adding proper CORS support. (#9152)
* Adding proper CORS support.

* Better CORS tests.
2018-07-26 08:31:22 -07:00
George Goldberg
185ed89978 MM-11243: Make Elasticsearch work after enabling without restart. (#9146)
* MM-11243: Make Elasticsearch work after enabling without restart.

* Also cope with config vars changing whilst enabled.
2018-07-26 15:50:38 +01:00
Jesse Hallam
8948b91d7a unpack prepacked plugins on plugins initialization (#9149)
* unpack prepackaged plugins on plugins initialization

* leverage utils.FindDir
2018-07-26 08:45:26 -04:00
Jesse Hallam
f8f80d80df Fix plugin.ServeHTTP subpath (#9161)
* test ServicePluginRequest with subpath

* handle subpath when routing to plugin.ServeHTTP
2018-07-26 08:33:56 -04:00
Pradeep Murugesan
b3c2ecd9b9 added the custom icon and username for the outgoing webhook and its response (#9141)
* 8272 added the username and icon as part of the model and persisted the same

* 8272 added the custome icon and name when set to the web hook response

* 8272 changed the infinte loop to timeout after 5 seconds

* 8272  fixed review comments
2018-07-25 08:31:41 -04:00
Jesse Hallam
b89ccca929 fix plugin example docs (#9148) 2018-07-25 08:01:13 -04:00
Hyeseong Kim
8387d92ea2 MM-10381: Change the file downloading API to stream file (#9144)
* Change the file downloading to stream file

* Change file downloading to chunk only for preview

* Remove unnecessary else case
2018-07-24 11:23:54 -07:00
Harrison Healey
c8d3e42139 MM-11451 Added autolinking to Markdown parser (#9151)
* MM-11451 Added autolinking to Markdown parser

* Added missing headers

* Added mailto and tel links
2018-07-24 07:40:01 -07:00
Jesús Espino
bfb2640451 Add idiomatic error handling in mattermost commands (#9147) 2018-07-24 10:11:47 -04:00
Chris Duarte
da124f018d Add ExperimentalSidebarPreference in the config (#9013)
* Add ExperimentalSidebarPreference in the config

* Override Sidebar preference based on GroupUnread settings

* Rename to ExperimentalChannelOrganization

* Add Sidebar config in diagnostics

* Fix diagnostics for experimental_channel_organization
2018-07-23 11:18:24 -04:00
Jesús Espino
e475cecf00 Remove unnecesary elses after return error (#9137) 2018-07-23 11:55:42 +05:30
Christopher Speller
bac3376278 Updating dependencies (#9139) 2018-07-22 20:14:05 -07:00
Daniel Schalla
3539a9a60b Default Channel Functionality + Test Suite (#9068)
gofmt

Make skipping for non public channels default

Deduplication of Default Channels; Only post join to townsquare

Post join channel message for all custom default channels
2018-07-20 17:00:58 -04:00
Yusuke Nemoto
6104c37761 Break HTML blocks to individual strings (#8903)
* Modifying message and templates about mfa_change

* Modifying message and templates about password_change

* Modify message and template about password_reset

* Modify message and template about singin_change

* Modify message and template about email_info

* Modify message and template about change_username

* Modify message about change_email

* Add missing props

* Add argument

* Modify message and template about token_added

* Modify messages and template about notification_email

* Modify message and template about deactivate_email

* Fix style

* Remove unused message

* Remove br tags

* Modify message and code about invite_mail

* Add missing message
2018-07-20 12:52:20 -04:00
Jesse Hallam
908a682fcf make GetChannelByName take teamId first (#9134)
* make GetChannelByName take teamId first

I think it is more natural to accept `teamId`, then `channelName`,
given the pattern followed by other Plugin API methods and even the SQL
Store itself. The App layer seems unusual in accepting `channelName`
first.

This also re-generates the mocks fixing the parameter order for the
recently added `UserStatus` APIs.

* add GetChannelByNameForTeamName
2018-07-20 09:03:08 -07:00
Jesús Espino
610ac5a53c MM-11003: Global Relay Export Refactor (#9136) 2018-07-20 17:13:35 +02:00
Jesús Espino
e97104a3c4 Using idiomatic error handling in channel store (#9130) 2018-07-20 12:39:48 +02:00
Jesús Espino
edb4443dfb Renamed translation in actiance export (#9132) 2018-07-20 12:25:24 +02:00
Pradeep Murugesan
ee1d037ca6 Support attachments in post and replies - Bulk import (#9124)
* 9006 - process the attachments of the post

* 9006 enabling the import of attachments in the reply post

* 9006 assert if the post and files are linked

* 9006 fixed the typo
2018-07-20 16:49:49 +08:00
Jesús Espino
17c0817361 Add missed plugin error translation (#9131) 2018-07-19 10:46:53 -07:00
Joram Wilander
9aab19d462 Temporarily comment out until MM-11108 to fix builds (#9133) 2018-07-19 09:58:58 -04:00
Harrison Healey
768f2b85bc MM-11389 Added diagnostics for FileSettings.Directory (#9125) 2018-07-19 11:01:39 +02:00
Adrian
a575411f15 Fix invalid markdown text ranges (#9126)
second Range value is the end pos, not the length... 🙈
2018-07-18 19:55:50 -07:00
Christopher Speller
5a2d46c6cb MM-11028 Adding some plugin tests. (#9103)
* Rearranging plugin mocks and moving some common test code out.

* Adding tests.

* Fixing tests after GoDoc cleanup changes.
2018-07-18 16:35:12 -07:00