MM-51482_Create Apps Category and link to bots DM (#22918)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
13f1d0fdc5
Коммит
1051925eec
@@ -13,11 +13,12 @@ type SidebarCategoryType string
|
||||
type SidebarCategorySorting string
|
||||
|
||||
const (
|
||||
// Each sidebar category has a 'type'. System categories are Channels, Favorites and DMs
|
||||
// Each sidebar category has a 'type'. System categories are Channels, Favorites, DMs and Apps
|
||||
// All user-created categories will have type Custom
|
||||
SidebarCategoryChannels SidebarCategoryType = "channels"
|
||||
SidebarCategoryDirectMessages SidebarCategoryType = "direct_messages"
|
||||
SidebarCategoryFavorites SidebarCategoryType = "favorites"
|
||||
SidebarCategoryApps SidebarCategoryType = "apps"
|
||||
SidebarCategoryCustom SidebarCategoryType = "custom"
|
||||
// Increment to use when adding/reordering things in the sidebar
|
||||
MinimalSidebarSortDistance = 10
|
||||
@@ -25,6 +26,7 @@ const (
|
||||
DefaultSidebarSortOrderFavorites = 0
|
||||
DefaultSidebarSortOrderChannels = DefaultSidebarSortOrderFavorites + MinimalSidebarSortDistance
|
||||
DefaultSidebarSortOrderDMs = DefaultSidebarSortOrderChannels + MinimalSidebarSortDistance
|
||||
DefaultSidebarSortOrderApps = DefaultSidebarSortOrderDMs + MinimalSidebarSortDistance
|
||||
// Sorting modes
|
||||
// default for all categories except DMs (behaves like manual)
|
||||
SidebarCategorySortDefault SidebarCategorySorting = ""
|
||||
@@ -36,6 +38,13 @@ const (
|
||||
SidebarCategorySortAlphabetical SidebarCategorySorting = "alpha"
|
||||
)
|
||||
|
||||
var SystemSidebarCategories = []SidebarCategoryType{
|
||||
SidebarCategoryChannels,
|
||||
SidebarCategoryDirectMessages,
|
||||
SidebarCategoryFavorites,
|
||||
SidebarCategoryApps,
|
||||
}
|
||||
|
||||
// SidebarCategory represents the corresponding DB table
|
||||
type SidebarCategory struct {
|
||||
Id string `json:"id"`
|
||||
@@ -77,7 +86,7 @@ type SidebarChannel struct {
|
||||
type SidebarChannels []*SidebarChannel
|
||||
type SidebarCategoriesWithChannels []*SidebarCategoryWithChannels
|
||||
|
||||
var categoryIdPattern = regexp.MustCompile("(favorites|channels|direct_messages)_[a-z0-9]{26}_[a-z0-9]{26}")
|
||||
var categoryIdPattern = regexp.MustCompile("(favorites|channels|direct_messages|apps)_[a-z0-9]{26}_[a-z0-9]{26}")
|
||||
|
||||
func IsValidCategoryId(s string) bool {
|
||||
// Category IDs can either be regular IDs
|
||||
|
||||
Ссылка в новой задаче
Block a user