Emit an event to clear history on all open clients
This commit is contained in:
parent
44a8925b8c
commit
c463d1ddd3
@ -147,12 +147,6 @@ export function generateChannelContextMenu($root, channel, network) {
|
||||
return;
|
||||
}
|
||||
|
||||
channel.messages = [];
|
||||
channel.unread = 0;
|
||||
channel.highlight = 0;
|
||||
channel.firstUnread = 0;
|
||||
channel.moreHistoryAvailable = false;
|
||||
|
||||
socket.emit("history:clear", {
|
||||
target: channel.id,
|
||||
});
|
||||
|
14
client/js/socket-events/history_clear.js
Normal file
14
client/js/socket-events/history_clear.js
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
import socket from "../socket";
|
||||
import store from "../store";
|
||||
|
||||
socket.on("history:clear", function(data) {
|
||||
const {channel} = store.getters.findChannel(data.target);
|
||||
|
||||
channel.messages = [];
|
||||
channel.unread = 0;
|
||||
channel.highlight = 0;
|
||||
channel.firstUnread = 0;
|
||||
channel.moreHistoryAvailable = false;
|
||||
});
|
@ -23,3 +23,4 @@ import "./sessions_list";
|
||||
import "./configuration";
|
||||
import "./changelog";
|
||||
import "./setting";
|
||||
import "./history_clear";
|
||||
|
@ -514,6 +514,10 @@ Client.prototype.clearHistory = function(data) {
|
||||
target.chan.highlight = 0;
|
||||
target.chan.firstUnread = 0;
|
||||
|
||||
client.emit("history:clear", {
|
||||
target: target.chan.id,
|
||||
});
|
||||
|
||||
if (!target.chan.isLoggable()) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user