2019-10-17 10:17:02 -04:00
|
|
|
<template>
|
|
|
|
<span class="inline-channel" dir="auto" role="button" tabindex="0" @click="onClick"
|
|
|
|
><slot></slot
|
|
|
|
></span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-11-16 12:24:03 -05:00
|
|
|
import socket from "../js/socket";
|
2019-11-12 10:51:40 -05:00
|
|
|
|
2019-10-17 10:17:02 -04:00
|
|
|
export default {
|
|
|
|
name: "InlineChannel",
|
|
|
|
props: {
|
|
|
|
channel: String,
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClick() {
|
2019-11-03 09:59:43 -05:00
|
|
|
const existingChannel = this.$store.getters.findChannelOnCurrentNetwork(this.channel);
|
2019-10-17 10:17:02 -04:00
|
|
|
|
|
|
|
if (existingChannel) {
|
2019-10-25 17:37:40 -04:00
|
|
|
this.$root.switchToChannel(existingChannel);
|
2019-10-17 10:17:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
socket.emit("input", {
|
2019-11-02 15:40:59 -04:00
|
|
|
target: this.$store.state.activeChannel.channel.id,
|
2019-10-17 10:17:02 -04:00
|
|
|
text: "/join " + this.channel,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|