summaryrefslogtreecommitdiffstats
path: root/app/app.go
Commit message (Collapse)AuthorAgeFilesLines
* MM-12342: merge the experimental channel store (#9681)HEADmasterJesse Hallam2018-10-251-8/+0
| | | | | | * MM-12342: merge the experimental channel store * gofmt after upgrading to go 1.11
* MM-12080: Added some extra logging to cluster leader changed. (#9475)George Goldberg2018-09-271-0/+1
| | | | | Purpose of this is to make in-field debugging of cluster leader issues (particularly around duplicate job scheduling) easier to debug from production server logs.
* #MM-12130 changes for custom service terms (#9450)Harshil Sharma2018-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * #MM-12130 changes for custom service terms * Fixed styling * Added getServiceTerms API * removed unnecessary panic * removed custom service terms text from flat config * reverted user sql store as those changes are no longer needed * added tests * Updated a config key to be more standard * Added copyright info * Loading service terms only if the feature is enabled * Loading service terms only if the feature is enabled * removed unused index * added createservice termns API * made a param to bool instead of string * added createservice termns API * review fixes * fixed styling * Minor refactoring * removed saveConfig and loadConfig magic * added empty service terms text check to createServiceTerms API * refactoed some urls to be terms_of_service instead of service_terms * removed check for support settings * changed URLs in tests * removed unused code * fixed a bug * added service termd id in conif * fixed a test * review fixes * minor fixes * Fixed TestCreateServiceTerms
* Move HTTPService and ConfigService into services package (#9422)Harrison Healey2018-09-261-2/+3
| | | | | | | | * Move HTTPService and ConfigService into utils package * Re-add StaticConfigService * Move config and http services into their own packages
* MM-7188: Cleaning push notification on every read, not only on channel ↵Jesús Espino2018-09-261-0/+6
| | | | | | | | | | | | switch (#9348) * MM-7188: Cleaning push notification on every read, not only on channel switch * Removed unnecesary goroutine * Fixing tests * Applying suggestion from PR
* MM-11886: materialize channel search (#9349)Jesse Hallam2018-09-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | * materialize PublicChannels table Introduce triggers for each supported database that automatically maintain a subset of the Channels table corresponding to only public channels. This improves corresponding queries that no longer need to filter out 99% DM channels. This initial commit modifies the channel store directly for easier code reviewing, but the next wraps an experimental version around it to enable a kill switch in case there are unforeseen performance regressions. This addresses [MM-11886](https://mattermost.atlassian.net/browse/MM-11886) and [MM-11945](https://mattermost.atlassian.net/browse/MM-11945). * extract the experimental public channels materialization Wrap the original channel store with an experimental version that leverages the materialized public channels, but can be disabled to fallback to the original implementation. This addresses MM-11947. * s/ExperimentalPublicChannelsMaterialization/EnablePublicChannelsMaterialization/ * simplify error handling * move experimental config listener until after store is initialized
* MM-11855 Add App.HTTPService to allow mocking of HTTP client (#9359)Harrison Healey2018-09-071-39/+7
| | | | | | * MM-11855 Add App.HTTPService to allow mocking of HTTP client * Initialize HTTPService earlier
* add megacheck as makefile target (#9288)Daniel Schalla2018-09-031-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Fix code issues in channel_test.go Fix Channel Test Issues detected by Megacheck Fix API Emoji Test Issues detected by Megacheck Fixed API Issues Reported by Megacheck Fixed App issues reported by megacheck Remaining fixes removed test added by mistake from old HEAD gofmt Store Fixes simplified returns Fix test for multi member channel delete revert to delete unused function
* MM-11384: Add system install date information to the client config (#9218)Jesús Espino2018-08-081-0/+18
| | | | | | | | * MM-11384: Add system install date information to the client config * Fixing translation text * Fixes from Peer Review
* MM-10502: Only cluster master should run job schedulers. (#9174)George Goldberg2018-07-311-12/+21
| | | | | | | | * MM-10502: Only cluster master should run job schedulers. * Use sync.Map for thread safety. * Fix tests.
* MM-11243: Make Elasticsearch work after enabling without restart. (#9146)George Goldberg2018-07-261-0/+51
| | | | | | * MM-11243: Make Elasticsearch work after enabling without restart. * Also cope with config vars changing whilst enabled.
* Merge branch 'plugins-2'JoramWilander2018-07-101-7/+3
|\
| * Merge branch 'master' into plugins-2JoramWilander2018-07-071-1/+3
| |\
| * \ Merge branch 'master' into plugins-2JoramWilander2018-06-271-0/+3
| |\ \
| * | | MM-10702 Moving plugins to use hashicorp go-plugin. (#8978)Christopher Speller2018-06-251-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | * Moving plugins to use hashicorp go-plugin. * Tweaks from feedback.
* | | | MM-11120 Adding setting to disable email invitations and rate limiting. (#9063)Christopher Speller2018-07-101-1/+7
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | * Adding setting to disable email invitations. * Adding a setting and rate limiting for email invite sending. * Modifying email rate limit to 20/user/hour * Adding EnableEmailInvitations to client side config and command.
* | | Make sure diagnostic ID is loaded before client config. (#9032)George Goldberg2018-07-031-1/+3
| |/ |/|
* | MM-10269: Make jobserver work without restart. (#9005)George Goldberg2018-06-261-0/+3
|/
* MM-10370: serve subpath (#8968)Jesse Hallam2018-06-211-3/+19
| | | | | | | | | | | | | | | | | | | | | | | * factor out GetSubpathFromConfig * mv web/subpath.go to utils/subpath.go * serve up web, api and ws on /subpath if configured * pass config to utils.RenderWeb(App)?Error This allows the methods to extract the configured subpath and redirect to the appropriate `/subpath/error` handler. * ensure GetSubpathFromConfig returns trailing slashes deterministically * fix error 404 handling * redirect /subpath to /subpath/ This is necessary for the static handler to match, otherwise none of the registered routes find anything. This also makes it no longer necessary to add trailing slashes in the root router.
* MM-8701 Limit the number of client config fields sent before user logs in ↵Harrison Healey2018-06-181-3/+4
| | | | | | | | | | (#8954) * MM-8701 Limit the number of client config fields sent before user logs in * Fixed missing client config field * Reduced duplication between limited and regular client config
* [MM-10718] Move custom branding to TE (#8871)Saturnino Abril2018-06-021-10/+0
| | | | | * move custom branding to TE * move brand's enterprise code to server and remove BrandInterface
* MM-8853: Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS permissions (#8860)Jesús Espino2018-05-291-10/+73
| | | | | | | | | | | | | | | | * MM-8853: Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS permissions * MM-8853: Removing unnecesary emoji enterprise feature * Create emojis migration * Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS always to system admins * Simplifing permissions checks * Revert "Simplifing permissions checks" This reverts commit e2cafc1905fc9e20125dd9a1552d2d0c7340ae59.
* Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2Martin Kraft2018-05-241-2/+4
|\
| * MM-8622: Improved plugin error reporting (#8737)Jesse Hallam2018-05-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * allow `Wait()`ing on the supervisor In the event the plugin supervisor shuts down a plugin for crashing too many times, the new `Wait()` interface allows the `ActivatePlugin` to accept a callback function to trigger when `supervisor.Wait()` returns. If the supervisor shuts down normally, this callback is invoked with a nil error, otherwise any error reported by the supervisor is passed along. * improve plugin activation/deactivation logic Avoid triggering activation of previously failed-to-start plugins just becase something in the configuration changed. Now, intelligently compare the global enable bit as well as the each individual plugin's enabled bit. * expose store to manipulate PluginStatuses * expose API to fetch plugin statuses * keep track of whether or not plugin sandboxing is supported * transition plugin statuses * restore error on plugin activation if already active * don't initialize test plugins until successfully loaded * emit websocket events when plugin statuses change * skip pruning if already initialized * MM-8622: maintain plugin statuses in memory Switch away from persisting plugin statuses to the database, and maintain in memory instead. This will be followed by a cluster interface to query the in-memory status of plugin statuses from all cluster nodes. At the same time, rename `cluster_discovery_id` on the `PluginStatus` model object to `cluster_id`. * MM-8622: aggregate plugin statuses across cluster * fetch cluster plugin statuses when emitting websocket notification * address unit test fixes after rebasing * relax (poor) racey unit test re: supervisor.Wait() * make store-mocks
* | Refactors migrations check. (#8814)Martin Kraft2018-05-211-0/+13
| |
* | MM-9728: Online migration for advanced permissions phase 2 (#8744)George Goldberg2018-05-141-0/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | * MM-9728: Online migration for advanced permissions phase 2 * Add unit tests for new store functions. * Move migration specific code to own file. * Add migration state function test. * Style fixes. * Add i18n strings. * Fix mocks. * Add TestMain to migrations package tests. * Fix typo. * Fix review comments. * Fix up the "Check if migration is done" check to actually work.
* MM-10424: Migrate PostEditTimeLimit config setting. (#8702)George Goldberg2018-05-021-0/+8
|
* Structured logging (#8673)Christopher Speller2018-04-271-19/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implementing structured logging * Changes to en.json to allow refactor to run. * Fixing global logger * Structured logger initalization. * Add caller. * Do some log redirection. * Auto refactor * Cleaning up l4g reference and removing dependancy. * Removing junk. * Copyright headers. * Fixing tests * Revert "Changes to en.json to allow refactor to run." This reverts commit fd8249e99bcad0231e6ea65cd77c32aae9a54026. * Fixing some auto refactor strangeness and typo. * Making keys more human readable.
* Merge remote-tracking branch 'origin/release-4.9' into merge49finalDerrick Anderson2018-04-171-0/+7
|\
| * Prevent disabling or modifying l4g logging filters (#8628)Jesse Hallam2018-04-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The underlying l4g library is not resilient to filter modifications in the presence of concurrent goroutines. In particular, it's not safe to call Close() on filters which might be actively held by a goroutine for logging. This change disables all modifications to existing filters once initialized by the App layer. In practice, we might be able to get away with some modifications to the existing filters (i.e. changing levels), but the [golang memory model](https://golang.org/ref/mem) makes no guarantees that it is safe to do so: > Programs that modify data being simultaneously accessed by multiple goroutines must serialize such access. We can solve this holistically by introducing the requisite locking within our fork of the l4g library. For now, we just disable all modifications.
* | MM-9849 Added tracking of which settings are set through environment ↵Harrison Healey2018-04-091-0/+1
|/ | | | | | | | | | | | | | | | variables (#8586) * MM-9849 Added tracking of which settings are set through environment variables * Removed old version of viper * Added forked version of viper * Fixed unit tests * Fixed more unit tests * Removed copy from App.GetEnvironmentConfig
* Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1Martin Kraft2018-03-271-1/+1
|\
| * Relax 4k post message limit (#8478)Jesse Hallam2018-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * MM-9661: rename POST_MESSAGE_MAX_RUNES to \0_v1 * MM-9661: s/4000/POST_MESSAGE_MAX_RUNES_V1/ in tests * MM-9661: introduce POST_MESSAGE_MAX_RUNES_V2 * MM-9661: migrate Postgres Posts.Message column to TEXT from VARCHAR(4000) This is safe to do in a production instance since the underyling type is not changing. We explicitly don't do this automatically for MySQL, but also don't need to since the ORM would have already created a TEXT column for MySQL in that case. * MM-9661: emit MaxPostSize in client config This value remains unconfigurable at this time, but exposes the current limit to the client. The limit remains at 4k in this commit. * MM-9661: introduce and use SqlPostStore.GetMaxPostSize Enforce a byte limitation in the database, and use 1/4 of that value as the rune count limitation (assuming a worst case UTF-8 representation). * move maxPostSizeCached, lastPostsCache and lastPostTimeCache out of the global context and onto the SqlPostStore * address feedback from code review: * ensure sqlstore unit tests are actually being run * move global caches into SqlPostStore * leverage sync.Once to address a race condition * modify upgrade semantics to match new db semantics gorp's behaviour on creating columns with a maximum length on Postgres differs from MySQL: * Postgres * gorp uses TEXT for string columns without a maximum length * gorp uses VARCHAR(N) for string columns with a maximum length of N * MySQL * gorp uses TEXT for string columns with a maximum length >= 256 * gorp uses VARCHAR(N) for string columns with a maximum length of N * gorp defaults to a maximum length of 255, implying VARCHAR(255) So the Message column has been TEXT on MySQL but VARCHAR(4000) on Postgres. With the new, longer limits of 65535, and without changes to gorp, the expected behaviour is TEXT on MySQL and VARCHAR(65535) on Postgres. This commit makes the upgrade semantics match the new database semantics. Ideally, we'd revisit the gorp behaviour at a later time. * allow TestMaxPostSize test cases to actually run in parallel * default maxPostSizeCached to POST_MESSAGE_MAX_RUNES_V1 in case the once initializer panics * fix casting error * MM-9661: skip the schema migration for Postgres It turns out resizing VARCHAR requires a rewrite in some versions of Postgres, but migrating VARCHAR to TEXT does not. Given the increasing complexity, let's defer the migration to the enduser instead.
* | Merge branch 'master' into advanced-permissions-phase-1Martin Kraft2018-03-231-1/+10
|\|
| * Timezone feature (#8185)Chris Duarte2018-03-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add supported timezones into config Remove Timezone list creation in favor of timezone from configs Add Timezone field to Users table Clean up format of SupportedTimezones in config * Remove unwanted change * Add test for updating user timezone * Add empty map[string]string if Timezone is null * Add EnableTimezoneSelection config * Revert back to map[string]string for ClientConfig * Refactor SupportedTimezones into timezones.json * Include timezones.json in TestConfigFlag * Add timezone api endpoint * Bump varchar size to 256 and setMaxSize in user_store * Refactor LoadConfig to LoadConfig and LoadTimezoneConfig * Remove unnecessary argument in LoadConfig, mail_test * Add test for timezone endpoint * Add license header * Refactor timezones endpoint to system.go * Add system base route to timezone endpoint * db timezone upgrade in db v4.9 * Avoid saving SupportedTimezones to config.json * Add timezonePath support in config * Remove EnableTimezoneSelection from config * Use return statement without return parameter * Refactor test for SupportedTimezones * Check for supportedTimezone != nil instead of using len * Decouple SupportedTimezones out of Config * Fix failing test * Add LastTeamIconUpdate back in upgrade.go * Write timezone config in config_flag_test * Add code fallback for default timezone support
| * Fix various segfaults when running `go test` manually (#8448)Jesse Hallam2018-03-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * failing to find i18n shouldn't segfault The server was trying to handle the fact that it couldn't find the i18n directory, by emitting a translated log message... * fix utils.FindDir The attempts to find the directory in the parent or grandparent directory don't work if the current working directory was inside `enterprise`, with `enterprise` itself being a symlink as per the usual developer setup. Recurse to the root of the filesystem, cleaning the path along the way to work around this limitation (and allow tests to be run from an arbitrarily deep nesting level.) Fix corresponding usages to employ filepath.Join. * failing to find html templates shouldn't segfault * fail fast if the test user cannot be created * rework utils.FindDir to retain backwards compatibility
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-03-131-1/+17
|\|
| * MM-8604: emit config/license websocket events (#8371)Jesse Hallam2018-03-051-1/+17
| |
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-03-021-0/+2
|\|
| * Remove global site url (#8343)Chris2018-02-221-0/+2
| | | | | | | | | | | | | | | | * remove global site url * missed one * revert mysterious change
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-02-131-17/+35
|\|
| * Add tests for the `platform server` command (#8231)Pierre de La Morinerie2018-02-121-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Cleanup app state on initialization error When returning an initialization error, the app state was not cleaned up. This is especially visible during tests, as `appCount` is not decremented, and makes the new app initialization fail. * Test the `platform server` command As the `platform server` command only exits when interrupted by a signal, it is not possible to test it as the other cobra commands. Instead we directly test the actual command function. The internal command handler is slighly refactored to take a channel in argument, and registers it as the signal handler. Nothing very different—except than controlling this channel from the outside allows the test to send the system signal itself, thus preventing the server to run forever.
| * Remove license globals entirely (#8229)Chris2018-02-091-11/+13
| | | | | | | | | | | | | | | | * remove license globals entirely * fix infinite recursion * test fix
| * Eliminate utils.SetLicense calls (#8217)Chris2018-02-071-0/+3
| | | | | | | | | | | | | | | | | | | | * eliminate utils.SetLicense calls * test fix * another test fix * more test fixes
| * ABC-132: sign error page parameters (#8197)Chris2018-02-071-8/+14
| | | | | | | | | | | | * sign error page parameters * add comments
* | XYZ-51: Unit tests for and changes to SetRolePermissionsFromConfig. (#8160)Martin Kraft2018-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * XYZ-10: Role store. * XYZ-37: Update unit tests to work with database roles. * XYZ-51: Tests 'SetRolePermissionsFromConfig' against JSON from policy page. * XYZ-51: Adds permissions in non-licensed cases also. * XYZ-51: Removes some permissions from team_user role. * XYZ-51: Merge fix for change to default permissions from PR 8208. * XYZ-51: Removes unused function.
* | XYZ-37: Advanced Permissions Phase 1 Backend. (#8159)George Goldberg2018-02-061-3/+57
|/ | | | | | | | | | | | | | | | | | | | | | | | | | * XYZ-13: Update Permission and Role structs to new design. * XYZ-10: Role store. * XYZ-9/XYZ-44: Roles API endpoints and WebSocket message. * XYZ-8: Switch server permissions checks to store backed roles. * XYZ-58: Proper validation of roles where required. * XYZ-11/XYZ-55: Migration to store backed roles from policy config. * XYZ-37: Update unit tests to work with database roles. * XYZ-56: Remove the "guest" role. * Changes to SetDefaultRolesFromConfig. * Short-circuit the store if nothing has changed. * Address first round of review comments. * Address second round of review comments.
* Remove global cfg vars (#8099)Chris2018-01-121-12/+18
| | | | | | * remove global cfg vars * enterprise update
* Remove global config watcher (#8080)Chris2018-01-111-48/+14
| | | | | | | | | | * remove global config watcher * keep config watcher disabled for tests * compile fix * fix resource leak
* [PLT-6936] Translate AppError.Message automatically by default (#8063)Jesús Espino2018-01-081-1/+1
|