Mono repo -> Master (#22553)
Combines the following repositories into one: https://github.com/mattermost/mattermost-server https://github.com/mattermost/mattermost-webapp https://github.com/mattermost/focalboard https://github.com/mattermost/mattermost-plugin-playbooks
Этот коммит содержится в:
73
server/channels/app/shared_channel_service_iface.go
Обычный файл
73
server/channels/app/shared_channel_service_iface.go
Обычный файл
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package app
|
||||
|
||||
// TODO: platform: remove this and use from platform package
|
||||
import (
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/mattermost/mattermost-server/v6/server/platform/services/sharedchannel"
|
||||
)
|
||||
|
||||
// SharedChannelServiceIFace is the interface to the shared channel service
|
||||
type SharedChannelServiceIFace interface {
|
||||
Shutdown() error
|
||||
Start() error
|
||||
NotifyChannelChanged(channelId string)
|
||||
NotifyUserProfileChanged(userID string)
|
||||
SendChannelInvite(channel *model.Channel, userId string, rc *model.RemoteCluster, options ...sharedchannel.InviteOption) error
|
||||
Active() bool
|
||||
}
|
||||
|
||||
type MockOptionSharedChannelService func(service *mockSharedChannelService)
|
||||
|
||||
func MockOptionSharedChannelServiceWithActive(active bool) MockOptionSharedChannelService {
|
||||
return func(mrcs *mockSharedChannelService) {
|
||||
mrcs.active = active
|
||||
}
|
||||
}
|
||||
|
||||
func NewMockSharedChannelService(service SharedChannelServiceIFace, options ...MockOptionSharedChannelService) *mockSharedChannelService {
|
||||
mrcs := &mockSharedChannelService{service, true, []string{}, []string{}, 0}
|
||||
for _, option := range options {
|
||||
option(mrcs)
|
||||
}
|
||||
return mrcs
|
||||
}
|
||||
|
||||
type mockSharedChannelService struct {
|
||||
SharedChannelServiceIFace
|
||||
active bool
|
||||
channelNotifications []string
|
||||
userProfileNotifications []string
|
||||
numInvitations int
|
||||
}
|
||||
|
||||
func (mrcs *mockSharedChannelService) NotifyChannelChanged(channelId string) {
|
||||
mrcs.channelNotifications = append(mrcs.channelNotifications, channelId)
|
||||
}
|
||||
|
||||
func (mrcs *mockSharedChannelService) NotifyUserProfileChanged(userId string) {
|
||||
mrcs.userProfileNotifications = append(mrcs.userProfileNotifications, userId)
|
||||
}
|
||||
|
||||
func (mrcs *mockSharedChannelService) Shutdown() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mrcs *mockSharedChannelService) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mrcs *mockSharedChannelService) Active() bool {
|
||||
return mrcs.active
|
||||
}
|
||||
|
||||
func (mrcs *mockSharedChannelService) SendChannelInvite(channel *model.Channel, userId string, rc *model.RemoteCluster, options ...sharedchannel.InviteOption) error {
|
||||
mrcs.numInvitations += 1
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mrcs *mockSharedChannelService) NumInvitations() int {
|
||||
return mrcs.numInvitations
|
||||
}
|
||||
Ссылка в новой задаче
Block a user