коммит произвёл
GitHub
родитель
d172ff1881
Коммит
3dd9e3715c
@@ -7,7 +7,6 @@ import (
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
@@ -201,47 +200,6 @@ func WithID(ID string) ChannelOption {
|
||||
}
|
||||
}
|
||||
|
||||
// The following are some GraphQL methods necessary to return the
|
||||
// data in float64 type. The spec doesn't support 64 bit integers,
|
||||
// so we have to pass the data in float64. The _ at the end is
|
||||
// a hack to keep the attribute name same in GraphQL schema.
|
||||
|
||||
func (o *Channel) CreateAt_() float64 {
|
||||
return float64(o.CreateAt)
|
||||
}
|
||||
|
||||
func (o *Channel) UpdateAt_() float64 {
|
||||
return float64(o.UpdateAt)
|
||||
}
|
||||
|
||||
func (o *Channel) DeleteAt_() float64 {
|
||||
return float64(o.DeleteAt)
|
||||
}
|
||||
|
||||
func (o *Channel) LastPostAt_() float64 {
|
||||
return float64(o.LastPostAt)
|
||||
}
|
||||
|
||||
func (o *Channel) TotalMsgCount_() float64 {
|
||||
return float64(o.TotalMsgCount)
|
||||
}
|
||||
|
||||
func (o *Channel) TotalMsgCountRoot_() float64 {
|
||||
return float64(o.TotalMsgCountRoot)
|
||||
}
|
||||
|
||||
func (o *Channel) LastRootPostAt_() float64 {
|
||||
return float64(o.LastRootPostAt)
|
||||
}
|
||||
|
||||
func (o *Channel) ExtraUpdateAt_() float64 {
|
||||
return float64(o.ExtraUpdateAt)
|
||||
}
|
||||
|
||||
func (o *Channel) Props_() StringInterface {
|
||||
return StringInterface(o.Props)
|
||||
}
|
||||
|
||||
func (o *Channel) DeepCopy() *Channel {
|
||||
cCopy := *o
|
||||
if cCopy.SchemeId != nil {
|
||||
@@ -391,24 +349,10 @@ func (o *Channel) GetOtherUserIdForDM(userId string) string {
|
||||
return otherUserId
|
||||
}
|
||||
|
||||
func (ChannelType) ImplementsGraphQLType(name string) bool {
|
||||
return name == "ChannelType"
|
||||
}
|
||||
|
||||
func (t ChannelType) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(string(t))
|
||||
}
|
||||
|
||||
func (t *ChannelType) UnmarshalGraphQL(input any) error {
|
||||
chType, ok := input.(string)
|
||||
if !ok {
|
||||
return errors.New("wrong type")
|
||||
}
|
||||
|
||||
*t = ChannelType(chType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetDMNameFromIds(userId1, userId2 string) string {
|
||||
if userId1 > userId2 {
|
||||
return userId2 + "__" + userId1
|
||||
|
||||
@@ -88,39 +88,6 @@ func (o *ChannelMember) Auditable() map[string]interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
// The following are some GraphQL methods necessary to return the
|
||||
// data in float64 type. The spec doesn't support 64 bit integers,
|
||||
// so we have to pass the data in float64. The _ at the end is
|
||||
// a hack to keep the attribute name same in GraphQL schema.
|
||||
|
||||
func (o *ChannelMember) LastViewedAt_() float64 {
|
||||
return float64(o.LastViewedAt)
|
||||
}
|
||||
|
||||
func (o *ChannelMember) MsgCount_() float64 {
|
||||
return float64(o.MsgCount)
|
||||
}
|
||||
|
||||
func (o *ChannelMember) MentionCount_() float64 {
|
||||
return float64(o.MentionCount)
|
||||
}
|
||||
|
||||
func (o *ChannelMember) MentionCountRoot_() float64 {
|
||||
return float64(o.MentionCountRoot)
|
||||
}
|
||||
|
||||
func (o *ChannelMember) UrgentMentionCount_() float64 {
|
||||
return float64(o.UrgentMentionCount)
|
||||
}
|
||||
|
||||
func (o *ChannelMember) MsgCountRoot_() float64 {
|
||||
return float64(o.MsgCountRoot)
|
||||
}
|
||||
|
||||
func (o *ChannelMember) LastUpdateAt_() float64 {
|
||||
return float64(o.LastUpdateAt)
|
||||
}
|
||||
|
||||
// ChannelMemberWithTeamData contains ChannelMember appended with extra team information
|
||||
// as well.
|
||||
type ChannelMemberWithTeamData struct {
|
||||
|
||||
@@ -5,7 +5,6 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
@@ -89,42 +88,10 @@ func IsValidCategoryId(s string) bool {
|
||||
return categoryIdPattern.MatchString(s)
|
||||
}
|
||||
|
||||
func (SidebarCategoryType) ImplementsGraphQLType(name string) bool {
|
||||
return name == "SidebarCategoryType"
|
||||
}
|
||||
|
||||
func (t SidebarCategoryType) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(string(t))
|
||||
}
|
||||
|
||||
func (t *SidebarCategoryType) UnmarshalGraphQL(input any) error {
|
||||
chType, ok := input.(string)
|
||||
if !ok {
|
||||
return errors.New("wrong type")
|
||||
}
|
||||
|
||||
*t = SidebarCategoryType(chType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (SidebarCategorySorting) ImplementsGraphQLType(name string) bool {
|
||||
return name == "SidebarCategorySorting"
|
||||
}
|
||||
|
||||
func (t SidebarCategorySorting) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(string(t))
|
||||
}
|
||||
|
||||
func (t *SidebarCategorySorting) UnmarshalGraphQL(input any) error {
|
||||
chType, ok := input.(string)
|
||||
if !ok {
|
||||
return errors.New("wrong type")
|
||||
}
|
||||
|
||||
*t = SidebarCategorySorting(chType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *SidebarCategory) SortOrder_() float64 {
|
||||
return float64(t.SortOrder)
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -63,12 +61,6 @@ func (cs *CustomStatus) AreDurationAndExpirationTimeValid() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ExpiresAt_ returns the time in a type that has the marshal/unmarshal methods
|
||||
// attached to it.
|
||||
func (cs *CustomStatus) ExpiresAt_() graphql.Time {
|
||||
return graphql.Time{Time: cs.ExpiresAt}
|
||||
}
|
||||
|
||||
func RuneToHexadecimalString(r rune) string {
|
||||
return fmt.Sprintf("%04x", r)
|
||||
}
|
||||
|
||||
@@ -29,9 +29,6 @@ type FeatureFlags struct {
|
||||
|
||||
NormalizeLdapDNs bool
|
||||
|
||||
// Enable GraphQL feature
|
||||
GraphQL bool
|
||||
|
||||
PostPriority bool
|
||||
|
||||
// Enable WYSIWYG text editor
|
||||
@@ -54,7 +51,6 @@ func (f *FeatureFlags) SetDefaults() {
|
||||
f.EnableRemoteClusterService = false
|
||||
f.AppsEnabled = true
|
||||
f.NormalizeLdapDNs = false
|
||||
f.GraphQL = false
|
||||
f.CallsEnabled = true
|
||||
f.DeprecateCloudFree = false
|
||||
f.WysiwygEditor = false
|
||||
|
||||
@@ -34,19 +34,6 @@ func (s *Status) ToJSON() ([]byte, error) {
|
||||
return json.Marshal(sCopy)
|
||||
}
|
||||
|
||||
// The following are some GraphQL methods necessary to return the
|
||||
// data in float64 type. The spec doesn't support 64 bit integers,
|
||||
// so we have to pass the data in float64. The _ at the end is
|
||||
// a hack to keep the attribute name same in GraphQL schema.
|
||||
|
||||
func (s *Status) LastActivityAt_() float64 {
|
||||
return float64(s.LastActivityAt)
|
||||
}
|
||||
|
||||
func (s *Status) DNDEndTime_() float64 {
|
||||
return float64(s.DNDEndTime)
|
||||
}
|
||||
|
||||
func StatusListToJSON(u []*Status) ([]byte, error) {
|
||||
list := make([]Status, len(u))
|
||||
for i, s := range u {
|
||||
|
||||
@@ -287,24 +287,3 @@ func (o *Team) ShallowCopy() *Team {
|
||||
c := *o
|
||||
return &c
|
||||
}
|
||||
|
||||
// The following are some GraphQL methods necessary to return the
|
||||
// data in float64 type. The spec doesn't support 64 bit integers,
|
||||
// so we have to pass the data in float64. The _ at the end is
|
||||
// a hack to keep the attribute name same in GraphQL schema.
|
||||
|
||||
func (o *Team) CreateAt_() float64 {
|
||||
return float64(o.UpdateAt)
|
||||
}
|
||||
|
||||
func (o *Team) UpdateAt_() float64 {
|
||||
return float64(o.UpdateAt)
|
||||
}
|
||||
|
||||
func (o *Team) DeleteAt_() float64 {
|
||||
return float64(o.DeleteAt)
|
||||
}
|
||||
|
||||
func (o *Team) LastTeamIconUpdate_() float64 {
|
||||
return float64(o.LastTeamIconUpdate)
|
||||
}
|
||||
|
||||
@@ -142,9 +142,3 @@ func (o *TeamMember) PreUpdate() {
|
||||
func (o *TeamMember) GetRoles() []string {
|
||||
return strings.Fields(o.Roles)
|
||||
}
|
||||
|
||||
// DeleteAt_ returns the deleteAt value in float64. This is necessary to work
|
||||
// with GraphQL since it doesn't support 64 bit integers.
|
||||
func (o *TeamMember) DeleteAt_() float64 {
|
||||
return float64(o.DeleteAt)
|
||||
}
|
||||
|
||||
@@ -468,47 +468,6 @@ func (u *User) PreSave() {
|
||||
}
|
||||
}
|
||||
|
||||
// The following are some GraphQL methods necessary to return the
|
||||
// data in float64 type. The spec doesn't support 64 bit integers,
|
||||
// so we have to pass the data in float64. The _ at the end is
|
||||
// a hack to keep the attribute name same in GraphQL schema.
|
||||
|
||||
func (u *User) CreateAt_() float64 {
|
||||
return float64(u.CreateAt)
|
||||
}
|
||||
|
||||
func (u *User) DeleteAt_() float64 {
|
||||
return float64(u.DeleteAt)
|
||||
}
|
||||
|
||||
func (u *User) UpdateAt_() float64 {
|
||||
return float64(u.UpdateAt)
|
||||
}
|
||||
|
||||
func (u *User) LastPictureUpdate_() float64 {
|
||||
return float64(u.LastPictureUpdate)
|
||||
}
|
||||
|
||||
func (u *User) LastPasswordUpdate_() float64 {
|
||||
return float64(u.LastPasswordUpdate)
|
||||
}
|
||||
|
||||
func (u *User) FailedAttempts_() float64 {
|
||||
return float64(u.FailedAttempts)
|
||||
}
|
||||
|
||||
func (u *User) LastActivityAt_() float64 {
|
||||
return float64(u.LastActivityAt)
|
||||
}
|
||||
|
||||
func (u *User) BotLastIconUpdate_() float64 {
|
||||
return float64(u.BotLastIconUpdate)
|
||||
}
|
||||
|
||||
func (u *User) TermsOfServiceCreateAt_() float64 {
|
||||
return float64(u.TermsOfServiceCreateAt)
|
||||
}
|
||||
|
||||
// PreUpdate should be run before updating the user in the db.
|
||||
func (u *User) PreUpdate() {
|
||||
u.Username = SanitizeUnicode(u.Username)
|
||||
|
||||
@@ -177,24 +177,10 @@ func (m StringMap) Value() (driver.Value, error) {
|
||||
return string(buf), nil
|
||||
}
|
||||
|
||||
func (StringMap) ImplementsGraphQLType(name string) bool {
|
||||
return name == "StringMap"
|
||||
}
|
||||
|
||||
func (m StringMap) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal((map[string]string)(m))
|
||||
}
|
||||
|
||||
func (m *StringMap) UnmarshalGraphQL(input any) error {
|
||||
json, ok := input.(map[string]string)
|
||||
if !ok {
|
||||
return errors.New("wrong type")
|
||||
}
|
||||
|
||||
*m = json
|
||||
return nil
|
||||
}
|
||||
|
||||
func (si *StringInterface) Scan(value any) error {
|
||||
if value == nil {
|
||||
return nil
|
||||
@@ -228,24 +214,10 @@ func (si StringInterface) Value() (driver.Value, error) {
|
||||
return string(j), err
|
||||
}
|
||||
|
||||
func (StringInterface) ImplementsGraphQLType(name string) bool {
|
||||
return name == "StringInterface"
|
||||
}
|
||||
|
||||
func (si StringInterface) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal((map[string]any)(si))
|
||||
}
|
||||
|
||||
func (si *StringInterface) UnmarshalGraphQL(input any) error {
|
||||
json, ok := input.(map[string]any)
|
||||
if !ok {
|
||||
return errors.New("wrong type")
|
||||
}
|
||||
|
||||
*si = json
|
||||
return nil
|
||||
}
|
||||
|
||||
var translateFunc i18n.TranslateFunc
|
||||
var translateFuncOnce sync.Once
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user