* MM-21357: Use typed constant for channel types
https://mattermost.atlassian.net/browse/MM-21357
```release-note
- Introduced a new type ChannelType for all channel types.
- Updated the Client4.UpdateChannelPrivacy method to ChannelType.
```
* Address review comments
```release-note
NONE
```
* telemetry fix
```release-note
NONE
```
Setting AutomaticPrepackagedPlugins to true was making the test
to download the plugin from the marketplace and initialize it.
While this wasn't wrong in itself but that's not what the test does
and just part of the app initialization and it unnecessarily slowed
down the test by downloading the plugin zip file.
And initializing a plugin from inside a test has some issues
to work properly. While those could be solved, a cleaner way
is to just not download the plugin at all.
https://mattermost.atlassian.net/browse/MM-36947
```release-note
NONE
```
* Added expiry support in custom status APIs (#11)
* Added expiry support in custom status APIs
Added validation for the duration and expiration time in request body
Made enum for the custom status durations
* Fixed the bug in expiry validation with dont clear validation
* Fixed review comments
Converted the durations enum to map
Removed extra if-else
* Added expiry support in custom status slash command (#17)
* Added expiry support in custom status slash command
* Added the check for timezone enabled in expiry time in custom status slash command
* Review fixes
Changed name of calculateExpriryTime to calculateEndOfDay
Made function SetDefaultEmoji for settting default emoji in set custom status API
* Added support for empty duration in custom status APIs
Made one of emoji and text required and duration optional in set custom status API
Made default duration dont clear in both API and slash command
* Changed value of ExpiresAt field in custom status slash command
* Code refactoring
Combined SetDefaults and TrimMessage into 1 function PreSave
Refactored isExpirationTimeValid function
* Used model variables instead of new variables in custom status slash command
* Modified behaviour of set custom status APIs (#19)
Removed dont_clear from validCustomStatusDuration map
Added logic to set duration custom date/time if only expires_at is specified in the body
Made function AreDurationAndExpirationTimeValid in custom status model
* Trigger CI build
* Added logic to detect and set unicode emoji in the custom status slash command
* Replaced strings.split with strings.Fields
* Added logic to handle empty string as message in custom status slash command
* Changed custom status slash command empty message behavior to set def… (#14)
* Changed custom status slash command empty message behavior to set default emoji
* Code refactoring
* Added unit tests and refactored some code
* WIP: Unit tests and refactoring for detecting unicode emoji in custom status slash commands
* Complete unit testing for Get custom status
* Fixed lint
* Added logic for removing skin tone from unicode emoji (#16)
* Added logic for removing skin tone from unicode emoji
Made a reverse system emojis map of string vs []string and stored the emojiNames in sorted order
Added the logic for detecting and replacing/removing skin tone in unicode emoji with variation selector
Added new unit tests with different skin tone emojis
* Refactored removeSkinTone logic to a separate function
* Added check for emoji before removing skin tone in custom status slash command
* Fixed custom status slash command unit test and refactored some code
Chanded the return type of GetEmojiNameFromUnicode from bool to int
Changed the logic for checking presence of emoji without removing skin tone
Fixed the unit tests
* Review fixes: Indentation changes
* restrict creation of direct channels to team members
* run make i18n-extract
* add suggestions from hahmadia
* place common-team-check logic in app layer
* use flat SQL query
* show more specific error message to user
* MM-7968: Fmt file.
* MM-7968: Fix for moved session field.
Co-authored-by: Max Erenberg <max.erenberg@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Martin Kraft <martinkraft@gmail.com>
Co-authored-by: Martin Kraft <martin@upspin.org>
* add request context
* move initialialization to server
* use app interface instead of global app functions
* remove app context from webconn
* cleanup
* remove duplicated services
* move context to separate package
* remove finalize init method and move content to NewServer function
* restart workers and schedulers after adding license for tests
* reflect review comments
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Changed the request type to POST for the remove recent custom status API
Fixed the custom status clear slash command
* Added Delete method in the remove recent custom status endpoint
* Added one new endpoint to remove recent custom status with POST method
* Added comments for the recent custom status API
Co-authored-by: Manoj <manoj@brightscout.com>
Co-authored-by: Chetanya Kandhari <availchet@gmail.com>
Co-authored-by: Manoj <77336594+manojosh@users.noreply.github.com>
Fixes a bug and adds a feature for shared channels:
- The Bug: when creating new shared channels, users that had already been sync'd via another channel were not added to the new channel's member list, since the users were not sync'd again. This PR sync's users per channel.
- The Feature: support custom statuses
Support for handling username collisions between remote clusters. Users belonging to remote clusters have their username changed to include the remote name e.g. wiggin becomes wiggin:mattermost.
@mentions are also modified so the munged username is replaced with the original username when the post is sync'd with the remote the user belongs to.
When adding remote users:
- append the remote name to the username with colon separator
- append the remote name to the email address with colon separator
- store the original username and email address in user props
- when resolving @mentions replace with the stored original username
* MM-34002: Improve AddUserToChannel
When we would add a user to a channel, we would
check whether the user is removed from that team or not.
During LDAP sync, this check is not required because the
team member would have just been created. Hence, we
pass a boolean flag to bypass the check.
And with that done, we can freely query the replica.
https://mattermost.atlassian.net/browse/MM-34002
```release-note
NONE
```
* Refactor code
* Rename a struct field
* fix double negative
During LDAP sync, we would call AddTeamMember which had a read-after-write issue
where we would create a team member but then immediately after that
query the team member.
The same pattern was found in:
AddTeamMember
AddTeamMembers
AddTeamMemberByToken
To fix this, we just return the inserted team member from AddUserToTeam and use that
instead of query GetTeamMember again.
```release-note
NONE
```
https://mattermost.atlassian.net/browse/MM-33913
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Remote Cluster Service
- provides ability for multiple Mattermost cluster instances to create a trusted connection with each other and exchange messages
- trusted connections are managed via slash commands (for now)
- facilitates features requiring inter-cluster communication, such as Shared Channels
Shared Channels Service
- provides ability to shared channels between one or more Mattermost cluster instances (using trusted connection)
- sharing/unsharing of channels is managed via slash commands (for now)
* Create the system console setting and send to webapp
* MI-1145: Add custom status APIs
* MI-1145 Add slash commands to set and clear status
* Add validation for custom status API
* Trim custom status message
* Code refactoring
- Run gofmt
- Rename constants
* Remove sendUserUpdated webhook event
* Fix recent custom status length
* Update error conditions
* Disable /status slash command when config setting is off
* MI-1155: Create the feature flag for custom status APIs and slash commands
* Move recent custom statuses to user preferences (#7)
* Move recent custom statuses to user preferences
* Code refactoring and feedback changes
* Update slash command text and emoji regex
* Make the custom status feature flag off by default
* Update SetCustomStatus, handle recents not set better
* Update status codes
* Update slash command handling
* Add telementry settings
* Fix i18n order
* Revert "Fix i18n order"
This reverts commit 499f7eaca8.
* Update i18n strings
* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w`
* added goimports lint check to .golangci.yml
* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w` for a corner case
* make app-layers, *-mocks and store-layers for ci check
Co-authored-by: Mahmudul Haque <mahmudulhaque@protonmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-31063: Change constants to use CamelCase
* store package
* change allcaps to camel case (#16615)
* New tools.mod
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
* Removing supplier concept from the sql store
* Removing other metions to supplier
* Fixing gofmt
* Fixing gofmt
* Renaming NewSqlStore to New
* Fixing tests
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>