Skip to content

Commit

Permalink
馃洜 Fix typo with recent files
Browse files Browse the repository at this point in the history
  • Loading branch information
RomaricMourgues authored and Labels Bot committed Jun 2, 2022
1 parent 2e953c6 commit d278e56
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions twake/backend/node/src/services/messages/services/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ export class ViewsServiceImpl implements MessageViewsServiceAPI {

let refs = [...uploads, ...downloads];

const messageFilePromises: Promise<MessageFile & { context: MessageFileRef }>[] = refs
.map(async ref => {
const messageFilePromises: Promise<MessageFile & { context: MessageFileRef }>[] = refs.map(
async ref => {
try {
return {
...(await this.repositoryMessageFile.findOne({
Expand All @@ -334,10 +334,10 @@ export class ViewsServiceImpl implements MessageViewsServiceAPI {
} catch (e) {
return null;
}
})
.filter(a => a);
},
);

const messageFiles = await Promise.all(messageFilePromises);
const messageFiles = (await Promise.all(messageFilePromises)).filter(a => a);

const filePromises: Promise<PublicFile & { context: MessageFileRef }>[] = messageFiles
.filter(ref => ref)
Expand All @@ -355,10 +355,8 @@ export class ViewsServiceImpl implements MessageViewsServiceAPI {
} catch (e) {
return null;
}
})
.filter(a => a);

files = [...files, ...(await Promise.all(filePromises))].filter(ref => {
});
files = [...files, ...(await Promise.all(filePromises)).filter(a => a)].filter(ref => {
//Apply media filer
const isMedia =
ref.metadata?.mime?.startsWith("video/") || ref.metadata?.mime?.startsWith("image/");
Expand Down

0 comments on commit d278e56

Please sign in to comment.