Fix /collapse and /expand from interacting with the server in public mode (#4488)
Reported by xnaas on IRC
This commit is contained in:
parent
66455f2c40
commit
551f85ea51
@ -22,7 +22,7 @@ function input() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tell the server we're toggling so it remembers at page reload
|
// Tell the server we're toggling so it remembers at page reload
|
||||||
if (messageIds.length > 0) {
|
if (!document.body.classList.contains("public") && messageIds.length > 0) {
|
||||||
socket.emit("msg:preview:toggle", {
|
socket.emit("msg:preview:toggle", {
|
||||||
target: store.state.activeChannel.channel.id,
|
target: store.state.activeChannel.channel.id,
|
||||||
messageIds: messageIds,
|
messageIds: messageIds,
|
||||||
|
@ -22,7 +22,7 @@ function input() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tell the server we're toggling so it remembers at page reload
|
// Tell the server we're toggling so it remembers at page reload
|
||||||
if (messageIds.length > 0) {
|
if (!document.body.classList.contains("public") && messageIds.length > 0) {
|
||||||
socket.emit("msg:preview:toggle", {
|
socket.emit("msg:preview:toggle", {
|
||||||
target: store.state.activeChannel.channel.id,
|
target: store.state.activeChannel.channel.id,
|
||||||
messageIds: messageIds,
|
messageIds: messageIds,
|
||||||
|
@ -503,8 +503,11 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// In public mode only one client can be connected,
|
||||||
|
// so there's no need to handle msg:preview:toggle
|
||||||
|
if (!Helper.config.public) {
|
||||||
socket.on("msg:preview:toggle", (data) => {
|
socket.on("msg:preview:toggle", (data) => {
|
||||||
if (!_.isPlainObject(data)) {
|
if (_.isPlainObject(data)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,10 +523,12 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
|
|||||||
for (const msgId of data.messageIds) {
|
for (const msgId of data.messageIds) {
|
||||||
const message = networkAndChan.chan.findMessage(msgId);
|
const message = networkAndChan.chan.findMessage(msgId);
|
||||||
|
|
||||||
|
if (message) {
|
||||||
for (const preview of message.previews) {
|
for (const preview of message.previews) {
|
||||||
preview.shown = newState;
|
preview.shown = newState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -540,6 +545,7 @@ function initializeClient(socket, client, token, lastMessage, openChannel) {
|
|||||||
preview.shown = newState;
|
preview.shown = newState;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
socket.on("mentions:get", () => {
|
socket.on("mentions:get", () => {
|
||||||
socket.emit("mentions:list", client.mentions);
|
socket.emit("mentions:list", client.mentions);
|
||||||
|
Loading…
Reference in New Issue
Block a user