Shared channels auto-share DM & group messages (#26097)
* option for auto inviting plugin to all shared channels. * auto-invite remotes to shared channels when flag set
Этот коммит содержится в:
@@ -1279,10 +1279,11 @@ type API interface {
|
||||
|
||||
// InviteRemoteToChannel invites a remote, or this plugin, as a target for synchronizing. Once invited, the
|
||||
// remote will start to receive synchronization messages for any changed content in the specified channel.
|
||||
// If `shareIfNotShared` is true, the channel's shared flag will be set, if not already.
|
||||
//
|
||||
// @tag SharedChannels
|
||||
// Minimum server version: 9.5
|
||||
InviteRemoteToChannel(channelID string, remoteID string, userID string) error
|
||||
InviteRemoteToChannel(channelID string, remoteID string, userID string, shareIfNotShared bool) error
|
||||
|
||||
// UninviteRemoteFromChannel uninvites a remote, or this plugin, such that it will stop receiving sychronization
|
||||
// messages for the channel.
|
||||
|
||||
@@ -1351,9 +1351,9 @@ func (api *apiTimerLayer) SyncSharedChannel(channelID string) error {
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) InviteRemoteToChannel(channelID string, remoteID string, userID string) error {
|
||||
func (api *apiTimerLayer) InviteRemoteToChannel(channelID string, remoteID string, userID string, shareIfNotShared bool) error {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA := api.apiImpl.InviteRemoteToChannel(channelID, remoteID, userID)
|
||||
_returnsA := api.apiImpl.InviteRemoteToChannel(channelID, remoteID, userID, shareIfNotShared)
|
||||
api.recordTime(startTime, "InviteRemoteToChannel", _returnsA == nil)
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
@@ -6478,14 +6478,15 @@ type Z_InviteRemoteToChannelArgs struct {
|
||||
A string
|
||||
B string
|
||||
C string
|
||||
D bool
|
||||
}
|
||||
|
||||
type Z_InviteRemoteToChannelReturns struct {
|
||||
A error
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) InviteRemoteToChannel(channelID string, remoteID string, userID string) error {
|
||||
_args := &Z_InviteRemoteToChannelArgs{channelID, remoteID, userID}
|
||||
func (g *apiRPCClient) InviteRemoteToChannel(channelID string, remoteID string, userID string, shareIfNotShared bool) error {
|
||||
_args := &Z_InviteRemoteToChannelArgs{channelID, remoteID, userID, shareIfNotShared}
|
||||
_returns := &Z_InviteRemoteToChannelReturns{}
|
||||
if err := g.client.Call("Plugin.InviteRemoteToChannel", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to InviteRemoteToChannel API failed: %s", err.Error())
|
||||
@@ -6495,9 +6496,9 @@ func (g *apiRPCClient) InviteRemoteToChannel(channelID string, remoteID string,
|
||||
|
||||
func (s *apiRPCServer) InviteRemoteToChannel(args *Z_InviteRemoteToChannelArgs, returns *Z_InviteRemoteToChannelReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
InviteRemoteToChannel(channelID string, remoteID string, userID string) error
|
||||
InviteRemoteToChannel(channelID string, remoteID string, userID string, shareIfNotShared bool) error
|
||||
}); ok {
|
||||
returns.A = hook.InviteRemoteToChannel(args.A, args.B, args.C)
|
||||
returns.A = hook.InviteRemoteToChannel(args.A, args.B, args.C, args.D)
|
||||
returns.A = encodableError(returns.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API InviteRemoteToChannel called but not implemented."))
|
||||
|
||||
@@ -2806,13 +2806,13 @@ func (_m *API) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *mo
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// InviteRemoteToChannel provides a mock function with given fields: channelID, remoteID, userID
|
||||
func (_m *API) InviteRemoteToChannel(channelID string, remoteID string, userID string) error {
|
||||
ret := _m.Called(channelID, remoteID, userID)
|
||||
// InviteRemoteToChannel provides a mock function with given fields: channelID, remoteID, userID, shareIfNotShared
|
||||
func (_m *API) InviteRemoteToChannel(channelID string, remoteID string, userID string, shareIfNotShared bool) error {
|
||||
ret := _m.Called(channelID, remoteID, userID, shareIfNotShared)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
|
||||
r0 = rf(channelID, remoteID, userID)
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool) error); ok {
|
||||
r0 = rf(channelID, remoteID, userID, shareIfNotShared)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user