* Add playbooks related permissions.
* Add RolesGrantPermission to pluginapi
* Fixing scopes.
* New defaults.
* Fix defaults
* Fix tests.
* Fix migration.
* More test and migration fixes.
* Need to add everything to system admin too.
* Move to 63
* Feedback fixes.
* Fix system manager editing playbook permissions.
* Enable receiving binary websocket messages
* Improve error message
* Prefer anonymous declaration
* Simplify
* Improve test
* Use MessagePack to clone WebSocketRequest struct
* Use short form
* Fix test
* MM-36862: removes participant from thread
Removing a participant upon last reply deleted from thread didn't work
reliably, a suspect on this is the replica lag, since we are first
deleting the post and then counting non-deleted posts of the participant
to decide on whether to delete or not.
The findings that led to this conclusion is that the reply count gets
updated but the participant is not removed (participant removal depends
on the number of replies this participant has in the thread.)
This commit fixes that by removing first the participant and then
deleting the post.
So we delete the participant if they have 1 post in that thread, and
then we delete the post, so now they have no posts in the thread.
* Makes deleting posts transactional
This commit makes deleting a post transactional and also tries to fix
permanent deletion of posts.
Currently when we permanently delete all posts by a user we don't update
the threads reply count nor the participant's array. This commit tries
to fix that.
* Adds comments on deleting posts
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-38674 - AB test for first guided channel creation
* set default value for the guided creation as false
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Summary
The addition of the TotalMsgCountRoot and MsgCountRoot columns to support CRT caused several issues with previously read threads and channels being marked as unread. Previously we attempted to fix this purely in a SQL migration [MM-35345][MM-35494] fixes for incorrect mentions and unreads for threads and channels #17803 but that turned out to be too heavy and it was decided to break up some of the fixes into async jobs.
This PR implements an async job to mark channels as read if there are no user posts since the last time the user viewed the channel.
Ticket Link
https://mattermost.atlassian.net/browse/MM-37013
* MM-39612: Make acquiring and removing connections atomic
The reconnect phase of a websocket was split into two parts:
one where we check if a connection with a given connectionID
exists or not. And second, where we remove that connection
and insert the new connection again in the index.
This would lead to a race where it would be possible
for 2 concurrent requests for the same connectionID to go through
which would lead to separate goroutines working on the same dead queue.
We simplify this by removing the connection from the index
in the check connection stage itself. And then just add that
during register phase.
And to distinguish between a fresh and an old connection, we add
a new field called reuseCount.
While here, we also cleanup some old comments and add more
in some places.
https://mattermost.atlassian.net/browse/MM-39612
```release-note
NONE
```
* remove unused method
```release-note
NONE
```
* race test
```release-note
NONE
```
* CRT changes
* Lint fix
* Moved postId check
* Moved postId check
* Lint fix
* Misc
* Added test case for badge count while clearing notifications
* Fixed count when CRT is on and added isCRTEnabled, teamId to isIdLoaded notifications
* test fix
* isCRTEnabledForUser capitalised
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* GH-18288: Allow configuring unsafe-eval and unsafe-inline
* Add developer flags to telemetry
* wip
* wip
* Refactor based on review
* Refactor based on review
* fix expected vs. actual in assert.Equal
* Add unit tests, rework to check only supported flags.
* Update model/config.go
Co-authored-by: Jesse Hallam <jesse@thehallams.ca>
* Fix failing tests
* Refactor based on review
* Refactor based on review
* Refactor based on review
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Jesse Hallam <jesse@thehallams.ca>
* add missing client for custom user status
* add custom user status plugin api
* update based on feedback review
* add GetCustomStatus
* update interfaces
* Create an endpoint for listing roles
* Add function to client model
* Create tests for listing roles endpoint
* Apply code review suggestions
* Restore GetAllRoles app method
* Use AppContext instead of App
* Minor fix
* Refactor according to new changes
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Add JobSettings.CleanupJobsThresholdDays to telemetry
```release-note
NONE
```
* Moved telemetry to more specific fields
```release-note
NONE
```
* Add missing space
```release-note
NONE
```
* Show private channels in autocomplete
This is supported in all Engines:
MySQL, Postgres, Bleve, Elasticsearch.
https://mattermost.atlassian.net/browse/MM-18496
```release-note
Private channels will now appear in channel autocomplete.
If you are using Bleve or ElasticSearch, you will have to reindex
the channels again to populate them with the new attributes.
```
A large chunk of this work has been based on the earlier
effort at https://github.com/mattermost/mattermost-server/pull/17804.
Full credit goes to https://github.com/arvinDarmawan.
* Add comment
```release-note
NONE
```
* Adding more tests
```release-note
NONE
```
* fix more tests
```release-note
NONE
```
* tmp
```release-note
NONE
```
* more fixes
```release-note
NONE
```
* add tests
```release-note
NONE
```
* Add review comments from previous PR
```release-note
NONE
```
* Add API to return all channels from all team
```release-note
NONE
```
* Added support for bleve and ES
```release-note
NONE
```
* Streaming response for GetAllChannels
```release-note
NONE
```
* Fix tests
```release-note
NONE
```
* Trigger CI
```release-note
NONE
```
* fix tests
```release-note
NONE
```
* Addressing review comments
```release-note
NONE
```
* Fix lint
```release-note
NONE
```
* Removing flaky test
```release-note
NONE
```
* Address comments
```release-note
NONE
```
* Trigger CI
```release-note
NONE
```
* Added /users/<userid>/channel_members endpoint
```release-note
NONE
```
* Minor edit
```release-note
NONE
```
* Improve embedding
```release-note
NONE
```
* Fix lint error
```release-note
NONE
```
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* [MM-39053] - A/B test for default notification settings
* fix tests
* first name notifications on
* update
* Fix bad merge alignment
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
* Add functionality to cleanup old jobs
Historically, we never cleaned up old jobs from the DB
leading to them being accumulated forever.
This PR introduces functionality to cleanup old jobs
older than a defined threshold.
The functionality is set to false by default and has
to be enabled for it to work.
```release-note
2 new config settings were added.
JobSettings.CleanupOldJobs: This indicates whether to clean up old jobs
from the DB or not. Default is false.
JobSettings.CleanupJobsThresholdHours: This defines the time gap in hours beyond
which older jobs will be removed. This has no effect if the above config
setting is set to false. Default is -1
```
* fix copy pasta
```release-note
NONE
```
* address review comments
```release-note
NONE
```
* Fix lint
```release-note
NONE
```
* Use single config option for everything
```release-note
NONE
```
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-36743: adds last_root_post_at in channels table
Channel recency for CRT users should not count replies,
this commit solves that issue by adding a new column to the channels
table: LastRootPostAt.
With that new info CRT users can have recent channels to work as
expected.
* Adds the 'LastRootPostAt' to the SQL scripts
* Fixes tests
* Adds LastRootPostAt migration to v6.1
* Fixes index
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Allow Embeds editing without editing
* Add focalboard to embed after it being in props
* Fix tests
* change to boards
* remove extra gunk
* Fix tests
* Add Feature Flag
* update boardsunfurl
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>