mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 18:08:50 +00:00
Can request to delete an emoji
This commit is contained in:
parent
d717b6f2f7
commit
527f0a838c
@ -4,7 +4,7 @@
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.settings.interface = {
|
||||
const SettingsInterface = {
|
||||
|
||||
/**
|
||||
* Get general account settings
|
||||
@ -175,4 +175,17 @@ ComunicWeb.components.settings.interface = {
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a custom emoji
|
||||
*
|
||||
* @param {Number} id The ID of the emoji to delete
|
||||
*/
|
||||
deleteEmoji: async function(id) {
|
||||
await api("settings/delete_custom_emoji", {
|
||||
emojiID: id
|
||||
}, true);
|
||||
},
|
||||
}
|
||||
|
||||
ComunicWeb.components.settings.interface = SettingsInterface;
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user