[MM-15925] Add includeDeleted flag to GetForPost in FileInfoStore (#11585)

Этот коммит содержится в:
Miguel de la Cruz
2019-07-15 08:54:30 +02:00
коммит произвёл GitHub
родитель c1f3c83d38
Коммит 8f4e03a52b
8 изменённых файлов: 119 добавлений и 39 удалений

Просмотреть файл

@@ -275,7 +275,7 @@ func (a *App) MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo {
if newPost := result.Posts[post.Id]; len(newPost.Filenames) != len(post.Filenames) {
// Another thread has already created FileInfos for this post, so just return those
var fileInfos []*model.FileInfo
fileInfos, err = a.Srv.Store.FileInfo().GetForPost(post.Id, true, false)
fileInfos, err = a.Srv.Store.FileInfo().GetForPost(post.Id, true, false, false)
if err != nil {
mlog.Error(fmt.Sprintf("Unable to get FileInfos for migrated post, err=%v", err), mlog.String("post_id", post.Id))
return []*model.FileInfo{}

Просмотреть файл

@@ -46,7 +46,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
if len(post.FileIds) != 0 {
fchan = make(chan store.StoreResult, 1)
go func() {
fileInfos, err := a.Srv.Store.FileInfo().GetForPost(post.Id, true, true)
fileInfos, err := a.Srv.Store.FileInfo().GetForPost(post.Id, true, false, true)
fchan <- store.StoreResult{Data: fileInfos, Err: err}
close(fchan)
}()

Просмотреть файл

@@ -289,7 +289,7 @@ func (a *App) GetMessageForNotification(post *model.Post, translateFunc i18n.Tra
}
// extract the filenames from their paths and determine what type of files are attached
infos, err := a.Srv.Store.FileInfo().GetForPost(post.Id, true, true)
infos, err := a.Srv.Store.FileInfo().GetForPost(post.Id, true, false, true)
if err != nil {
mlog.Warn(fmt.Sprintf("Encountered error when getting files for notification message, post_id=%v, err=%v", post.Id, err), mlog.String("post_id", post.Id))
}

Просмотреть файл

@@ -1087,7 +1087,7 @@ func (a *App) GetFileInfosForPostWithMigration(postId string) ([]*model.FileInfo
}
func (a *App) GetFileInfosForPost(postId string, fromMaster bool) ([]*model.FileInfo, *model.AppError) {
return a.Srv.Store.FileInfo().GetForPost(postId, fromMaster, true)
return a.Srv.Store.FileInfo().GetForPost(postId, fromMaster, false, true)
}
func (a *App) PostWithProxyAddedToImageURLs(post *model.Post) *model.Post {