Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate preview on mail creation / update #316

Merged
merged 6 commits into from
Apr 15, 2021
Merged

Conversation

deelanM
Copy link
Collaborator

@deelanM deelanM commented Apr 12, 2021

@deelanM deelanM changed the title WIP : generate preview on mail creation / update Generate preview on mail creation / update Apr 13, 2021

// not awaited on purpose
mailingService.generateMailingPreview(mailingId, req.cookies);

res.json(mailingForMosaico);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you must send the response before the preview

@@ -156,6 +158,9 @@ async function createInsideWorkspaceOrFolder(mailingData) {

const newMailing = await createMailing(mailing);

// not awaited on purpose
generateMailingPreview(newMailing._id, cookies);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to not add this logique in this service but to call preview generation directly in controller

const stream = await fs.createReadStream(file.path);

if (config.isAws) {
const prefix = `groups/${_company}/mailings/${mailingId}/preview`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefix must be use also without aws, generation must be store in folder

}
)
.on('httpUploadProgress', (progress) => {
console.log(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change console in this file with logger

@deelanM deelanM self-assigned this Apr 13, 2021
@deelanM deelanM linked an issue Apr 13, 2021 that may be closed by this pull request
5 tasks
@deelanM deelanM merged commit d191566 into develop Apr 15, 2021
@medamineziraoui medamineziraoui deleted the generate-mail-preview branch July 23, 2021 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mailings : generate preview on mailing creation / update
3 participants