[MM-56399][MM-56397][MM-56456][MM-56269] Various changes for user reporting for admins (#25839)
* [MM-56399] Add user count endpoint for reporting * [MM-56397] Added search term to user report filter * Missing translation * [MM-56456] Rename up/down to prev/next for reporting cursoring * [MM-56269] Add DeleteAt, MfaActive and AuthService fields to UserReport * PR feedback * Fix test --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bb88b92b4c
Коммит
0a4e9eeb92
@@ -838,6 +838,7 @@ type AppIface interface {
|
||||
GetUserByEmail(email string) (*model.User, *model.AppError)
|
||||
GetUserByRemoteID(remoteID string) (*model.User, *model.AppError)
|
||||
GetUserByUsername(username string) (*model.User, *model.AppError)
|
||||
GetUserCountForReport(filter *model.UserReportOptions) (*int64, *model.AppError)
|
||||
GetUserForLogin(c request.CTX, id, loginId string) (*model.User, *model.AppError)
|
||||
GetUserLimits() (*model.UserLimits, *model.AppError)
|
||||
GetUserTermsOfService(userID string) (*model.UserTermsOfService, *model.AppError)
|
||||
|
||||
@@ -10511,6 +10511,28 @@ func (a *OpenTracingAppLayer) GetUserByUsername(username string) (*model.User, *
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) GetUserCountForReport(filter *model.UserReportOptions) (*int64, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetUserCountForReport")
|
||||
|
||||
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.GetUserCountForReport(filter)
|
||||
|
||||
if resultVar1 != nil {
|
||||
span.LogFields(spanlog.Error(resultVar1))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) GetUserForLogin(c request.CTX, id string, loginId string) (*model.User, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetUserForLogin")
|
||||
|
||||
@@ -14,10 +14,6 @@ func (a *App) GetUsersForReporting(filter *model.UserReportOptions) ([]*model.Us
|
||||
return nil, appErr
|
||||
}
|
||||
|
||||
return a.getUserReport(filter)
|
||||
}
|
||||
|
||||
func (a *App) getUserReport(filter *model.UserReportOptions) ([]*model.UserReport, *model.AppError) {
|
||||
userReportQuery, err := a.Srv().Store().User().GetUserReport(filter)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetUsersForReporting", "app.report.get_user_report.store_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
@@ -30,3 +26,12 @@ func (a *App) getUserReport(filter *model.UserReportOptions) ([]*model.UserRepor
|
||||
|
||||
return userReports, nil
|
||||
}
|
||||
|
||||
func (a *App) GetUserCountForReport(filter *model.UserReportOptions) (*int64, *model.AppError) {
|
||||
count, err := a.Srv().Store().User().GetUserCountForReport(filter)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetUserCountForReport", "app.report.get_user_count_for_report.store_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
return &count, nil
|
||||
}
|
||||
|
||||
@@ -2008,6 +2008,5 @@ func TestGetUsersForReporting(t *testing.T) {
|
||||
})
|
||||
require.Nil(t, err)
|
||||
require.NotNil(t, userReports)
|
||||
require.Equal(t, "Bob Bobson", userReports[0].DisplayName)
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user