Commit 549378f8 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #18927 TIME 0:21 send signed attachments if exist

parent a6b22646
......@@ -15,3 +15,4 @@ modules/content_management/dist/lib/httpclient-cache-4.5.2.jar
modules/content_management/dist/lib/httpclient-win-4.5.2.jar
modules/content_management/dist/lib/httpcore-4.4.4.jar
modules/content_management/dist/lib/plugin.jar
node_modules/
......@@ -15,6 +15,6 @@
<img src="assets/spinner.gif"/>
</div>
</app-root>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.5c3031e218692f558695.js" type="module"></script><script src="main-es5.5c3031e218692f558695.js" nomodule defer></script></body>
<script src="runtime-es2015.4ac42fef445445e6f3d0.js" type="module"></script><script src="runtime-es5.4ac42fef445445e6f3d0.js" nomodule defer></script><script src="polyfills-es5.8c2a86db22bc37211976.js" nomodule defer></script><script src="polyfills-es2015.f8f86766446f4344eec7.js" type="module"></script><script src="scripts.3f995a62571f9f668311.js" defer></script><script src="main-es2015.5246fabf34b60f6094b0.js" type="module"></script><script src="main-es5.5246fabf34b60f6094b0.js" nomodule defer></script></body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -157,6 +157,16 @@ export class MailEditorComponent implements OnInit, OnDestroy {
this.setDefaultInfoFromResource();
}
for (let i = 0; i < this.emailAttachTool.attachments.list.length; i ++) {
await this.getSignedAttachment(this.emailAttachTool.attachments.list[i].id)
}
this.emailAttach.attachments.forEach((element: any, index: number) => {
const attach: any = this.emailAttachTool.attachments.list.find((item: any) => item.id === element.id || item.signedResponse === element.id);
this.emailAttach.attachments[index].format = attach.status === 'SIGN' ? 'pdf' : attach.format;
this.emailAttach.attachments[index].size = attach.size;
});
this.initEmailModelsList();
}
......@@ -310,6 +320,21 @@ export class MailEditorComponent implements OnInit, OnDestroy {
}
});
await this.getAttachElements(false);
const attachIds: number[] = this.emailAttachTool.attachments.list.map((item: any) => item.id);
this.emailAttach.attachments.forEach((element: any, index: number) => {
if (attachIds.indexOf(element.id) > -1) {
const attachment: any = this.emailAttachTool.attachments.list.find((item: any) => item.id === element.id);
this.emailAttach.attachments[index] = {
id: attachment.id,
format: attachment.format,
label: attachment.label,
original: attachment.original,
size: attachment.size
}
}
});
await this.getAttachElements(false);
resolve(true);
}),
catchError((err) => {
......@@ -445,7 +470,7 @@ export class MailEditorComponent implements OnInit, OnDestroy {
if (type === 'document') {
return this.emailAttach.document.isLinked;
} else {
return this.emailAttach[type].filter((attach: any) => attach.id === item.id).length > 0;
return this.emailAttach[type].filter((attach: any) => attach.id === item.id || item.signedResponse === attach.id).length > 0;
}
}
......@@ -897,7 +922,12 @@ export class MailEditorComponent implements OnInit, OnDestroy {
});
}
saveDraft() {
async saveDraft() {
for (let i = 0; i < this.emailAttach.attachments.length; i++) {
await this.getSignedAttachment(this.emailAttach.attachments[i].id);
this.emailAttach.attachments[i].id = this.signedAttachId !== null ? this.signedAttachId : this.emailAttach.attachments[i].id;
this.emailAttach.attachments[i].original = this.signedAttachId !== null;
}
return new Promise(async (resolve) => {
if (!this.readonly && !this.functions.empty(tinymce.get('emailSignature').getContent())) {
this.emailStatus = 'DRAFT';
......@@ -958,7 +988,7 @@ export class MailEditorComponent implements OnInit, OnDestroy {
objAttach[element] = this.emailAttach[element].map((item: any) => item.id);
} else {
objAttach[element] = this.emailAttach[element].map((item: any) => ({
id: element === 'attachments' && this.signedAttachId !== null ? this.signedAttachId : item.id,
id: item.id,
original: item.original
}));
}
......@@ -1036,6 +1066,11 @@ export class MailEditorComponent implements OnInit, OnDestroy {
tap((data: any) => {
if (!this.functions.empty(data.signedResponse)) {
this.signedAttachId = data.signedResponse;
this.emailAttachTool.attachments.list.find((item: any) => item.id === id).signedResponse = data.signedResponse;
const attach: any = this.emailAttach.attachments.find((item: any) => item.id === id)
if (attach !== undefined) {
this.emailAttach.attachments.find((item: any) => item.id === id).signedResponse = data.signedResponse;
}
} else {
this.signedAttachId = null;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment