Fix removing networks

This commit is contained in:
Pavel Djundik 2019-11-02 21:06:34 +02:00
parent c8b22b2df3
commit c4d6afe3d6
2 changed files with 14 additions and 12 deletions

View File

@ -46,22 +46,11 @@ export default {
}, },
methods: { methods: {
close() { close() {
let cmd = "/close";
if (this.channel.type === "lobby") {
cmd = "/quit";
// eslint-disable-next-line no-alert
if (!confirm(`Are you sure you want to remove ${this.channel.name}?`)) {
return false;
}
}
this.closed = true; this.closed = true;
socket.emit("input", { socket.emit("input", {
target: Number(this.channel.id), target: Number(this.channel.id),
text: cmd, text: "/close",
}); });
}, },
getAriaLabel() { getAriaLabel() {

View File

@ -42,11 +42,13 @@
@click.stop="$emit('toggleJoinChannel')" @click.stop="$emit('toggleJoinChannel')"
/> />
</span> </span>
<button class="close" hidden @click="close" />
</ChannelWrapper> </ChannelWrapper>
</template> </template>
<script> <script>
import ChannelWrapper from "./ChannelWrapper.vue"; import ChannelWrapper from "./ChannelWrapper.vue";
import socket from "../js/socket";
const storage = require("../js/localStorage"); const storage = require("../js/localStorage");
export default { export default {
@ -68,6 +70,17 @@ export default {
}, },
}, },
methods: { methods: {
close() {
// eslint-disable-next-line no-alert
if (!confirm(`Are you sure you want to remove ${this.channel.name}?`)) {
return false;
}
socket.emit("input", {
target: Number(this.channel.id),
text: "/quit",
});
},
onCollapseClick() { onCollapseClick() {
const networks = new Set(JSON.parse(storage.get("thelounge.networks.collapsed"))); const networks = new Set(JSON.parse(storage.get("thelounge.networks.collapsed")));
this.network.isCollapsed = !this.network.isCollapsed; this.network.isCollapsed = !this.network.isCollapsed;