MM-27493 Shared channels (MVP) (#17301)
Remote Cluster Service - provides ability for multiple Mattermost cluster instances to create a trusted connection with each other and exchange messages - trusted connections are managed via slash commands (for now) - facilitates features requiring inter-cluster communication, such as Shared Channels Shared Channels Service - provides ability to shared channels between one or more Mattermost cluster instances (using trusted connection) - sharing/unsharing of channels is managed via slash commands (for now)
Этот коммит содержится в:
@@ -282,15 +282,23 @@ func (th *TestHelper) CreateBot() *model.Bot {
|
||||
return bot
|
||||
}
|
||||
|
||||
func (th *TestHelper) CreateChannel(team *model.Team) *model.Channel {
|
||||
return th.createChannel(team, model.CHANNEL_OPEN)
|
||||
type ChannelOption func(*model.Channel)
|
||||
|
||||
func WithShared(v bool) ChannelOption {
|
||||
return func(channel *model.Channel) {
|
||||
channel.Shared = model.NewBool(v)
|
||||
}
|
||||
}
|
||||
|
||||
func (th *TestHelper) CreateChannel(team *model.Team, options ...ChannelOption) *model.Channel {
|
||||
return th.createChannel(team, model.CHANNEL_OPEN, options...)
|
||||
}
|
||||
|
||||
func (th *TestHelper) CreatePrivateChannel(team *model.Team) *model.Channel {
|
||||
return th.createChannel(team, model.CHANNEL_PRIVATE)
|
||||
}
|
||||
|
||||
func (th *TestHelper) createChannel(team *model.Team, channelType string) *model.Channel {
|
||||
func (th *TestHelper) createChannel(team *model.Team, channelType string, options ...ChannelOption) *model.Channel {
|
||||
id := model.NewId()
|
||||
|
||||
channel := &model.Channel{
|
||||
@@ -301,10 +309,31 @@ func (th *TestHelper) createChannel(team *model.Team, channelType string) *model
|
||||
CreatorId: th.BasicUser.Id,
|
||||
}
|
||||
|
||||
for _, option := range options {
|
||||
option(channel)
|
||||
}
|
||||
|
||||
utils.DisableDebugLogForTest()
|
||||
var err *model.AppError
|
||||
if channel, err = th.App.CreateChannel(channel, true); err != nil {
|
||||
panic(err)
|
||||
var appErr *model.AppError
|
||||
if channel, appErr = th.App.CreateChannel(channel, true); appErr != nil {
|
||||
panic(appErr)
|
||||
}
|
||||
|
||||
if channel.IsShared() {
|
||||
id := model.NewId()
|
||||
_, err := th.App.SaveSharedChannel(&model.SharedChannel{
|
||||
ChannelId: channel.Id,
|
||||
TeamId: channel.TeamId,
|
||||
Home: false,
|
||||
ReadOnly: false,
|
||||
ShareName: "shared-" + id,
|
||||
ShareDisplayName: "shared-" + id,
|
||||
CreatorId: th.BasicUser.Id,
|
||||
RemoteId: model.NewId(),
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
utils.EnableDebugLogForTest()
|
||||
return channel
|
||||
|
||||
Ссылка в новой задаче
Block a user