4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-03 11:57:45 +00:00

Update vendor (#1297)

This commit is contained in:
Wim
2020-11-22 15:55:57 +01:00
committed by GitHub
parent cbb46293ab
commit 4cc2c914e6
166 changed files with 25790 additions and 14376 deletions

View File

@ -6,6 +6,7 @@ package model
import (
"encoding/json"
"io"
"regexp"
)
type SidebarCategoryType string
@ -109,3 +110,15 @@ func (o OrderedSidebarCategories) ToJson() []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)
}

View File

@ -342,6 +342,9 @@ type ServiceSettings struct {
EnableAPIChannelDeletion *bool
EnableLocalMode *bool
LocalModeSocketLocation *string
EnableAWSMetering *bool
ThreadAutoFollow *bool `access:"experimental"`
ManagedResourcePaths *string `access:"environment,write_restrictable,cloud_restrictable"`
}
func (s *ServiceSettings) SetDefaults(isUpdate bool) {
@ -755,6 +758,18 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
if s.LocalModeSocketLocation == nil {
s.LocalModeSocketLocation = NewString(LOCAL_MODE_SOCKET_PATH)
}
if s.EnableAWSMetering == nil {
s.EnableAWSMetering = NewBool(false)
}
if s.ThreadAutoFollow == nil {
s.ThreadAutoFollow = NewBool(true)
}
if s.ManagedResourcePaths == nil {
s.ManagedResourcePaths = NewString("")
}
}
type ClusterSettings struct {

View File

@ -36,22 +36,23 @@ type GetFileInfosOptions struct {
}
type FileInfo struct {
Id string `json:"id"`
CreatorId string `json:"user_id"`
PostId string `json:"post_id,omitempty"`
CreateAt int64 `json:"create_at"`
UpdateAt int64 `json:"update_at"`
DeleteAt int64 `json:"delete_at"`
Path string `json:"-"` // not sent back to the client
ThumbnailPath string `json:"-"` // not sent back to the client
PreviewPath string `json:"-"` // not sent back to the client
Name string `json:"name"`
Extension string `json:"extension"`
Size int64 `json:"size"`
MimeType string `json:"mime_type"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
HasPreviewImage bool `json:"has_preview_image,omitempty"`
Id string `json:"id"`
CreatorId string `json:"user_id"`
PostId string `json:"post_id,omitempty"`
CreateAt int64 `json:"create_at"`
UpdateAt int64 `json:"update_at"`
DeleteAt int64 `json:"delete_at"`
Path string `json:"-"` // not sent back to the client
ThumbnailPath string `json:"-"` // not sent back to the client
PreviewPath string `json:"-"` // not sent back to the client
Name string `json:"name"`
Extension string `json:"extension"`
Size int64 `json:"size"`
MimeType string `json:"mime_type"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
HasPreviewImage bool `json:"has_preview_image,omitempty"`
MiniPreview *[]byte `json:"mini_preview"` // declared as *[]byte to avoid postgres/mysql differences in deserialization
}
func (fi *FileInfo) ToJson() string {

View File

@ -0,0 +1,38 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import (
"encoding/json"
)
type Thread struct {
PostId string `json:"id"`
ChannelId string `json:"channel_id"`
ReplyCount int64 `json:"reply_count"`
LastReplyAt int64 `json:"last_reply_at"`
Participants StringArray `json:"participants"`
}
func (o *Thread) ToJson() string {
b, _ := json.Marshal(o)
return string(b)
}
func (o *Thread) Etag() string {
return Etag(o.PostId, o.LastReplyAt)
}
type ThreadMembership struct {
PostId string `json:"post_id"`
UserId string `json:"user_id"`
Following bool `json:"following"`
LastViewed int64 `json:"last_view_at"`
LastUpdated int64 `json:"last_update_at"`
}
func (o *ThreadMembership) ToJson() string {
b, _ := json.Marshal(o)
return string(b)
}

View File

@ -36,6 +36,26 @@ type StringInterface map[string]interface{}
type StringMap map[string]string
type StringArray []string
func (sa StringArray) Remove(input string) StringArray {
for index := range sa {
if sa[index] == input {
ret := make(StringArray, 0, len(sa)-1)
ret = append(ret, sa[:index]...)
return append(ret, sa[index+1:]...)
}
}
return sa
}
func (sa StringArray) Contains(input string) bool {
for index := range sa {
if sa[index] == input {
return true
}
}
return false
}
func (sa StringArray) Equals(input StringArray) bool {
if len(sa) != len(input) {

View File

@ -13,6 +13,7 @@ import (
// It should be maintained in chronological order with most current
// release at the front of the list.
var versions = []string{
"5.29.0",
"5.28.0",
"5.27.0",
"5.26.0",