unparam lint (#16771)
* fixed: `identifier` is unused lint error * make saveMultipleMembersT method saveMultipleMembers Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
78ccf8a775
Коммит
a63dea6c55
@@ -808,7 +808,7 @@ func (a *App) importUserTeams(user *model.User, data *[]UserTeamImportData) *mod
|
||||
}
|
||||
}
|
||||
channelsToImport := channels[team.Id]
|
||||
if err := a.importUserChannels(user, team, teamMemberByTeamID[team.Id], &channelsToImport); err != nil {
|
||||
if err := a.importUserChannels(user, team, &channelsToImport); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -816,7 +816,7 @@ func (a *App) importUserTeams(user *model.User, data *[]UserTeamImportData) *mod
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) importUserChannels(user *model.User, team *model.Team, teamMember *model.TeamMember, data *[]UserChannelImportData) *model.AppError {
|
||||
func (a *App) importUserChannels(user *model.User, team *model.Team, data *[]UserChannelImportData) *model.AppError {
|
||||
if data == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -986,7 +986,7 @@ func (a *App) importUserChannels(user *model.User, team *model.Team, teamMember
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) importReaction(data *ReactionImportData, post *model.Post, dryRun bool) *model.AppError {
|
||||
func (a *App) importReaction(data *ReactionImportData, post *model.Post) *model.AppError {
|
||||
if err := validateReactionImportData(data, post.CreateAt); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ func (a *App) importReaction(data *ReactionImportData, post *model.Post, dryRun
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) importReplies(data []ReplyImportData, post *model.Post, teamId string, dryRun bool) *model.AppError {
|
||||
func (a *App) importReplies(data []ReplyImportData, post *model.Post, teamId string) *model.AppError {
|
||||
var err *model.AppError
|
||||
usernames := []string{}
|
||||
for _, replyData := range data {
|
||||
@@ -1064,7 +1064,7 @@ func (a *App) importReplies(data []ReplyImportData, post *model.Post, teamId str
|
||||
reply.Message = *replyData.Message
|
||||
reply.CreateAt = *replyData.CreateAt
|
||||
|
||||
fileIds, err := a.uploadAttachments(replyData.Attachments, reply, teamId, dryRun)
|
||||
fileIds, err := a.uploadAttachments(replyData.Attachments, reply, teamId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ func (a *App) importReplies(data []ReplyImportData, post *model.Post, teamId str
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) importAttachment(data *AttachmentImportData, post *model.Post, teamId string, dryRun bool) (*model.FileInfo, *model.AppError) {
|
||||
func (a *App) importAttachment(data *AttachmentImportData, post *model.Post, teamId string) (*model.FileInfo, *model.AppError) {
|
||||
file, err := os.Open(*data.Path)
|
||||
if file == nil || err != nil {
|
||||
return nil, model.NewAppError("BulkImport", "app.import.attachment.bad_file.error", map[string]interface{}{"FilePath": *data.Path}, "", http.StatusBadRequest)
|
||||
@@ -1319,7 +1319,7 @@ func (a *App) importMultiplePostLines(lines []LineImportWorkerData, dryRun bool)
|
||||
post.Props = *line.Post.Props
|
||||
}
|
||||
|
||||
fileIds, appErr := a.uploadAttachments(line.Post.Attachments, post, team.Id, dryRun)
|
||||
fileIds, appErr := a.uploadAttachments(line.Post.Attachments, post, team.Id)
|
||||
if appErr != nil {
|
||||
return line.LineNumber, appErr
|
||||
}
|
||||
@@ -1403,14 +1403,14 @@ func (a *App) importMultiplePostLines(lines []LineImportWorkerData, dryRun bool)
|
||||
if postWithData.postData.Reactions != nil {
|
||||
for _, reaction := range *postWithData.postData.Reactions {
|
||||
reaction := reaction
|
||||
if err := a.importReaction(&reaction, postWithData.post, dryRun); err != nil {
|
||||
if err := a.importReaction(&reaction, postWithData.post); err != nil {
|
||||
return postWithData.lineNumber, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if postWithData.postData.Replies != nil && len(*postWithData.postData.Replies) > 0 {
|
||||
err := a.importReplies(*postWithData.postData.Replies, postWithData.post, postWithData.team.Id, dryRun)
|
||||
err := a.importReplies(*postWithData.postData.Replies, postWithData.post, postWithData.team.Id)
|
||||
if err != nil {
|
||||
return postWithData.lineNumber, err
|
||||
}
|
||||
@@ -1421,14 +1421,14 @@ func (a *App) importMultiplePostLines(lines []LineImportWorkerData, dryRun bool)
|
||||
}
|
||||
|
||||
// uploadAttachments imports new attachments and returns current attachments of the post as a map
|
||||
func (a *App) uploadAttachments(attachments *[]AttachmentImportData, post *model.Post, teamId string, dryRun bool) (map[string]bool, *model.AppError) {
|
||||
func (a *App) uploadAttachments(attachments *[]AttachmentImportData, post *model.Post, teamId string) (map[string]bool, *model.AppError) {
|
||||
if attachments == nil {
|
||||
return nil, nil
|
||||
}
|
||||
fileIds := make(map[string]bool)
|
||||
for _, attachment := range *attachments {
|
||||
attachment := attachment
|
||||
fileInfo, err := a.importAttachment(&attachment, post, teamId, dryRun)
|
||||
fileInfo, err := a.importAttachment(&attachment, post, teamId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1473,7 +1473,7 @@ func (a *App) importDirectChannel(data *DirectChannelImportData, dryRun bool) *m
|
||||
}
|
||||
channel = ch
|
||||
} else {
|
||||
ch, err := a.createGroupChannel(userIds, userIds[0])
|
||||
ch, err := a.createGroupChannel(userIds)
|
||||
if err != nil && err.Id != store.ChannelExistsError {
|
||||
return model.NewAppError("BulkImport", "app.import.import_direct_channel.create_group_channel.error", nil, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
@@ -1578,7 +1578,7 @@ func (a *App) importMultipleDirectPostLines(lines []LineImportWorkerData, dryRun
|
||||
}
|
||||
channel = ch
|
||||
} else {
|
||||
ch, err = a.createGroupChannel(userIds, userIds[0])
|
||||
ch, err = a.createGroupChannel(userIds)
|
||||
if err != nil && err.Id != store.ChannelExistsError {
|
||||
return line.LineNumber, model.NewAppError("BulkImport", "app.import.import_direct_post.create_group_channel.error", nil, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
@@ -1615,7 +1615,7 @@ func (a *App) importMultipleDirectPostLines(lines []LineImportWorkerData, dryRun
|
||||
post.Props = *line.DirectPost.Props
|
||||
}
|
||||
|
||||
fileIds, err := a.uploadAttachments(line.DirectPost.Attachments, post, "noteam", dryRun)
|
||||
fileIds, err := a.uploadAttachments(line.DirectPost.Attachments, post, "noteam")
|
||||
if err != nil {
|
||||
return line.LineNumber, err
|
||||
}
|
||||
@@ -1697,14 +1697,14 @@ func (a *App) importMultipleDirectPostLines(lines []LineImportWorkerData, dryRun
|
||||
if postWithData.directPostData.Reactions != nil {
|
||||
for _, reaction := range *postWithData.directPostData.Reactions {
|
||||
reaction := reaction
|
||||
if err := a.importReaction(&reaction, postWithData.post, dryRun); err != nil {
|
||||
if err := a.importReaction(&reaction, postWithData.post); err != nil {
|
||||
return postWithData.lineNumber, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if postWithData.directPostData.Replies != nil {
|
||||
if err := a.importReplies(*postWithData.directPostData.Replies, postWithData.post, "noteam", dryRun); err != nil {
|
||||
if err := a.importReplies(*postWithData.directPostData.Replies, postWithData.post, "noteam"); err != nil {
|
||||
return postWithData.lineNumber, err
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user