Update TypeScript to support new sharing feature

This commit is contained in:
Andreas Nedbal 2023-02-05 19:36:28 +01:00 committed by Andreas Nedbal
parent 7589d66686
commit a4195a158f
1 changed files with 9 additions and 9 deletions

View File

@ -9,16 +9,9 @@ export function answerEntryHandler(event: Event): void {
element.disabled = true;
const shareTo = [];
inboxEntry.querySelectorAll('input[type=checkbox][name=ib-share]:checked')
.forEach((element: HTMLInputElement) => {
shareTo.push(element.getAttribute('data-service'));
});
const data = {
id: element.getAttribute('data-ib-id'),
answer: inboxEntry.querySelector<HTMLInputElement>('textarea[name=ib-answer]')?.value,
share: JSON.stringify(shareTo),
inbox: 'true'
};
@ -36,7 +29,14 @@ export function answerEntryHandler(event: Event): void {
}
updateDeleteButton(false);
showNotification(data.message);
const sharing = inboxEntry.querySelector<HTMLElement>('.inbox-entry__sharing');
if (sharing != null) {
sharing.dataset.inboxSharingConfigValue = JSON.stringify(data.sharing);
}
else {
(inboxEntry as HTMLElement).remove();
}
})
.catch(err => {
console.log(err);