summaryrefslogtreecommitdiffstats
path: root/app/post.go
Commit message (Collapse)AuthorAgeFilesLines
* GH-9688: Migrate to idiomatic error handling in app/post.go (#9697)Hanzei2018-10-191-243/+222
| | | | | | * Migrate to idiomatic error handling in app/post.go * Revert import changes
* Set a proper HTTP user-agent header (#9482)Andreas Linz2018-10-031-2/+4
| | | | | | | | | | | | | Previously, mattermost-server would always request with the default user-agent of Go's net/http package that is `Go-http-client/1.1` or something similar. This has several disadvantages, one is that the default user-agent made it pretty hard to distinguish mattermost requests from other service requests in a network log for example. Now a user-agent of the form `mattermost-<current-version>` is set in the client. - [x] Added or updated unit tests (required for all new features)
* Fixing non elastic search paging. (#9471)Christopher Speller2018-09-271-0/+5
|
* MM-11567: Autocomplete search in: for DMs and GMs (#9430)Jesús Espino2018-09-271-3/+51
| | | | | | | | | | * MM-11567: Autocomplete search in: for DMs and GMs * Adding unit tests * Allowing to search Direct Messages in the autocompletion * Fix it in TE
* MM-7188: Cleaning push notification on every read, not only on channel ↵Jesús Espino2018-09-261-9/+3
| | | | | | | | | | | | switch (#9348) * MM-7188: Cleaning push notification on every read, not only on channel switch * Removed unnecesary goroutine * Fixing tests * Applying suggestion from PR
* Adding paging to elasticsearch API. (#9425)Christopher Speller2018-09-261-2/+2
|
* Add ChannelId and TeamId to PostActionIntegrationRequest (#9384)Hanzei2018-09-191-4/+14
| | | | | | * Add ChannelId and TeamId to PostActionIntegrationRequest * Add tests
* [MM-11860]: Expose slack attachment parsing functions in the model package ↵Charles Birk2018-09-171-26/+1
| | | | | | (#9351) Refactored parseSlackAttachment functions from https://github.com/mattermost/mattermost-server/blob/master/app/post.go#L312 into model/slack_attachments.go so that plugins have access to them.
* Merge release-5.3Carlos Tadeu Panato Junior2018-09-101-2/+4
|\
| * Speed up search results post selection. (#9380)Christopher Speller2018-09-101-2/+4
| |
* | MM-11855 Add App.HTTPService to allow mocking of HTTP client (#9359)Harrison Healey2018-09-071-3/+3
|/ | | | | | * MM-11855 Add App.HTTPService to allow mocking of HTTP client * Initialize HTTPService earlier
* MM-11693 Allow connections to /plugins for interactive message buttons. (#9333)Christopher Speller2018-09-021-1/+14
| | | | | | | | * Allow connetions to /plugins for interactive message buttons. * Adding siteurl to exclusions for AllowedUntrustedInternalConnections * Adding subpath support for allowing interactive message buttons plugin connections.
* Feature/search after before on (#9219)Dmitry Samuylov2018-08-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * initial implementation of after, before, on search flags allowing to restrict the search to a specific day or a date range * missed setting beforeDate in SearchParams in one place * fixed condition when only flags are used for search without any plain terms * changed date format used for after/before/on flags to be in ISO8601 format as suggested in PR comments, added a helper function to pad month and day with zeroes allowing the user user either format, with or without leading zeroes * corrected expected compare to date setting for the TestParseDateFilterToTimeISO8601 test * fixed a bug for the scenario when you only have the date flags without any terms, added a couple of tests for that scenario * updated the date filter logic to use parameters to construct the query instead of simply appending strings together, as suggested in the pull request comments * added search unit test using date flags * added a helper function to create a test post with a createat date manually set, updated the test for search using date flags to create test posts with different createat dates to be able to better test the functionality * MM-11817 Add support for after/before/on search flags with Elasticsearch * add support to search posts to perform the search in context of the client's timezone when filtering by createat date using on: after: before: flags * updated tests to match the new signature
* Support for interactive menus in message attachments (#9285)Joram Wilander2018-08-241-1/+7
|
* Merge release-5.2Carlos Tadeu Panato Junior2018-08-241-1/+1
|\
| * MM-11782: Make archived channels experimental and off-by-default. (#9281)George Goldberg2018-08-221-1/+1
| | | | | | | | | | | | * MM-11782: Make archived channels experimental and off-by-default. * Fix test.
* | Add PostId to PostActionIntegrationRequest (#9270)Hanzei2018-08-181-0/+1
|/
* MM-11575: change plugin nil semantics (#9212)Jesse Hallam2018-08-031-5/+13
| | | | | | | | * change MessageWillBePosted nil return semantics * change FileWillBeUploaded nil return semantics * use LogDebug to verify plugin inputs vs. the confusing Delete(User|Team)
* Pr 9039 (#9187)Martin Kraft2018-07-301-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Merge branch 'master' into plugins-2JoramWilander2018-07-071-0/+5
|\
| * MM-10603: Ignore Redirects and Other Changes when Displaying Link Previews ↵Declan Freeman-Gleason2018-07-051-0/+5
| | | | | | | | | | | | | | | | (#9025) * Don't use redirected URL in link preview. * Only show preview if OG data is provided.
* | MM-10703 Adding blank request context to plugin hooks for future use. (#9043)Christopher Speller2018-07-061-4/+8
| | | | | | | | | | | | | | | | | | | | * Adding blank request context to plugin hooks for future use. * Rename RequestContext to Context * Adding context to ServeHTTP and ExecuteCommand * Fixing import cycle in test.
* | MM-10702 Moving plugins to use hashicorp go-plugin. (#8978)Christopher Speller2018-06-251-9/+22
|/ | | | | | * Moving plugins to use hashicorp go-plugin. * Tweaks from feedback.
* MM-6992 Added highlighting to elasticsearch results (#8861)Harrison Healey2018-06-191-5/+5
| | | | | | | | * MM-6992 Added highlighting to elasticsearch results * Added a unique type for post search matches * Fixed Elasticsearch matches not being sent through API
* MM-10412: Adds deleteBy prop to posts. (#8896)Martin Kraft2018-06-011-2/+2
|
* MM-10249 Adding plugin ability to intercept posts before they reach the DB. ↵Christopher Speller2018-05-151-0/+28
| | | | | | | | (#8791) * Adding plugin ability to intercept posts before they reach the DB. * s/envoked/invoked/
* 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