[MM-41998] Channel Info RHS: display number of files for a channel (#19822)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -561,6 +561,7 @@ type AppIface interface {
|
||||
GetChannelByName(channelName, teamID string, includeDeleted bool) (*model.Channel, *model.AppError)
|
||||
GetChannelByNameForTeamName(channelName, teamName string, includeDeleted bool) (*model.Channel, *model.AppError)
|
||||
GetChannelCounts(teamID string, userID string) (*model.ChannelCounts, *model.AppError)
|
||||
GetChannelFileCount(channelID string) (int64, *model.AppError)
|
||||
GetChannelGuestCount(channelID string) (int64, *model.AppError)
|
||||
GetChannelMember(ctx context.Context, channelID string, userID string) (*model.ChannelMember, *model.AppError)
|
||||
GetChannelMemberCount(channelID string) (int64, *model.AppError)
|
||||
|
||||
@@ -2009,6 +2009,15 @@ func (a *App) GetChannelMemberCount(channelID string) (int64, *model.AppError) {
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (a *App) GetChannelFileCount(channelID string) (int64, *model.AppError) {
|
||||
count, err := a.Srv().Store.Channel().GetFileCount(channelID)
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlChannelStore.GetFileCount", "app.channel.get_file_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (a *App) GetChannelGuestCount(channelID string) (int64, *model.AppError) {
|
||||
count, err := a.Srv().Store.Channel().GetGuestCount(channelID, true)
|
||||
if err != nil {
|
||||
|
||||
@@ -4890,6 +4890,28 @@ func (a *OpenTracingAppLayer) GetChannelCounts(teamID string, userID string) (*m
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) GetChannelFileCount(channelID string) (int64, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelFileCount")
|
||||
|
||||
a.ctx = newCtx
|
||||
a.app.Srv().Store.SetContext(newCtx)
|
||||
defer func() {
|
||||
a.app.Srv().Store.SetContext(origCtx)
|
||||
a.ctx = origCtx
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
resultVar0, resultVar1 := a.app.GetChannelFileCount(channelID)
|
||||
|
||||
if resultVar1 != nil {
|
||||
span.LogFields(spanlog.Error(resultVar1))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetChannelGroupUsers")
|
||||
|
||||
Ссылка в новой задаче
Block a user