mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-24 17:11:43 +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;
|
if (event.target.classList.contains("button-clicked")) return;
|
||||||
event.target.classList.add("button-clicked");
|
event.target.classList.add("button-clicked");
|
||||||
const { ok, error, result } = await ServerService.joinServer(
|
const { ok, error, result } = await ServerService.joinServer(
|
||||||
this.inviteCode
|
this.inviteCode,
|
||||||
|
{
|
||||||
|
socketID: this.$socket.id
|
||||||
|
}
|
||||||
);
|
);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
this.closeMenu();
|
this.closeMenu();
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {bus} from '@/main'
|
||||||
import Spinner from "@/components/Spinner";
|
import Spinner from "@/components/Spinner";
|
||||||
import ServerService from "@/services/ServerService";
|
import ServerService from "@/services/ServerService";
|
||||||
import config from "@/config.js";
|
import config from "@/config.js";
|
||||||
|
|
@ -48,7 +49,9 @@ export default {
|
||||||
if (this.joinClicked|| this.joined) return;
|
if (this.joinClicked|| this.joined) return;
|
||||||
this.joinClicked = true;
|
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) {
|
if (ok) {
|
||||||
this.joinClicked = false;
|
this.joinClicked = false;
|
||||||
}
|
}
|
||||||
|
|
@ -57,6 +60,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
joined() {
|
joined() {
|
||||||
return this.$store.getters["servers/servers"][this.server.server.server_id];
|
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) {
|
getInviteDetail (inviteCode) {
|
||||||
return wrapper (instance().get(`/servers/invite/${inviteCode}`))
|
return wrapper (instance().get(`/servers/invite/${inviteCode}`))
|
||||||
},
|
},
|
||||||
joinServer (inviteCode) {
|
joinServer (inviteCode, optionalData) {
|
||||||
return wrapper (instance().post(`/servers/invite/${inviteCode}`))
|
return wrapper (instance().post(`/servers/invite/${inviteCode}`, optionalData))
|
||||||
},
|
},
|
||||||
joinServerById (server_id) {
|
joinServerById (server_id, optionalData) {
|
||||||
return wrapper (instance().post(`/servers/invite/servers/${server_id}`))
|
return wrapper (instance().post(`/servers/invite/servers/${server_id}`, optionalData))
|
||||||
},
|
},
|
||||||
leaveServer (serverID) {
|
leaveServer (serverID) {
|
||||||
return wrapper (instance().delete(`/servers/${serverID}`))
|
return wrapper (instance().delete(`/servers/${serverID}`))
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,7 @@ const actions = {
|
||||||
|
|
||||||
const channels = server.channels;
|
const channels = server.channels;
|
||||||
|
|
||||||
|
|
||||||
for (let index = 0; index < channels.length; index++) {
|
for (let index = 0; index < channels.length; index++) {
|
||||||
const element = channels[index];
|
const element = channels[index];
|
||||||
element.server = undefined;
|
element.server = undefined;
|
||||||
|
|
@ -256,6 +257,14 @@ const actions = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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}) {
|
['socket_server:leave'](context, {server_id}) {
|
||||||
context.dispatch('servers/removePresences', server_id);
|
context.dispatch('servers/removePresences', server_id);
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,26 @@
|
||||||
|
|
||||||
const config = [
|
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,
|
version: 7.0,
|
||||||
title: "Nertivia now starts up when you get on your PC!",
|
title: "Nertivia now starts up when you get on your PC!",
|
||||||
shortTitle: "",
|
shortTitle: "",
|
||||||
date: "13/09/2019",
|
date: "13/09/2019",
|
||||||
headColor: "rgba(25, 130, 255, 0.77)",
|
|
||||||
new: [
|
new: [
|
||||||
'Nertivia app now starts up when you start your pc. You can change the behaviour in the settings.',
|
'Nertivia app now starts up when you start your pc. You can change the behaviour in the settings.',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue