mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-07-05 19:10:52 +00:00
socket event for drag and drop, fixed some bugs
This commit is contained in:
parent
c32fa3bfe3
commit
e94620a60d
3 changed files with 38 additions and 3 deletions
|
|
@ -128,7 +128,10 @@ export default {
|
||||||
)[serverID];
|
)[serverID];
|
||||||
const defaultChannelID = server.default_channel_id;
|
const defaultChannelID = server.default_channel_id;
|
||||||
const channels = this.$store.getters.channels;
|
const channels = this.$store.getters.channels;
|
||||||
const channel = channels[lastSelectedChannel || defaultChannelID];
|
let channel = channels[lastSelectedChannel || defaultChannelID];
|
||||||
|
if (!channel) {
|
||||||
|
channel = channels[defaultChannelID];
|
||||||
|
}
|
||||||
|
|
||||||
this.dismissNotification(channel.channelID);
|
this.dismissNotification(channel.channelID);
|
||||||
this.$store.dispatch("servers/setSelectedServerID", serverID);
|
this.$store.dispatch("servers/setSelectedServerID", serverID);
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ const actions = {
|
||||||
s.channels = [...sortedServerChannels, ...tempServerChannels];
|
s.channels = [...sortedServerChannels, ...tempServerChannels];
|
||||||
tempServerChannels = null;
|
tempServerChannels = null;
|
||||||
sortedServerChannels = null;
|
sortedServerChannels = null;
|
||||||
|
delete s.channel_position;
|
||||||
return s;
|
return s;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -190,6 +191,11 @@ const actions = {
|
||||||
context.commit("removeFriend", uniqueID);
|
context.commit("removeFriend", uniqueID);
|
||||||
},
|
},
|
||||||
socket_receiveMessage(context, data) {
|
socket_receiveMessage(context, data) {
|
||||||
|
if (data.message.type === 1) {
|
||||||
|
if (context.getters.user.uniqueID === data.message.creator.uniqueID){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (context.getters.channels[data.message.channelID]) {
|
if (context.getters.channels[data.message.channelID]) {
|
||||||
context.dispatch("updateChannelLastMessage", data.message.channelID);
|
context.dispatch("updateChannelLastMessage", data.message.channelID);
|
||||||
}
|
}
|
||||||
|
|
@ -318,7 +324,28 @@ const actions = {
|
||||||
["socket_server:joined"](context, server) {
|
["socket_server:joined"](context, server) {
|
||||||
context.dispatch("servers/setServer", server);
|
context.dispatch("servers/setServer", server);
|
||||||
|
|
||||||
const channels = server.channels;
|
let channels = server.channels;
|
||||||
|
|
||||||
|
|
||||||
|
// sort server channels by order
|
||||||
|
if(server.channel_position) {
|
||||||
|
let tempServerChannels = [...channels];
|
||||||
|
let sortedServerChannels = [];
|
||||||
|
for (let index = 0; index < server.channel_position.length; index++) {
|
||||||
|
const channelID = server.channel_position[index];
|
||||||
|
const findIndex = tempServerChannels.findIndex((c) => c.channelID == channelID );
|
||||||
|
if (tempServerChannels[findIndex]) {
|
||||||
|
sortedServerChannels = [...sortedServerChannels, ...[tempServerChannels[findIndex]]];
|
||||||
|
tempServerChannels.splice(findIndex, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
channels = [...sortedServerChannels, ...tempServerChannels];
|
||||||
|
tempServerChannels = null;
|
||||||
|
sortedServerChannels = null;
|
||||||
|
delete server.channel_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (let index = 0; index < channels.length; index++) {
|
for (let index = 0; index < channels.length; index++) {
|
||||||
const element = channels[index];
|
const element = channels[index];
|
||||||
|
|
@ -358,6 +385,7 @@ const actions = {
|
||||||
|
|
||||||
const selectedChannelID = context.rootState.channelModule.selectedChannelID;
|
const selectedChannelID = context.rootState.channelModule.selectedChannelID;
|
||||||
const serverChannelID = context.rootState.channelModule.serverChannelID;
|
const serverChannelID = context.rootState.channelModule.serverChannelID;
|
||||||
|
const serverID = context.rootState.servers.selectedServerID;
|
||||||
|
|
||||||
if (serverChannelIDs.includes(selectedChannelID)) {
|
if (serverChannelIDs.includes(selectedChannelID)) {
|
||||||
context.dispatch("selectedChannelID", null);
|
context.dispatch("selectedChannelID", null);
|
||||||
|
|
@ -365,6 +393,9 @@ const actions = {
|
||||||
if (serverChannelIDs.includes(serverChannelID)) {
|
if (serverChannelIDs.includes(serverChannelID)) {
|
||||||
context.dispatch("setServerChannelID", null);
|
context.dispatch("setServerChannelID", null);
|
||||||
}
|
}
|
||||||
|
if (serverID === server_id) {
|
||||||
|
context.dispatch("servers/setSelectedServerID", null);
|
||||||
|
}
|
||||||
context.dispatch("servers/removePresences", server_id);
|
context.dispatch("servers/removePresences", server_id);
|
||||||
context.dispatch("servers/removeServer", server_id);
|
context.dispatch("servers/removeServer", server_id);
|
||||||
context.dispatch("servers/removeNotifications", server_id);
|
context.dispatch("servers/removeNotifications", server_id);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ const config = [
|
||||||
"You can now move channels to make it more organized."
|
"You can now move channels to make it more organized."
|
||||||
],
|
],
|
||||||
fix: [
|
fix: [
|
||||||
"Fixed a bug where the notification sound would sometimes not work."
|
"Fixed a bug where the notification sound would sometimes not work.",
|
||||||
|
"Fixed a bug where join message would send twice."
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue