Forbid users from creating DMs and GMs with remote users (#28855)

* Forbid users from creating DMs and GMs with remote users

This change prevents the application from creating new DMs and GMs
when remote users are involved, and prevents as well new posts from
being created into preexisting DMs and GMs with remote users created
in previous versions.

* Adds i18n

* Skip preexisting DM tests and create a new one for the new behavior
Этот коммит содержится в:
Miguel de la Cruz
2024-10-18 19:16:29 +02:00
коммит произвёл GitHub
родитель 318abef7d1
Коммит 30cb527cf6
7 изменённых файлов: 168 добавлений и 0 удалений

Просмотреть файл

@@ -22,6 +22,10 @@ func (scs *Service) ShareChannel(sc *model.SharedChannel) (*model.SharedChannel,
return nil, fmt.Errorf("cannot fetch channel while sharing channel %s: %w", sc.ChannelId, err)
}
if channel.Type == model.ChannelTypeDirect || channel.Type == model.ChannelTypeGroup {
return nil, errors.New("cannot share a direct or group channel")
}
// check if channel is already shared
scExisting, err := scs.server.GetStore().SharedChannel().Get(sc.ChannelId)
if err == nil {