Can request to delete an emoji

This commit is contained in:
2020-04-03 18:43:23 +02:00
parent d717b6f2f7
commit 527f0a838c
2 changed files with 43 additions and 4 deletions

View File

@ -72,10 +72,36 @@ class EmojiesSection {
line.innerHTML += "<td><img class='e' src='"+e.url+"' /></td>" +
"<td>"+e.shorcut+"</td>"
"<td>"+e.shorcut+"</td><td></td>"
// Add delete button
const deleteBtnTarget = line.querySelector("td:last-of-type")
const deleteButtonLink = createElem2({
appendTo: deleteBtnTarget,
type: "a",
innerHTML: "<i class='fa fa-trash'></i>"
});
deleteButtonLink.addEventListener("click", () => {
ComunicWeb.common.messages.confirm("Do you really want to delete this emoji ?", async (confirm) => {
if(!confirm)
return;
try {
await SettingsInterface.deleteEmoji(e.id)
this.RefreshList(target);
} catch(e) {
console.error(e);
notify("Could not delete emoji!", "danger")
}
})
})
}
} catch (error) {
@ -179,7 +205,7 @@ class EmojiesSection {
fd.append("shorcut", shorcut)
fd.append("image", associatedImage.files[0])
await ComunicWeb.components.settings.interface.uploadEmoji(fd)
await SettingsInterface.uploadEmoji(fd)
cb()