summaryrefslogtreecommitdiffstats
path: root/app/post.go
Commit message (Collapse)AuthorAgeFilesLines
* MM-9072/MM-10185 Force-convert the encoding of OpenGraph metadata to UTF-8 ↵Hyeseong Kim2018-04-301-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#8631) * Force-convert non-UTF8 HTML to UTF8 before opengraph processing * Split the force-encoding function * Add benchmark Test for the forceHTMLEncodingToUTF8() ``` Running tool: /home/comet/go-v1.9.2/bin/go test -benchmem -run=^$ github.com/mattermost/mattermost-server/app -bench ^BenchmarkForceHTMLEncodingToUTF8$ [03:32:58 KST 2018/04/21] [INFO] (github.com/mattermost/mattermost-server/app.TestMain:28) -test.run used, not creating temporary containers goos: linux goarch: amd64 pkg: github.com/mattermost/mattermost-server/app BenchmarkForceHTMLEncodingToUTF8/with_converting-4 100000 11201 ns/op 18704 B/op 32 allocs/op BenchmarkForceHTMLEncodingToUTF8/without_converting-4 300000 3931 ns/op 4632 B/op 13 allocs/op PASS ok github.com/mattermost/mattermost-server/app 2.703s Success: Benchmarks passed. ``` * Remove an unnecessary constraint * Add pre-check if content-type header is already utf-8 * Move the checking for utf-8 into forceHTMLEncodingToUTF8() for testing * Revert df3f347213faa0d023c26d201fa6531f46391086..HEAD, without Gopkg.lock
* Structured logging (#8673)Christopher Speller2018-04-271-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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/master' into advanced-permissions-phase-1Martin Kraft2018-03-271-0/+11
|\
| * Relax 4k post message limit (#8478)Jesse Hallam2018-03-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-14/+4
|\|
| * remove `go Publish(...)` idiom (#8373)Chris2018-03-021-14/+4
| |
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-02-191-24/+50
|\|
| * Merge branch 'release-4.7' into rm-willnorris-proxy-supportChris2018-02-121-4/+50
| |\
| | * Merge branch 'release-4.7' into icu669Derrick Anderson2018-02-121-5/+5
| | |\
| | * | ICU-669 Handle relative links betterHarrison Healey2018-02-091-9/+4
| | | |
| | * | ICU-669 Ensured all URLs returned from OpenGraph are absoluteHarrison Healey2018-02-081-4/+55
| | | |
| * | | remove willnorris/imageproxy supportChristopher Brown2018-02-121-20/+0
| | |/ | |/|
* | | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-02-131-5/+5
|\| |
| * | minor addition to #8238Christopher Brown2018-02-091-5/+1
| | |
| * | Don't proxy same-site image urls (#8238)Chris2018-02-091-2/+6
| |/ | | | | | | | | | | * don't proxy same-site urls * fix empty site url case
* | AllowEditPost and PostEditTimeLimit migration (#8208)Jesús Espino2018-02-091-8/+1
| | | | | | | | | | | | | | | | * AllowEditPost and PostEditTimeLimit migration * Not set EDIT_POST permission to sysadmin_role if ALLOW_EDIT_POST is configured to NEVER * Remove a bit of code duplication
* | Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1Jesús Espino2018-02-071-4/+4
|\|
| * add App.License, remove utils.IsLicensed / utils.License calls (#8203)Chris2018-02-061-4/+4
| |
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-02-061-1/+1
|\|
| * fix image url replacement for blank urls (#8184)Chris2018-02-011-1/+1
| |
* | XYZ-37: Advanced Permissions Phase 1 Backend. (#8159)George Goldberg2018-02-061-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* PLT-3383: image proxy support (#7991)Chris2018-01-221-3/+129
| | | | | | | | | | | | * image proxy support * go vet fix, remove mistakenly added coverage file * fix test compile error * add validation to config settings and documentation to model functions * add message_source field to post
* fix post editing when channel links are present (#7938)Chris2017-12-051-1/+1
|
* PLT-5458: If someone posts a channel link to channel_A that you don't belong ↵Chris2017-11-281-0/+48
| | | | | | | | | | | | to, it doesn't render properly (#7833) * add channel link hints to post props * optimization * update regex, add unit test * fix rebase issue
* HTTP client refactor (#7884)Chris2017-11-221-3/+3
| | | | | | * http client refactor * simplification
* Role refactor (#7867)Chris2017-11-211-1/+1
| | | | | | | | * role refactor * add missing file * fix web test
* fix interactive message post username/icon behavior (#7776)Chris2017-11-041-1/+17
|
* PLT-7822: Fix search order for SQL search backend. (#7704)George Goldberg2017-10-241-0/+2
|
* [PLT-7362] Option to add user to channel if mentioned user is not currently ↵Saturnino Abril2017-10-211-0/+4
| | | | | | | | | | | | | | | | in the channel (#7619) * Option to add user to channel if mentioned user is not currently in the channel * instead of link from server, just add component on client side to add channel member * change implementation using post.props * do clean up and add test * sanitize post.props['add_channel_member'] on post creation * move sanitize to app.CreatePost and also apply to app.UpdatePost
* Reduce utils.Cfg references (#7650)Chris2017-10-181-10/+10
| | | | | | | | | | | | * app.UpdateConfig method * test fix * another test fix * the config override option as-was is just error prone, remove it for now * derp
* Merge branch 'release-4.3'Christopher Brown2017-10-161-6/+13
|\
| * PLT-7818 Updates to post type (#7579)Joram Wilander2017-10-091-0/+5
| | | | | | | | | | | | * Updates to post type * Update tests
| * PLT-7826: Don't fetch posts from store if ES returns none. (#7596)George Goldberg2017-10-091-6/+8
| |
* | Add back consumeAndClose functionality. (#7608)Christopher Speller2017-10-121-2/+2
| | | | | | | | | | | | | | * consume bodies for action button integrations, webrtc gateway, oauth endpoint * Fixing a couple more places, switching to io.Copy to ioutil.Discard, adding a comment to help prevent future performance regressions
* | Remove duplicate post edit WS event and cache invalidation (#7576)Joram Wilander2017-10-091-3/+0
| |
* | Miscellaneous app cleanup (#7594)Chris2017-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * app cleanup * whoops, forgot a file * some minor cleanup * longer container deadline * defensive checks
* | store/sqlstore cleanup and postgres tests (#7595)Chris2017-10-091-0/+4
|/ | | | | | | | | | * sqlstore cleanup / postgres tests * remove stopped containers * cmd/platform compile fix * remove test-postgres target from makefile
* Goroutine wranglin (#7556)Chris2017-10-031-12/+28
| | | | | | * goroutine wranglin * synchronize WebConn.WritePump
* remove remaining Global() calls (outside of tests) (#7521)Chris2017-09-281-10/+10
|
* Finally do away with NewLocAppError function. (#7498)George Goldberg2017-09-251-1/+1
| | | | | This cleans up the few NewLocAppError calls that crept in since the main bulk of them were removed, and finally removes the NewLocAppError function altogether.
* remove einterface gets (#7455)Chris2017-09-191-10/+9
|
* Renaming repoChristopher Speller2017-09-061-4/+4
|
* app type transition (#7167)Chris2017-09-061-82/+82
|
* App: NewLocAppError -> NewAppError (#7327)George Goldberg2017-09-011-8/+6
| | | | | | * App: NewLocAppError -> NewAppError * Remove statuscode that got missed.
* Config to make town square read only (#7140)David Meza2017-09-011-11/+40
| | | | | | | | | | | | | | | | | | | | | | * Be able to make Town Square read-only (Disable typing messages for non admins). * Do not emit UserTypingEvent when TownSquareIsReadOnly and is Town Square. * Add unit tests for TownSquareIsReadOnly config value and logic. * Add TownSquareIsReadOnly to System console>Policy. Added Telemetry. * Add control for TownSquareIsReadOnly=true only for License Enterprise Edition E10 & E20. * Update en.json * Update en.json * Update policy_settings.jsx * Change config value from TownSquareIsReadOnly to ExperimentalTownSquareIsReadOnly. * Refactored to simplify. Avoid code repeat and multiple db calls.
* PLT-6403: Interactive messages (#7274)Chris2017-08-291-1/+66
| | | | | | | | | | * wip * finish first pass * requested changes * add DoPostAction to Client4
* PLT-5745 Cleaning up duplicate calls (#7298)Corey Hulen2017-08-281-19/+25
| | | | | | | | * PLT-5745 Cleaning up duplicate calls * Fixing missing calls * Fixing broken test
* PLT-6226 Fixing races with licensing (#7213)Corey Hulen2017-08-161-3/+3
| | | | | | | | | | * PLT-6226 Fixing races with licensing * Fixing build issue * Fixing licensing issue * removing commented code
* PLT-6358: Server HTTP client improvements (#6980)Chris2017-08-091-1/+1
| | | | | | | | | | | | | | | | * restrict untrusted, internal http connections by default * command test fix * more test fixes * change setting from toggle to whitelist * requested ui changes * add isdefault diagnostic * fix tests
* Revert " #4755 Combining consecutive user join/leave system messages to ↵Saturnino Abril2017-08-011-2/+2
| | | | | | | | | | | | single message and few other changes." (#7072) * Revert "PLT-6603: Don't return all posts on invalid query. (#7061)" This reverts commit 25a2013890c7e07b4621fa9b18342e7f35363049. * Revert " #4755 Combining consecutive user join/leave system messages to single message and few other changes. (#5945)" This reverts commit 8a91235fb3cdc8d094dbc2eaa0d7baa447132b3c.