mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-13 11:31:41 +00:00
when joining a server, show default channel.
This commit is contained in:
parent
e85d30dbdc
commit
f2d50e1b7a
5 changed files with 39 additions and 7 deletions
|
|
@ -153,7 +153,10 @@ export default {
|
|||
if (event.target.classList.contains("button-clicked")) return;
|
||||
event.target.classList.add("button-clicked");
|
||||
const { ok, error, result } = await ServerService.joinServer(
|
||||
this.inviteCode
|
||||
this.inviteCode,
|
||||
{
|
||||
socketID: this.$socket.id
|
||||
}
|
||||
);
|
||||
if (ok) {
|
||||
this.closeMenu();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {bus} from '@/main'
|
||||
import Spinner from "@/components/Spinner";
|
||||
import ServerService from "@/services/ServerService";
|
||||
import config from "@/config.js";
|
||||
|
|
@ -48,7 +49,9 @@ export default {
|
|||
if (this.joinClicked|| this.joined) return;
|
||||
this.joinClicked = true;
|
||||
|
||||
const { ok, error, result } = await ServerService.joinServerById(this.server.server.server_id);
|
||||
const { ok, error, result } = await ServerService.joinServerById(this.server.server.server_id, {
|
||||
socketID: this.$socket.id
|
||||
});
|
||||
if (ok) {
|
||||
this.joinClicked = false;
|
||||
}
|
||||
|
|
@ -57,6 +60,9 @@ export default {
|
|||
computed: {
|
||||
joined() {
|
||||
return this.$store.getters["servers/servers"][this.server.server.server_id];
|
||||
},
|
||||
channels() {
|
||||
return this.$store.getters.channels;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ export default {
|
|||
getInviteDetail (inviteCode) {
|
||||
return wrapper (instance().get(`/servers/invite/${inviteCode}`))
|
||||
},
|
||||
joinServer (inviteCode) {
|
||||
return wrapper (instance().post(`/servers/invite/${inviteCode}`))
|
||||
joinServer (inviteCode, optionalData) {
|
||||
return wrapper (instance().post(`/servers/invite/${inviteCode}`, optionalData))
|
||||
},
|
||||
joinServerById (server_id) {
|
||||
return wrapper (instance().post(`/servers/invite/servers/${server_id}`))
|
||||
joinServerById (server_id, optionalData) {
|
||||
return wrapper (instance().post(`/servers/invite/servers/${server_id}`, optionalData))
|
||||
},
|
||||
leaveServer (serverID) {
|
||||
return wrapper (instance().delete(`/servers/${serverID}`))
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ const actions = {
|
|||
|
||||
const channels = server.channels;
|
||||
|
||||
|
||||
for (let index = 0; index < channels.length; index++) {
|
||||
const element = channels[index];
|
||||
element.server = undefined;
|
||||
|
|
@ -255,6 +256,14 @@ const actions = {
|
|||
channelsIDs: [element.channelID]
|
||||
});
|
||||
}
|
||||
|
||||
if (!server.socketID) return;
|
||||
if (this._vm.$socket.id !== server.socketID) return;
|
||||
const defaultChannel = channels.find(c => c.channelID === server.default_channel_id)
|
||||
bus.$emit('changeTab', 2)
|
||||
context.dispatch('servers/setSelectedServerID', server.server_id, {root: true})
|
||||
context.dispatch('openChannel', defaultChannel, {root: true})
|
||||
|
||||
|
||||
},
|
||||
['socket_server:leave'](context, {server_id}) {
|
||||
|
|
|
|||
|
|
@ -14,12 +14,26 @@
|
|||
|
||||
const config = [
|
||||
|
||||
{
|
||||
version: 7.1,
|
||||
title: "TODO: UPDATE ME",
|
||||
shortTitle: "",
|
||||
date: "19/09/2019",
|
||||
headColor: "rgba(25, 130, 255, 0.77)",
|
||||
new: [
|
||||
"When joining a server, the tabs should change to servers and default channel should open up.",
|
||||
"Swapped the changelog and the explore tab."
|
||||
],
|
||||
fix: [
|
||||
'Fixed a bug where edit and delete buttons would show for all members.',
|
||||
'Fixed a bug where when clicking on "message" in the server tab, in someones profile, the tab wouldnt change to dm.'
|
||||
],
|
||||
},
|
||||
{
|
||||
version: 7.0,
|
||||
title: "Nertivia now starts up when you get on your PC!",
|
||||
shortTitle: "",
|
||||
date: "13/09/2019",
|
||||
headColor: "rgba(25, 130, 255, 0.77)",
|
||||
new: [
|
||||
'Nertivia app now starts up when you start your pc. You can change the behaviour in the settings.',
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue