[MM-55595] Use annotated logger in search layer (#25468)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5a4dba8809
Коммит
b2ec1ff8ae
@@ -503,7 +503,7 @@ func (a *App) createDirectChannel(c request.CTX, userID string, otherUserID stri
|
||||
}
|
||||
|
||||
func (a *App) createDirectChannelWithUser(c request.CTX, user, otherUser *model.User, channelOptions ...model.ChannelOption) (*model.Channel, *model.AppError) {
|
||||
channel, nErr := a.Srv().Store().Channel().CreateDirectChannel(user, otherUser, channelOptions...)
|
||||
channel, nErr := a.Srv().Store().Channel().CreateDirectChannel(c, user, otherUser, channelOptions...)
|
||||
if nErr != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
var cErr *store.ErrConflict
|
||||
@@ -691,7 +691,7 @@ func (a *App) GetGroupChannel(c request.CTX, userIDs []string) (*model.Channel,
|
||||
|
||||
// UpdateChannel updates a given channel by its Id. It also publishes the CHANNEL_UPDATED event.
|
||||
func (a *App) UpdateChannel(c request.CTX, channel *model.Channel) (*model.Channel, *model.AppError) {
|
||||
_, err := a.Srv().Store().Channel().Update(channel)
|
||||
_, err := a.Srv().Store().Channel().Update(c, channel)
|
||||
if err != nil {
|
||||
var appErr *model.AppError
|
||||
var invErr *store.ErrInvalidInput
|
||||
@@ -1372,7 +1372,7 @@ func (a *App) UpdateChannelMemberNotifyProps(c request.CTX, data map[string]stri
|
||||
}
|
||||
|
||||
func (a *App) updateChannelMember(c request.CTX, member *model.ChannelMember) (*model.ChannelMember, *model.AppError) {
|
||||
member, err := a.Srv().Store().Channel().UpdateMember(member)
|
||||
member, err := a.Srv().Store().Channel().UpdateMember(c, member)
|
||||
if err != nil {
|
||||
var appErr *model.AppError
|
||||
var nfErr *store.ErrNotFound
|
||||
@@ -2526,7 +2526,7 @@ func (a *App) removeUserFromChannel(c request.CTX, userIDToRemove string, remove
|
||||
return err
|
||||
}
|
||||
|
||||
if err := a.Srv().Store().Channel().RemoveMember(channel.Id, userIDToRemove); err != nil {
|
||||
if err := a.Srv().Store().Channel().RemoveMember(c, channel.Id, userIDToRemove); err != nil {
|
||||
return model.NewAppError("removeUserFromChannel", "app.channel.remove_member.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
if err := a.Srv().Store().ChannelMemberHistory().LogLeaveEvent(userIDToRemove, channel.Id, model.GetMillis()); err != nil {
|
||||
@@ -2547,7 +2547,7 @@ func (a *App) removeUserFromChannel(c request.CTX, userIDToRemove string, remove
|
||||
return model.NewAppError("removeUserFromChannel", "api.team.remove_user_from_team.missing.app_error", nil, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
|
||||
if err := a.ch.srv.teamService.RemoveTeamMember(teamMember); err != nil {
|
||||
if err := a.ch.srv.teamService.RemoveTeamMember(c, teamMember); err != nil {
|
||||
return model.NewAppError("removeUserFromChannel", "api.team.remove_user_from_team.missing.app_error", nil, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -2675,7 +2675,7 @@ func (a *App) ValidateUserPermissionsOnChannels(c request.CTX, userId string, ch
|
||||
for _, channelId := range channelIds {
|
||||
channel, err := a.GetChannel(c, channelId)
|
||||
if err != nil {
|
||||
mlog.Info("Invite users to team - couldn't get channel " + channelId)
|
||||
c.Logger().Info("Invite users to team - couldn't get channel " + channelId)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -2684,7 +2684,7 @@ func (a *App) ValidateUserPermissionsOnChannels(c request.CTX, userId string, ch
|
||||
} else if channel.Type == model.ChannelTypeOpen && a.HasPermissionToChannel(c, userId, channelId, model.PermissionManagePublicChannelMembers) {
|
||||
allowedChannelIds = append(allowedChannelIds, channelId)
|
||||
} else {
|
||||
mlog.Info("Invite users to team - no permission to add members to that channel. UserId: " + userId + " ChannelId: " + channelId)
|
||||
c.Logger().Info("Invite users to team - no permission to add members to that channel. UserId: " + userId + " ChannelId: " + channelId)
|
||||
}
|
||||
}
|
||||
return allowedChannelIds
|
||||
@@ -2852,7 +2852,7 @@ func (a *App) AutocompleteChannels(c request.CTX, userID, term string) (model.Ch
|
||||
return nil, appErr
|
||||
}
|
||||
|
||||
channelList, err := a.Srv().Store().Channel().Autocomplete(userID, term, includeDeleted, user.IsGuest())
|
||||
channelList, err := a.Srv().Store().Channel().Autocomplete(c, userID, term, includeDeleted, user.IsGuest())
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("AutocompleteChannels", "app.channel.search.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -2869,7 +2869,7 @@ func (a *App) AutocompleteChannelsForTeam(c request.CTX, teamID, userID, term st
|
||||
return nil, appErr
|
||||
}
|
||||
|
||||
channelList, err := a.Srv().Store().Channel().AutocompleteInTeam(teamID, userID, term, includeDeleted, user.IsGuest())
|
||||
channelList, err := a.Srv().Store().Channel().AutocompleteInTeam(c, teamID, userID, term, includeDeleted, user.IsGuest())
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("AutocompleteChannels", "app.channel.search.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -3064,11 +3064,11 @@ func (a *App) ViewChannel(c request.CTX, view *model.ChannelView, userID string,
|
||||
}
|
||||
|
||||
func (a *App) PermanentDeleteChannel(c request.CTX, channel *model.Channel) *model.AppError {
|
||||
if err := a.Srv().Store().Post().PermanentDeleteByChannel(channel.Id); err != nil {
|
||||
if err := a.Srv().Store().Post().PermanentDeleteByChannel(c, channel.Id); err != nil {
|
||||
return model.NewAppError("PermanentDeleteChannel", "app.post.permanent_delete_by_channel.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
if err := a.Srv().Store().Channel().PermanentDeleteMembersByChannel(channel.Id); err != nil {
|
||||
if err := a.Srv().Store().Channel().PermanentDeleteMembersByChannel(c, channel.Id); err != nil {
|
||||
return model.NewAppError("PermanentDeleteChannel", "app.channel.remove_member.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -3086,7 +3086,7 @@ func (a *App) PermanentDeleteChannel(c request.CTX, channel *model.Channel) *mod
|
||||
|
||||
deleteAt := model.GetMillis()
|
||||
|
||||
if nErr := a.Srv().Store().Channel().PermanentDelete(channel.Id); nErr != nil {
|
||||
if nErr := a.Srv().Store().Channel().PermanentDelete(c, channel.Id); nErr != nil {
|
||||
return model.NewAppError("PermanentDeleteChannel", "app.channel.permanent_delete.app_error", nil, "", http.StatusInternalServerError).Wrap(nErr)
|
||||
}
|
||||
|
||||
@@ -3101,7 +3101,7 @@ func (a *App) PermanentDeleteChannel(c request.CTX, channel *model.Channel) *mod
|
||||
}
|
||||
|
||||
func (a *App) RemoveAllDeactivatedMembersFromChannel(c request.CTX, channel *model.Channel) *model.AppError {
|
||||
err := a.Srv().Store().Channel().RemoveAllDeactivatedMembers(channel.Id)
|
||||
err := a.Srv().Store().Channel().RemoveAllDeactivatedMembers(c, channel.Id)
|
||||
if err != nil {
|
||||
return model.NewAppError("RemoveAllDeactivatedMembersFromChannel", "app.channel.remove_all_deactivated_members.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
@@ -3160,7 +3160,7 @@ func (a *App) MoveChannel(c request.CTX, team *model.Team, channel *model.Channe
|
||||
}
|
||||
|
||||
channel.TeamId = team.Id
|
||||
if _, err := a.Srv().Store().Channel().Update(channel); err != nil {
|
||||
if _, err := a.Srv().Store().Channel().Update(c, channel); err != nil {
|
||||
var appErr *model.AppError
|
||||
var invErr *store.ErrInvalidInput
|
||||
switch {
|
||||
@@ -3594,7 +3594,7 @@ func (a *App) setSidebarCategoriesForConvertedGroupMessage(c request.CTX, gmConv
|
||||
})
|
||||
|
||||
if appErr != nil {
|
||||
mlog.Error("Failed to search sidebar categories for user for adding converted GM")
|
||||
c.Logger().Error("Failed to search sidebar categories for user for adding converted GM")
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -3613,7 +3613,7 @@ func (a *App) setSidebarCategoriesForConvertedGroupMessage(c request.CTX, gmConv
|
||||
channelsCategory := categories.Categories[0]
|
||||
_, appErr = a.UpdateSidebarCategories(c, user.Id, gmConversionRequest.TeamID, []*model.SidebarCategoryWithChannels{channelsCategory})
|
||||
if appErr != nil {
|
||||
mlog.Error("Failed to add converted GM to default sidebar category for user", mlog.String("user_id", user.Id), mlog.Err(err))
|
||||
c.Logger().Error("Failed to add converted GM to default sidebar category for user", mlog.String("user_id", user.Id), mlog.Err(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3708,7 +3708,7 @@ func (a *App) postMessageForConvertGroupMessageToChannel(c request.CTX, channelI
|
||||
}
|
||||
|
||||
if _, appErr := a.CreatePost(c, post, channel, false, true); appErr != nil {
|
||||
mlog.Error("Failed to create post for notifying about GM converted to private channel", mlog.Err(appErr))
|
||||
c.Logger().Error("Failed to create post for notifying about GM converted to private channel", mlog.Err(appErr))
|
||||
|
||||
return model.NewAppError(
|
||||
"postMessageForConvertGroupMessageToChannel",
|
||||
|
||||
Ссылка в новой задаче
Block a user