Add context menu to clear channel history

This commit is contained in:
Pavel Djundik 2020-01-30 10:57:38 +02:00
parent eb7f9ab298
commit 7216b8124b
2 changed files with 22 additions and 0 deletions

View File

@ -349,6 +349,7 @@ p {
.context-menu-action-voice::before { content: "\f067"; /* http://fontawesome.io/icon/plus/ */ }
.context-menu-network::before { content: "\f233"; /* https://fontawesome.com/icons/server?style=solid */ }
.context-menu-edit::before { content: "\f303"; /* https://fontawesome.com/icons/pencil-alt?style=solid */ }
.context-menu-clear-history::before { content: "\f1f8"; /* https://fontawesome.com/icons/trash?style=solid */ }
.channel-list-item .not-secure-icon::before {
content: "\f071"; /* https://fontawesome.com/icons/exclamation-triangle?style=solid */

View File

@ -129,6 +129,27 @@ export function generateChannelContextMenu($root, channel, network) {
});
}
if (channel.type === "channel" || channel.type === "query") {
items.push({
label: "Clear history",
type: "item",
class: "clear-history",
action() {
// TODO: Confirmation window
channel.messages = [];
channel.unread = 0;
channel.highlight = 0;
channel.firstUnread = 0;
channel.moreHistoryAvailable = false;
socket.emit("history:clear", {
target: channel.id,
});
},
});
}
// Add close menu item
items.push({
label: closeMap[channel.type],