mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Create propery SC when InviteRemoteToChannel and channel should be shared. (#26469)
This commit is contained in:
parent
79b1e9d200
commit
1cb936b0b7
@ -95,7 +95,7 @@ func handleContentSync(ps *PlatformService, syncService SharedChannelServiceIFac
|
|||||||
for _, remote := range remotes {
|
for _, remote := range remotes {
|
||||||
// invite remote to channel (will share the channel if not already shared)
|
// invite remote to channel (will share the channel if not already shared)
|
||||||
if err := syncService.InviteRemoteToChannel(channel.Id, remote.RemoteId, remote.CreatorId, true); err != nil {
|
if err := syncService.InviteRemoteToChannel(channel.Id, remote.RemoteId, remote.CreatorId, true); err != nil {
|
||||||
return fmt.Errorf("cannot invite remote to channel %s: %w", channel.Id, err)
|
return fmt.Errorf("cannot invite remote %s to channel %s: %w", remote.RemoteId, channel.Id, err)
|
||||||
}
|
}
|
||||||
shouldNotify = true
|
shouldNotify = true
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,13 @@ func (scs *Service) InviteRemoteToChannel(channelID, remoteID, userID string, sh
|
|||||||
|
|
||||||
// set the channel `shared` flag if needed
|
// set the channel `shared` flag if needed
|
||||||
if shareIfNotShared {
|
if shareIfNotShared {
|
||||||
if _, err = scs.ShareChannel(&model.SharedChannel{ChannelId: channelID, CreatorId: userID}); err != nil {
|
sc := &model.SharedChannel{
|
||||||
|
ChannelId: channelID,
|
||||||
|
CreatorId: userID,
|
||||||
|
Home: true,
|
||||||
|
RemoteId: remoteID,
|
||||||
|
}
|
||||||
|
if _, err = scs.ShareChannel(sc); err != nil {
|
||||||
return model.NewAppError("InviteRemoteToChannel", "api.command_share.share_channel.error",
|
return model.NewAppError("InviteRemoteToChannel", "api.command_share.share_channel.error",
|
||||||
map[string]any{"Error": err.Error()}, "", http.StatusBadRequest)
|
map[string]any{"Error": err.Error()}, "", http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user