summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-08-05 20:43:19 +0200
committerGitHub <noreply@github.com>2023-08-05 20:43:19 +0200
commit56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch)
treeb1355645342667209263cbd355dc0b4254f1e8fe /vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go
parent9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff)
downloadmatterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.gz
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.bz2
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.zip
Update dependencies and remove old matterclient lib (#2067)HEADmaster
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go126
1 files changed, 0 insertions, 126 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go b/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go
deleted file mode 100644
index 35301d1e..00000000
--- a/vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
-// See LICENSE.txt for license information.
-
-package model
-
-import (
- "encoding/json"
- "io"
- "regexp"
-)
-
-type SidebarCategoryType string
-type SidebarCategorySorting string
-
-const (
- // Each sidebar category has a 'type'. System categories are Channels, Favorites and DMs
- // All user-created categories will have type Custom
- SidebarCategoryChannels SidebarCategoryType = "channels"
- SidebarCategoryDirectMessages SidebarCategoryType = "direct_messages"
- SidebarCategoryFavorites SidebarCategoryType = "favorites"
- SidebarCategoryCustom SidebarCategoryType = "custom"
- // Increment to use when adding/reordering things in the sidebar
- MinimalSidebarSortDistance = 10
- // Default Sort Orders for categories
- DefaultSidebarSortOrderFavorites = 0
- DefaultSidebarSortOrderChannels = DefaultSidebarSortOrderFavorites + MinimalSidebarSortDistance
- DefaultSidebarSortOrderDMs = DefaultSidebarSortOrderChannels + MinimalSidebarSortDistance
- // Sorting modes
- // default for all categories except DMs (behaves like manual)
- SidebarCategorySortDefault SidebarCategorySorting = ""
- // sort manually
- SidebarCategorySortManual SidebarCategorySorting = "manual"
- // sort by recency (default for DMs)
- SidebarCategorySortRecent SidebarCategorySorting = "recent"
- // sort by display name alphabetically
- SidebarCategorySortAlphabetical SidebarCategorySorting = "alpha"
-)
-
-// SidebarCategory represents the corresponding DB table
-// SortOrder is never returned to the user and only used for queries
-type SidebarCategory struct {
- Id string `json:"id"`
- UserId string `json:"user_id"`
- TeamId string `json:"team_id"`
- SortOrder int64 `json:"-"`
- Sorting SidebarCategorySorting `json:"sorting"`
- Type SidebarCategoryType `json:"type"`
- DisplayName string `json:"display_name"`
- Muted bool `json:"muted"`
- Collapsed bool `json:"collapsed"`
-}
-
-// SidebarCategoryWithChannels combines data from SidebarCategory table with the Channel IDs that belong to that category
-type SidebarCategoryWithChannels struct {
- SidebarCategory
- Channels []string `json:"channel_ids"`
-}
-
-type SidebarCategoryOrder []string
-
-// OrderedSidebarCategories combines categories, their channel IDs and an array of Category IDs, sorted
-type OrderedSidebarCategories struct {
- Categories SidebarCategoriesWithChannels `json:"categories"`
- Order SidebarCategoryOrder `json:"order"`
-}
-
-type SidebarChannel struct {
- ChannelId string `json:"channel_id"`
- UserId string `json:"user_id"`
- CategoryId string `json:"category_id"`
- SortOrder int64 `json:"-"`
-}
-
-type SidebarChannels []*SidebarChannel
-type SidebarCategoriesWithChannels []*SidebarCategoryWithChannels
-
-func SidebarCategoryFromJson(data io.Reader) (*SidebarCategoryWithChannels, error) {
- var o *SidebarCategoryWithChannels
- err := json.NewDecoder(data).Decode(&o)
- return o, err
-}
-
-func SidebarCategoriesFromJson(data io.Reader) ([]*SidebarCategoryWithChannels, error) {
- var o []*SidebarCategoryWithChannels
- err := json.NewDecoder(data).Decode(&o)
- return o, err
-}
-
-func OrderedSidebarCategoriesFromJson(data io.Reader) (*OrderedSidebarCategories, error) {
- var o *OrderedSidebarCategories
- err := json.NewDecoder(data).Decode(&o)
- return o, err
-}
-
-func (o SidebarCategoryWithChannels) ToJson() []byte {
- b, _ := json.Marshal(o)
- return b
-}
-
-func SidebarCategoriesWithChannelsToJson(o []*SidebarCategoryWithChannels) []byte {
- b, err := json.Marshal(o)
- if err != nil {
- return []byte("[]")
- }
- return b
-}
-
-func (o OrderedSidebarCategories) ToJson() []byte {
- b, err := json.Marshal(o)
- if err != nil {
- return []byte("[]")
- }
- return b
-}
-
-var categoryIdPattern = regexp.MustCompile("(favorites|channels|direct_messages)_[a-z0-9]{26}_[a-z0-9]{26}")
-
-func IsValidCategoryId(s string) bool {
- // Category IDs can either be regular IDs
- if IsValidId(s) {
- return true
- }
-
- // Or default categories can follow the pattern {type}_{userID}_{teamID}
- return categoryIdPattern.MatchString(s)
-}