mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 04:57:23 +02:00
fix broken search for myself
This commit is contained in:
parent
e5804dade0
commit
db68a6adcd
2 changed files with 6 additions and 6 deletions
|
@ -41,9 +41,10 @@ Rectangle {
|
||||||
property var userData: [];
|
property var userData: [];
|
||||||
property var myData: ({displayName: "", userName: ""}); // valid dummy until set
|
property var myData: ({displayName: "", userName: ""}); // valid dummy until set
|
||||||
property bool iAmAdmin: false;
|
property bool iAmAdmin: false;
|
||||||
function findSessionIndex(sessionId) { // no findIndex in .qml
|
function findSessionIndex(sessionId, optionalData) { // no findIndex in .qml
|
||||||
for (var i = 0; i < userData.length; i++) {
|
var i, data = optionalData || userData, length = data.length;
|
||||||
if (userData[i].sessionId === sessionId) {
|
for (var i = 0; i < length; i++) {
|
||||||
|
if (data[i].sessionId === sessionId) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +54,7 @@ Rectangle {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'users':
|
case 'users':
|
||||||
var data = message.params;
|
var data = message.params;
|
||||||
var myIndex = findSessionIndex('');
|
var myIndex = findSessionIndex('', data);
|
||||||
iAmAdmin = Users.canKick;
|
iAmAdmin = Users.canKick;
|
||||||
myData = data[myIndex];
|
myData = data[myIndex];
|
||||||
data.splice(myIndex, 1);
|
data.splice(myIndex, 1);
|
||||||
|
@ -105,7 +106,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
function noticeSelection() {
|
function noticeSelection() {
|
||||||
console.log('selection changed');
|
|
||||||
var userIds = [];
|
var userIds = [];
|
||||||
table.selection.forEach(function (userIndex) {
|
table.selection.forEach(function (userIndex) {
|
||||||
userIds.push(userData[userIndex].sessionId);
|
userIds.push(userData[userIndex].sessionId);
|
||||||
|
|
|
@ -91,7 +91,7 @@ var AVATAR_OVERLAY = Script.resolvePath("assets/images/grabsprite-3.png");
|
||||||
function populateUserList() {
|
function populateUserList() {
|
||||||
var data = [];
|
var data = [];
|
||||||
var counter = 1;
|
var counter = 1;
|
||||||
AvatarList.getAvatarIdentifiers().forEach(function (id) {
|
AvatarList.getAvatarIdentifiers().sort().forEach(function (id) { // sorting the identifiers is just an aid for debugging
|
||||||
var avatar = AvatarList.getAvatar(id);
|
var avatar = AvatarList.getAvatar(id);
|
||||||
data.push({
|
data.push({
|
||||||
displayName: avatar.displayName || ('anonymous ' + counter++),
|
displayName: avatar.displayName || ('anonymous ' + counter++),
|
||||||
|
|
Loading…
Reference in a new issue