* MM-22706: pass along set_online flag in websocket response
To let the client know whether a user has created a post without
being online or not, we get the set_online query param and
pass it down to the websocket event being passed down to the client.
With this PR, the "data" field of the `posted` event will contain
a `set_online` boolean field set to true/false depending on the
query_param set_online value set in the createPost call.
* Setting to false for auto responder
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* Summary
Fixing inconsistencies of the app_error messages. Now all end with a
period and there is the same user experience all over the system.
We agreed on this change on the community server a while ago and I just
came around finally doing it.
Ticket Link
N/A
Checklist
Includes text changes and localization file (.../i18n/en.json and
.../webapp/i18n/en.json) updates
* Update i18n/en.json
Approving changes
Co-Authored-By: Jason Blais <13119842+jasonblais@users.noreply.github.com>
* Update i18n/en.json
Approving changes
Co-Authored-By: Jason Blais <13119842+jasonblais@users.noreply.github.com>
* Update i18n/en.json
Approving changes
Co-Authored-By: Jason Blais <13119842+jasonblais@users.noreply.github.com>
* Fix test failures due string differences
Co-authored-by: Jason Blais <13119842+jasonblais@users.noreply.github.com>
Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-22282 Add Ephemeral response when using mentions without permission and add new prop to disable mention highlights on client
* MM-22622 Make test name test actually what it does and fix comment style
* MM-22622 Check ephemeral post created when post create with mentions on API
* MM-22622 More tests for App>CreatePost
* MM-22622 Make DisableMentionHighlights more concise and rename ephemeral post
* MM-22622 Dont send ephemeral message for system message created by user
* Trigger build
* MM-21919 Add channel_mention permission
* MM-21919 Fix emojis migration test
* Enforce Channel Mentions on the in the posts api
* MM-21919 Rename permission to use_channel_mentions
Allow posts with channel mentions to still be posted without the permission just don't send notifications to users
* MM-21919 Add tests for a post with @all and @here
* MM-21919 Add use channel mentions to all roles that have create post
* MM-21919 Update app_test to include use_channel_mentions permission in default permissions
* MM-21356: Conditionally set user status online
Check for the set_online query param and do not set the status
if it is set to false.
* Fix some issues
* Add a test
* Log an error if an invalid value was passed
* Logging a warning instead of error
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* Make WebSocketEvent type immutable
* Update code to use updated immutable WebSocketEvent type
* Export WebSocketEvent fields and mark them as deprecated
* Consistent license message for all the go files
* Fixing the last set of unconsistencies with the license headers
* Addressing PR review comments
* Fixing busy.go and busy_test.go license header
* fix posts returned from unread API when the list contains parent post/s
* add ExtendAll to PostList and update test per feedback
* revert unintentional change to the other test and fix comment
* update the existing postlist.Extend, filter unique values and update unit tests
* [MM-11210] Add API GET 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/posts/unread' for scrolling overhaul (#9108)
* Add API GET 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/posts/unread'
* add constants
* refactor GetPostSince and added more tests
* move constants to app package
* [MM-11528 && MM-11583] Add userId to in the "posts/unread" path and update test with time delay to fix intermittent failure (#9229)
* add userId to in the "posts/unread" path and update test with time delay to fix intermittent failure
* add limit before and after to query
* remove time delay on test and put pretermined value of Post.CreateAt
* Fix conflict
* [MM-11876] Add cursor to posts list such as next_post_id and previous_post_id (#9707)
* add cursor to posts list such as next_post_id and previous_post_id
add publish previous_post_id on WEBSOCKET_EVENT_POSTED and only get next or previous post IDs if necessary
revert change on adding previous_post_id in WEBSOCKET_EVENT_POSTED
add missing strings import
fix merge conflicts
* update per comment
* update per feedback
* corrected the logic in getting the next and previous post ID
* fix logic to determine next and post IDs, and rename function to have suffix of "Time"
* rearrange logics and add mote tests
* fix merge conflict
* fix missing message when using unread API (#10233)
* MM-15569 Fixes failing test on TestGetPostsForChannelAroundLastUnread (#11039)
* Fix missing posts when getting posts since
* revert changes to GetPostsSince
* migrate Post.GetPostAfterTime and Post.GetPostBeforeTime to sync by default
* revert change to cacheItem
* Fix post ID validation, build query on squirrel and only return post ID as necessary
* MM-15276: Migrate Team.Update to sync by default
* MM-15276: Addressing review comments and change Update func signature similar to other interface Update method
* update store mocks for update fn
* addressing review comments
* Set EditAt for FileIds and Attachments; Disallow update/patch of FileIds in API Handler
* Add custom comparison methods for StringArray and Post Attachments
* gofmt
* Split up comparison function to child structs
* Naming consistency
* gofmt
* refactor utils/config* to config/
* pull validateLdapFilter into app
* clean up Config/GetConfig/GetSanitizedConfig usage
Eliminate app.GetConfig() in favour of just using app.Config() directly,
but expose app.GetSanitizedConfig() for when the old behaviour was
required.
* web: isolate config setup
* TestInvitePeopleProvider: make config explicit
* regenerateClientConfig: avoid racey map access
* integrate watch flag into app.ConfigFile option
* make app.Option return an error
* release.mk: only cp static files from config/
* release.mk: fix cp static files from config/
* api4: TestPlugin cleanup
* s/c/cfg/ for clarity
* fix merge conflict
* testlib: allow customization of testlib driver name
* MM 10658 Change config fields to pointers (#8898)
* Change fields of config structs to pointers and set defaults
MM-10658 https://github.com/mattermost/mattermost-server/issues/8841
* Fix tests that go broken during switching config structs to pointers
MM-10658 https://github.com/mattermost/mattermost-server/issues/8841
* Apply changes of current master while switching config structs to pointers
MM-10658 https://github.com/mattermost/mattermost-server/issues/8841
* Fix new config pointer uses
* Fix app tests
* Fix mail test
* remove debugging statement
* fix TestUpdateConfig
* assign config consistently
* initialize AmazonS3Region in TestS3TestConnection
* initialize fields for TestEmailTest
* fix TestCheckMandatoryS3Fields
* refactor GetDirectChannel and CreateDirectChannel in one function
* remove CreateDirectChannel plugin api and update GetDirectChannel and GetGroupChannel plugin api
* update tests
* api4: fix TestGetUsersNotInTeam assertions
This test was relying on data from a previous test run. With the data cleared before each test, the assertions much match reality.
* *testlib: always InitSystemAdmin
Some tests implicitly relied on the basic user having system
administrator privileges because it was the first user created as such.
Eliminate `InitSystemAdmin` and explicitly create the system admin user
instead to avoid this ambiguity going forward.
* *testlib: drop all tables before each test
* api4: split up TestChannelDelete to avoid duplicate InitBasic
* api4: teardown in TestResetPassword, for when this test comes back
* invalidate cache on DropAllTables
This is necessary since the test store persists across tests.
* disable parallel tests
While tests within a package must be explicitly parallelized using `t.Parallel()`, tests across packages are run in parallel by default. This causes problems given that the tests all currently share the same database instance.
Unfortunately, this also means that running the tests is much slower, but we can return to this later.
* MM-11707: Removes edit_others_posts permission from the team_admin role in MakeDefaultRoles().
* MM-11707: Tests fix.
* MM-11707: Update test store.
* MM-11707: Allow to change the permission for edit the others posts on TE
* Fixing tests
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
* fix for date based flag support to make the after and before flags not inclusive of the selected date
* updated search posts tests using date flags to take into account new non inclusive of the selected date behavior of those flags
* 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
* 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
* 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
* 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.