MM-24037 Adding getKnowUsers API endpoint (#14332)
* Adding getKnowUsers API endpoint * Adding i18n strings * Fixing golint errors * Adding doc strings * Remove debug line * Updating app_iface * Fixing gofmt
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d3b36e3455
Коммит
224b72c61e
@@ -156,6 +156,10 @@ type AppIface interface {
|
||||
GetEnvironmentConfig() map[string]interface{}
|
||||
// GetHubForUserId returns the hub for a given user id.
|
||||
GetHubForUserId(userId string) *Hub
|
||||
// GetKnownUsers returns the list of user ids of users with any direct
|
||||
// relationship with a user. That means any user sharing any channel, including
|
||||
// direct and group channels.
|
||||
GetKnownUsers(userID string) ([]string, *model.AppError)
|
||||
// GetLdapGroup retrieves a single LDAP group by the given LDAP group id.
|
||||
GetLdapGroup(ldapGroupID string) (*model.Group, *model.AppError)
|
||||
// GetMarketplacePlugins returns a list of plugins from the marketplace-server,
|
||||
|
||||
@@ -5702,6 +5702,28 @@ func (a *OpenTracingAppLayer) GetJobsPage(page int, perPage int) ([]*model.Job,
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) GetKnownUsers(userID string) ([]string, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetKnownUsers")
|
||||
|
||||
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.GetKnownUsers(userID)
|
||||
|
||||
if resultVar1 != nil {
|
||||
span.LogFields(spanlog.Error(resultVar1))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
|
||||
return resultVar0, resultVar1
|
||||
}
|
||||
|
||||
func (a *OpenTracingAppLayer) GetLatestTermsOfService() (*model.TermsOfService, *model.AppError) {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetLatestTermsOfService")
|
||||
|
||||
@@ -2083,3 +2083,10 @@ func (a *App) invalidateUserCacheAndPublish(userId string) {
|
||||
message.Add("user", user)
|
||||
a.Publish(message)
|
||||
}
|
||||
|
||||
// GetKnownUsers returns the list of user ids of users with any direct
|
||||
// relationship with a user. That means any user sharing any channel, including
|
||||
// direct and group channels.
|
||||
func (a *App) GetKnownUsers(userID string) ([]string, *model.AppError) {
|
||||
return a.Srv().Store.User().GetKnownUsers(userID)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user