MM-34549 shared channels; add users to channel that were already sync'd (#17361)

Fixes a bug and adds a feature for shared channels:
- The Bug: when creating new shared channels, users that had already been sync'd via another channel were not added to the new channel's member list, since the users were not sync'd again. This PR sync's users per channel.
- The Feature: support custom statuses
Этот коммит содержится в:
Doug Lauder
2021-04-14 14:59:26 -04:00
коммит произвёл GitHub
родитель 81c40174e6
Коммит 9799fe9be6
19 изменённых файлов: 123 добавлений и 52 удалений

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

@@ -832,6 +832,7 @@ type AppIface interface {
Notification() einterfaces.NotificationInterface
NotificationsLog() *mlog.Logger
NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User, forceAck bool, isBot bool) *model.AppError
NotifySharedChannelUserUpdate(user *model.User)
OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError
OriginChecker() func(*http.Request) bool
PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userID string) (*model.Channel, *model.AppError)

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

@@ -11401,6 +11401,21 @@ func (a *OpenTracingAppLayer) NotifySessionsExpired() *model.AppError {
return resultVar0
}
func (a *OpenTracingAppLayer) NotifySharedChannelUserUpdate(user *model.User) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.NotifySharedChannelUserUpdate")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
defer func() {
a.app.Srv().Store.SetContext(origCtx)
a.ctx = origCtx
}()
defer span.Finish()
a.app.NotifySharedChannelUserUpdate(user)
}
func (a *OpenTracingAppLayer) OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.OpenInteractiveDialog")

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

@@ -147,3 +147,9 @@ func (a *App) GetSharedChannelRemotesStatus(channelID string) ([]*model.SharedCh
}
return a.Srv().Store.SharedChannel().GetRemotesStatus(channelID)
}
// SharedChannelUsers
func (a *App) NotifySharedChannelUserUpdate(user *model.User) {
a.sendUpdatedUserEvent(*user)
}

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

@@ -116,7 +116,11 @@ func (rp *RemoteProvider) doInvite(a *app.App, args *model.CommandArgs, margs ma
if name == "" {
return responsef(args.T("api.command_remote.missing_empty", map[string]interface{}{"Arg": "name"}))
}
displayname := margs["displayname"]
if displayname == "" {
displayname = name
}
url := a.GetSiteURL()
if url == "" {
@@ -163,7 +167,11 @@ func (rp *RemoteProvider) doAccept(a *app.App, args *model.CommandArgs, margs ma
if name == "" {
return responsef(args.T("api.command_remote.missing_empty", map[string]interface{}{"Arg": "name"}))
}
displayname := margs["displayname"]
if displayname == "" {
displayname = name
}
blob := margs["invite"]
if blob == "" {