Move cluster, webhub and store out of Server (#20899)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
203df2f537
Коммит
5e69c6b02f
@@ -99,7 +99,7 @@ func (a *App) ListAutocompleteCommands(teamID string, T i18n.TranslateFunc) ([]*
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.EnableCommands {
|
||||
teamCmds, err := a.Srv().Store.Command().GetByTeam(teamID)
|
||||
teamCmds, err := a.Srv().Store().Command().GetByTeam(teamID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("ListAutocompleteCommands", "app.command.listautocompletecommands.internal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func (a *App) ListTeamCommands(teamID string) ([]*model.Command, *model.AppError
|
||||
return nil, model.NewAppError("ListTeamCommands", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
teamCmds, err := a.Srv().Store.Command().GetByTeam(teamID)
|
||||
teamCmds, err := a.Srv().Store().Command().GetByTeam(teamID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("ListTeamCommands", "app.command.listteamcommands.internal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -162,7 +162,7 @@ func (a *App) ListAllCommands(teamID string, T i18n.TranslateFunc) ([]*model.Com
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.EnableCommands {
|
||||
teamCmds, err := a.Srv().Store.Command().GetByTeam(teamID)
|
||||
teamCmds, err := a.Srv().Store().Command().GetByTeam(teamID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("ListAllCommands", "app.command.listallcommands.internal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -248,7 +248,7 @@ func (a *App) MentionsToTeamMembers(c request.CTX, message, teamID string) model
|
||||
wg.Add(1)
|
||||
go func(mention string) {
|
||||
defer wg.Done()
|
||||
user, nErr := a.Srv().Store.User().GetByUsername(mention)
|
||||
user, nErr := a.Srv().Store().User().GetByUsername(mention)
|
||||
|
||||
var nfErr *store.ErrNotFound
|
||||
if nErr != nil && !errors.As(nErr, &nfErr) {
|
||||
@@ -261,7 +261,7 @@ func (a *App) MentionsToTeamMembers(c request.CTX, message, teamID string) model
|
||||
if nErr != nil {
|
||||
trimmed, ok := trimUsernameSpecialChar(mention)
|
||||
for ; ok; trimmed, ok = trimUsernameSpecialChar(trimmed) {
|
||||
userFromTrimmed, nErr := a.Srv().Store.User().GetByUsername(trimmed)
|
||||
userFromTrimmed, nErr := a.Srv().Store().User().GetByUsername(trimmed)
|
||||
if nErr != nil && !errors.As(nErr, &nfErr) {
|
||||
return
|
||||
}
|
||||
@@ -370,26 +370,26 @@ func (a *App) tryExecuteCustomCommand(c request.CTX, args *model.CommandArgs, tr
|
||||
|
||||
chanChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
channel, err := a.Srv().Store.Channel().Get(args.ChannelId, true)
|
||||
channel, err := a.Srv().Store().Channel().Get(args.ChannelId, true)
|
||||
chanChan <- store.StoreResult{Data: channel, NErr: err}
|
||||
close(chanChan)
|
||||
}()
|
||||
|
||||
teamChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
team, err := a.Srv().Store.Team().Get(args.TeamId)
|
||||
team, err := a.Srv().Store().Team().Get(args.TeamId)
|
||||
teamChan <- store.StoreResult{Data: team, NErr: err}
|
||||
close(teamChan)
|
||||
}()
|
||||
|
||||
userChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
user, err := a.Srv().Store.User().Get(context.Background(), args.UserId)
|
||||
user, err := a.Srv().Store().User().Get(context.Background(), args.UserId)
|
||||
userChan <- store.StoreResult{Data: user, NErr: err}
|
||||
close(userChan)
|
||||
}()
|
||||
|
||||
teamCmds, err := a.Srv().Store.Command().GetByTeam(args.TeamId)
|
||||
teamCmds, err := a.Srv().Store().Command().GetByTeam(args.TeamId)
|
||||
if err != nil {
|
||||
return nil, nil, model.NewAppError("tryExecuteCustomCommand", "app.command.tryexecutecustomcommand.internal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -638,7 +638,7 @@ func (a *App) CreateCommand(cmd *model.Command) (*model.Command, *model.AppError
|
||||
func (a *App) createCommand(cmd *model.Command) (*model.Command, *model.AppError) {
|
||||
cmd.Trigger = strings.ToLower(cmd.Trigger)
|
||||
|
||||
teamCmds, err := a.Srv().Store.Command().GetByTeam(cmd.TeamId)
|
||||
teamCmds, err := a.Srv().Store().Command().GetByTeam(cmd.TeamId)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("CreateCommand", "app.command.createcommand.internal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -656,7 +656,7 @@ func (a *App) createCommand(cmd *model.Command) (*model.Command, *model.AppError
|
||||
}
|
||||
}
|
||||
|
||||
command, nErr := a.Srv().Store.Command().Save(cmd)
|
||||
command, nErr := a.Srv().Store().Command().Save(cmd)
|
||||
if nErr != nil {
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
@@ -675,7 +675,7 @@ func (a *App) GetCommand(commandID string) (*model.Command, *model.AppError) {
|
||||
return nil, model.NewAppError("GetCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
command, err := a.Srv().Store.Command().Get(commandID)
|
||||
command, err := a.Srv().Store().Command().Get(commandID)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
@@ -703,7 +703,7 @@ func (a *App) UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command,
|
||||
updatedCmd.PluginId = oldCmd.PluginId
|
||||
updatedCmd.TeamId = oldCmd.TeamId
|
||||
|
||||
command, err := a.Srv().Store.Command().Update(updatedCmd)
|
||||
command, err := a.Srv().Store().Command().Update(updatedCmd)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
var appErr *model.AppError
|
||||
@@ -723,7 +723,7 @@ func (a *App) UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command,
|
||||
func (a *App) MoveCommand(team *model.Team, command *model.Command) *model.AppError {
|
||||
command.TeamId = team.Id
|
||||
|
||||
_, err := a.Srv().Store.Command().Update(command)
|
||||
_, err := a.Srv().Store().Command().Update(command)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
var appErr *model.AppError
|
||||
@@ -747,7 +747,7 @@ func (a *App) RegenCommandToken(cmd *model.Command) (*model.Command, *model.AppE
|
||||
|
||||
cmd.Token = model.NewId()
|
||||
|
||||
command, err := a.Srv().Store.Command().Update(cmd)
|
||||
command, err := a.Srv().Store().Command().Update(cmd)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
var appErr *model.AppError
|
||||
@@ -769,7 +769,7 @@ func (a *App) DeleteCommand(commandID string) *model.AppError {
|
||||
return model.NewAppError("DeleteCommand", "api.command.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
err := a.Srv().Store.Command().Delete(commandID, model.GetMillis())
|
||||
err := a.Srv().Store().Command().Delete(commandID, model.GetMillis())
|
||||
if err != nil {
|
||||
return model.NewAppError("DeleteCommand", "app.command.deletecommand.internal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user