mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
https://mattermost.atlassian.net/browse/MM-22051 ```release-note Removed the following methods/functions: (ad *AccessData) ToJson() (ar *AccessResponse) ToJson() (ar *AnalyticsRow) ToJson() (ar AnalyticsRows) ToJson() (o *Audit) ToJson() (o Audits) ToJson() (ad *AuthData) ToJson() (ar *AuthorizeRequest) ToJson() (o *ChannelPatch) ToJson() (o *ChannelsWithCount) ToJson() (o *ChannelCounts) ToJson() (o *ChannelData) ToJson() (o *ChannelMembers) ToJson() (o *ChannelUnread) ToJson() (o *ChannelUnreadAt) ToJson() (o *ChannelStats) ToJson() (o *ChannelView) ToJson() (o *ChannelViewResponse) ToJson() (o *ClusterDiscovery) ToJson() (ci *ClusterInfo) ToJson() (cs *ClusterStats) ToJson() (o *Command) ToJson() CommandListToJson(l []*Command) string (o *CommandArgs) ToJson() (cmr *CommandMoveRequest) ToJson() (o *CommandResponse) ToJson() (c *Compliance) ToJson() (c Compliances) ToJson() (o *Config) ToJson() EmojiListToJson(emojiList []*Emoji) ```
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package plugin
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/mattermost/mattermost-server/v6/model"
|
|
"github.com/mattermost/mattermost-server/v6/utils"
|
|
)
|
|
|
|
// CheckRequiredServerConfiguration implements Helpers.CheckRequiredServerConfiguration
|
|
func (p *HelpersImpl) CheckRequiredServerConfiguration(req *model.Config) (bool, error) {
|
|
if req == nil {
|
|
return true, nil
|
|
}
|
|
|
|
cfg := p.API.GetConfig()
|
|
|
|
mc, err := utils.Merge(cfg, req, nil)
|
|
if err != nil {
|
|
return false, errors.Wrap(err, "could not merge configurations")
|
|
}
|
|
|
|
mergedCfg := mc.(model.Config)
|
|
cfgBuf, err := json.Marshal(cfg)
|
|
if err != nil {
|
|
return false, fmt.Errorf("failed to marshal config: %v", err)
|
|
}
|
|
|
|
mergedCfgBuf, err := json.Marshal(mergedCfg)
|
|
if err != nil {
|
|
return false, fmt.Errorf("failed to marshal merged config: %v", err)
|
|
}
|
|
|
|
if !bytes.Equal(cfgBuf, mergedCfgBuf) {
|
|
return false, nil
|
|
}
|
|
|
|
return true, nil
|
|
}
|