summaryrefslogtreecommitdiffstats
path: root/store/store.go
Commit message (Collapse)AuthorAgeFilesLines
* MM-12342: merge the experimental channel store (#9681)HEADmasterJesse Hallam2018-10-251-4/+0
| | | | | | * MM-12342: merge the experimental channel store * gofmt after upgrading to go 1.11
* MM-12234: configurable limit to user autocomplete and search matches (#9499)Jesse Hallam2018-10-171-5/+5
| | | | | | | | | | * unit test cleanup * allow limiting user search results * clean up test users before starting * model UserSearchOptions to simplify parameters
* [APIv4] add getChannelMembersTimezone (#9286)Carlos Tadeu Panato Junior2018-10-131-0/+1
| | | | | | | | * add getChannelMembersTimezone * update per feedback review * add delimeter to error
* DeleteAll for KV (#9431)Daniel Schalla2018-10-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expire K/V Values Regenerate Code pathfix Update Expiry on Update Check for Exit Signal gofmt Rewrote Go Routine Remove tempoarily cleanup loop fix expiretime TEST: Expired Watchdog as GoRoutine Check if Srv is nil Use Scheduler/Worker for Expired Key CleanUp add license fix scheduler job type; DoJob Restructuring Remove unused imports and constants move db migration from 5.4 to 5.5
* Refactored to rename "service terms" to "terms of service" (#9581)Harshil Sharma2018-10-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * #124 renamed identififers from service terms to terms of service * #124 renamed identififers from service terms to terms of service * 124 renamed ServiceTerms model to TermsOfService * 124 Renamed EnableCustomServiceTerms feature flag to EnableCustomTermsOfService * 124 Renamed EnableCustomServiceTerms feature flag to EnableCustomTermsOfService * #124 fixed formatting * #124 fixed formatting * #132 renamed table ServiceTerms to TermsOfService * #124 renamed some missed files from 'service_terms' to 'terms_of_service' * #124 removed fixed TODOs * drop migrate of ServiceTerms table, since backporting * s/ServiceTerms/TermsOfService/ in tests * s/AcceptedServiceTermsId/AcceptedTermsOfServiceId/ Change the model attribute, even though the column name will eventually be removed. * s/accepted_service_terms_id/accepted_terms_of_service_id/ to match redux * s/serviceTerms/termsOfService * rename column too, and add max size constraint * s/EnableCustomServiceTerms/EnableCustomTermsOfService
* MM-12251: Add flag to MoveChannel to remove all deactivated users. (#9515)George Goldberg2018-10-081-0/+1
|
* MM-11863 Add KVList method (#9467)Shobhit Gupta2018-10-031-0/+1
| | | | | | | | | | | | | | * Add KVList method * Add KVList method Add KVList method * Add pagination support * Change offset, limit to page, perPage * Rename constant
* MM-12067: Add SetDefaultProfileImage to reset the user profile image to a ↵Jesús Espino2018-10-021-0/+1
| | | | | | | | | | | | generated one (#9449) * MM-12067: Add SetDefaultProfileImage to reset the user profile image to a generated one * Allow to get the default profile image for my user * Allowing to reset the last update image date to 0 * PR reviews
* #MM-12130 changes for custom service terms (#9450)Harshil Sharma2018-09-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * #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
* MM-7188: Cleaning push notification on every read, not only on channel ↵Jesús Espino2018-09-261-0/+1
| | | | | | | | | | | | 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-11781: Basic Data Export Command Line. (#9296)George Goldberg2018-09-171-0/+7
| | | | | | | | | | | | | | | | * MM-11781: Basic Data Export Command Line. * ChannelStore new unit tests. * TeamStore new unit tests. * Unit test for new UserStore function. * Unit tests for post store new methods. * Review fixes. * Fix duplicate command name.
* MM-11886: materialize channel search (#9349)Jesse Hallam2018-09-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | * 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-11725: Add specific autocomplete endpoint for search autocomplete (#9337)Jesús Espino2018-09-111-0/+1
|
* MM-11572: Force correct order on messages generated in the bulk (#9244)Jesús Espino2018-08-241-0/+1
|
* MM-11348: Add telemetry for advanced permissions. (#9249)George Goldberg2018-08-231-0/+1
|
* MM-11384: Add system install date information to the client config (#9218)Jesús Espino2018-08-081-0/+1
| | | | | | | | * MM-11384: Add system install date information to the client config * Fixing translation text * Fixes from Peer Review
* Pr 9039 (#9187)Martin Kraft2018-07-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Lock bulk importing to master database node (#9012)Joram Wilander2018-06-271-0/+2
|
* Implementation of File Exists Function; Delete FileInfos upon Permanent User ↵Daniel Schalla2018-06-251-0/+2
| | | | | | | Delete (#8958) Check if file was deleted on FS Warning message if file couldnt be removed
* MM-10570: Make permissions reset command clear custom role assignments. (#8976)George Goldberg2018-06-251-0/+3
|
* MM-10233: Add scheme importing to bulk importer. (#8928)George Goldberg2018-06-211-0/+1
|
* MM-10412: Adds deleteBy prop to posts. (#8896)Martin Kraft2018-06-011-1/+1
|
* MM-10235: Make permissions reset CLI shcemes-aware. (#8773)George Goldberg2018-05-171-0/+3
| | | | | | * MM-10235: Make permissions reset CLI shcemes-aware. * Add i18n strings.
* MM-9728: Online migration for advanced permissions phase 2 (#8744)George Goldberg2018-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2Martin Kraft2018-05-111-1/+1
|\
| * MM-4998 Adding LoginIdAttribute to allow LDAP users to change their login ID ↵Christopher Speller2018-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | without losing their account (#8756) * Adding LoginIdAttribute * Modifying LDAP to use loginIDAttribute. * Adding IDAttribute migration and AD objectGUID support. * Removing unused idea. * Fix typo.
* | MM-10140: API Implementation for Schemes related Endpoints (#8615)George Goldberg2018-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement basic scheme CRUD endpoints. * Get All Schemes (Paged) Endpoint and store plumbing. * Add get teams/channels for schemes. * Fix unit tests. * Review fixes. * More review fixes.
* | Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2Martin Kraft2018-05-011-3/+1
|\|
| * Structured logging (#8673)Christopher Speller2018-04-271-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | MM-8796: Full implementation of "Schemes" in Store/Model/App layers. (#8357)George Goldberg2018-04-201-0/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Scheme model and stub store. * Port ChannelStore to be Scheme aware. * Make almost all the API/APP layer work with ChannelSchemes. Only thing still hacky is UpdateChannelMemberRoles(). * Add basic SchemeStore implementation. * Migrate UpdateChannelMemberRoles properly and fix tests. * Update store tests and mocks so they work. * Include creating default roles in Scheme create store function. * Implement role deletion and start scheme deletion. * Only use non-deleted roles for authorization. * Add GetByScheme method to Team store. * Add GetChannelsByScheme. * Update store mocks. * Implement scheme deletion in the store. * Rename is valid function. * Add offset and limit to queries to fetch teams and channels by scheme. * Fix queries. * Implement scheme awareness in Team store and add a migration. * Tidy up ChannelStore mapping functions and add exhaustive unit tests. * Add all missing i18n. * Proper tests for TeamStore internal functions and fix them. * Make additional TeamMember fields nullable. * Make new ChannelMember fields nullable. * Create new nullable columns without defaults. * Make new fields in large tables nullalble. * Fix empty list of TeamMembers. * Deduplicate SQL queries. * Fix spelling. * Fix review comment. * More review fixes. * More review fixes.
* MM-10121: CLI command to reset permissions system to default state. (#8637)George Goldberg2018-04-181-0/+2
| | | | | | * MM-10121: CLI command to reset permissions system to default state. * Review comment.
* Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1Martin Kraft2018-03-271-0/+1
|\
| * Relax 4k post message limit (#8478)Jesse Hallam2018-03-261-0/+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-1George Goldberg2018-03-131-1/+6
|\|
| * Remove query to update channel extra_update_at field on user ↵Joram Wilander2018-03-091-1/+0
| | | | | | | | activation/deactivation (#8415)
| * MM-9274- Sort Users in Channel by status (#8181)Stephen Kiers2018-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sort by lastActivity * added status ordering to Users * sort offline before dnd * remove data not needed * added seperate call for when order=‘status’ is on GetUser request * remove PrintLn * styling fix * remove mistake * mistake 2 * better comment * explicit if statemnt * writing tests * removed manually added mocks * generated mock * ICU-668 Added unit tests * style fix * sort by lastActivity * added status ordering to Users * sort offline before dnd * remove data not needed * added seperate call for when order=‘status’ is on GetUser request * remove PrintLn * styling fix * remove mistake * mistake 2 * better comment * explicit if statemnt * writing tests * removed manually added mocks * generated mock * ICU-668 Added unit tests * style fix * reverse dnd and offline * Fixed app.SaveStatusAndBroadcast * Fixed incorrect merge * Fixing incorrect merge again
| * MM-9664 Add invalidation metrics for store caches (#8340)Joram Wilander2018-03-051-0/+5
| | | | | | | | | | | | | | | | * Add invalidation metrics for store caches * Increment session invalidation metric * Fix tests
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-03-021-0/+1
|\|
| * PLT-7567: Integration of Team Icons (#8284)Christian Hoff2018-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | * PLT-7567: Integration of Team Icons * PLT-7567: Read replica workaround, upgrade logic moved, more concrete i18n key * PLT-7567: Read replica workaround, corrections * PLT-7567: upgrade correction
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-02-061-0/+1
|\|
| * ABC-79: Optimize channel autocomplete query (#8163)Chris2018-01-311-0/+1
| | | | | | | | | | | | * optimize channel autocomplete query * move to new autocomplete endpoint
* | XYZ-37: Advanced Permissions Phase 1 Backend. (#8159)George Goldberg2018-02-061-0/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* ABC-90 Add POST /emoji/search and GET /emoji/autocomplete API endpoints (#8125)Joram Wilander2018-01-231-0/+1
| | | | | | * Add POST /emoji/search and GET /emoji/autocomplete API endpoints * Add constant to be clearer
* Add sort query parameter to GET /emojis (#8121)Joram Wilander2018-01-191-1/+1
|
* ABC-73 Move session clean-up to daily task (#8095)Joram Wilander2018-01-171-0/+1
| | | | | | * Move session clean-up to daily task * Split delete query into batches
* [PLT-7793] Add /users/tokens/search endpoint (#8088)Adrian Carolli2018-01-111-0/+1
| | | | | | | | * Add /users/tokens/search endpoint + tests * Fix check-style * Unnecessary deletion
* [PLT-7793] Added /users/tokens endpoint (#8038)Adrian Carolli2018-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added /users/tokens/all endpoint - UserAccessStore now has getAll method - Added tests - Added route - Added handler * Remove space fix check-style * Remove blank space check-style * Fixes for make check-style * Remove extra code that is un-needed in user_test.go * Rename endpoint + grammar - Renamed /users/tokens/all to /users/tokens - Renamed getUserAccessTokens to getUserAccessTokensForUser - Renamed getAllUserAccessTokens to getUserAccessTokens - Minor Grammar changes * Add localization for sql_user_access_token.get_all * Fix minor plural spelling
* PLT-8233: Purge ChannelMemberHistory Data when Data Retention Job runs (#7937)Jonathan2017-12-051-1/+1
| | | | | | | | | | * Changed the channel member history purge function to match pattern established by other data retention purge methods * Simplifying the channel member history store and associated tests * Regenerating mocks * Using a constant
* PLT-7503: Create Message Export Scheduled Task and CLI Command (#7612)Jonathan2017-11-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Created message export scheduled task * Added CLI command to immediately kick off an export job * Added email addresses for users joining and leaving the channel to the export * Added support for both MySQL and PostgreSQL * Fixing gofmt error * Added a new ChannelMemberHistory store and associated tests * Updating the ChannelMemberHistory channel as users create/join/leave channels * Added user email to the message export object so it can be included in the actiance export xml * Don't fail to log a leave event if a corresponding join event wasn't logged * Adding copyright notices * Adding message export settings to daily diagnostics report * Added System Console integration for message export * Cleaned up TODOs * Made batch size configurable * Added export from timestamp to CLI command * Made ChannelMemberHistory table updates best effort * Added a context-based timeout option to the message export CLI * Minor PR updates/improvements * Removed unnecessary fields from MessageExport object to reduce query overhead * Removed JSON functions from the message export query in an effort to optimize performance * Changed the way that channel member history queries and purges work to better account for edge cases * Fixing a test I missed with the last refactor * Added file copy functionality to file backend, improved config validation, added default config values * Fixed file copy tests * More concise use of the testing libraries * Fixed context leak error * Changed default export path to correctly place an 'export' directory under the 'data' directory * Can't delete records from a read replica * Fixed copy file tests * Start job workers when license is applied, if configured to do so * Suggestions from the PR * Moar unit tests * Fixed test imports
* PLT-5458: If someone posts a channel link to channel_A that you don't belong ↵Chris2017-11-281-0/+1
| | | | | | | | | | | | to, it doesn't render properly (#7833) * add channel link hints to post props * optimization * update regex, add unit test * fix rebase issue