Add new method to channel service
Fix channel service App.ch nil bug
Этот коммит содержится в:
@@ -101,6 +101,10 @@ func (s *channelsWrapper) AddChannelMember(channelID, userID string) (*model.Cha
|
||||
})
|
||||
}
|
||||
|
||||
func (s *channelsWrapper) GetDirectChannelOrCreate(userID1, userID2 string) (*model.Channel, *model.AppError) {
|
||||
return s.app.GetOrCreateDirectChannel(request.EmptyContext(s.srv.Log()), userID1, userID2)
|
||||
}
|
||||
|
||||
// Ensure the wrapper implements the product service.
|
||||
var _ product.ChannelService = (*channelsWrapper)(nil)
|
||||
|
||||
|
||||
@@ -213,6 +213,11 @@ func NewChannels(services map[product.ServiceKey]any) (*Channels, error) {
|
||||
pluginsRoute.HandleFunc("/public/{public_file:.*}", ch.ServePluginPublicRequest)
|
||||
pluginsRoute.HandleFunc("/{anything:.*}", ch.ServePluginRequest)
|
||||
|
||||
services[product.ChannelKey] = &channelsWrapper{
|
||||
srv: s,
|
||||
app: &App{ch: ch},
|
||||
}
|
||||
|
||||
services[product.PostKey] = &postServiceWrapper{
|
||||
app: &App{ch: ch},
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
product.FilestoreKey: s.platform.FileBackend(),
|
||||
product.FileInfoStoreKey: &fileInfoWrapper{srv: s},
|
||||
product.ClusterKey: s.platform,
|
||||
product.UserKey: New(ServerConnector(s.Channels())),
|
||||
product.UserKey: app,
|
||||
product.LogKey: s.platform.Log(),
|
||||
product.CloudKey: &cloudWrapper{cloud: s.Cloud},
|
||||
product.KVStoreKey: s.platform,
|
||||
|
||||
@@ -68,6 +68,7 @@ type ClusterService interface {
|
||||
// The service shall be registered via app.ChannelKey service key.
|
||||
type ChannelService interface {
|
||||
GetDirectChannel(userID1, userID2 string) (*model.Channel, *model.AppError)
|
||||
GetDirectChannelOrCreate(userID1, userID2 string) (*model.Channel, *model.AppError)
|
||||
GetChannelByID(channelID string) (*model.Channel, *model.AppError)
|
||||
GetChannelMember(channelID string, userID string) (*model.ChannelMember, *model.AppError)
|
||||
GetChannelsForTeamForUser(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, *model.AppError)
|
||||
|
||||
Ссылка в новой задаче
Block a user