Fix channel sort not working

This commit is contained in:
Pavel Djundik 2018-07-14 11:06:30 +03:00 committed by Pavel Djundik
parent a899b1b46d
commit 04d86a3550
2 changed files with 1 additions and 14 deletions

View File

@ -66,10 +66,7 @@ import NetworkLobby from "./NetworkLobby.vue";
import Channel from "./Channel.vue"; import Channel from "./Channel.vue";
import JoinChannel from "./JoinChannel.vue"; import JoinChannel from "./JoinChannel.vue";
// TODO: ignoreSortSync should be removed
import {findChannel} from "../js/vue";
import socket from "../js/socket"; import socket from "../js/socket";
// import options from "../js/options";
export default { export default {
name: "NetworkList", name: "NetworkList",
@ -99,14 +96,13 @@ export default {
type: "networks", type: "networks",
order: this.networks.map((n) => n.uuid), order: this.networks.map((n) => n.uuid),
}); });
// options.settings.ignoreSortSync = true;
}, },
onChannelSort(e) { onChannelSort(e) {
if (!e.moved) { if (!e.moved) {
return; return;
} }
const {findChannel} = require("../js/vue");
const channel = findChannel(e.moved.element.id); const channel = findChannel(e.moved.element.id);
if (!channel) { if (!channel) {
@ -118,8 +114,6 @@ export default {
target: channel.network.uuid, target: channel.network.uuid,
order: channel.network.channels.map((c) => c.id), order: channel.network.channels.map((c) => c.id),
}); });
// options.settings.ignoreSortSync = true;
}, },
}, },
}; };

View File

@ -2,15 +2,8 @@
const $ = require("jquery"); const $ = require("jquery");
const socket = require("../socket"); const socket = require("../socket");
const options = require("../options");
socket.on("sync_sort", function(data) { socket.on("sync_sort", function(data) {
// Syncs the order of channels or networks when they are reordered
if (options.ignoreSortSync) {
options.ignoreSortSync = false;
return; // Ignore syncing because we 'caused' it
}
const type = data.type; const type = data.type;
const order = data.order; const order = data.order;
const container = $(".networks"); const container = $(".networks");