Clear local ignored list upon domain change

This commit is contained in:
Zach Fox 2017-01-04 13:31:16 -08:00
parent dde5f69ac9
commit c695878025
2 changed files with 12 additions and 1 deletions

View file

@ -42,7 +42,6 @@ Item {
property int actionButtonWidth: 75
property int nameCardWidth: width - actionButtonWidth*(iAmAdmin ? 4 : 2) - 4
property var myData: ({displayName: "", userName: "", audioLevel: 0.0}) // valid dummy until set
// FIXME: Need to determine & handle when this list gets reset.
property var ignored: ({}); // Keep a local list of ignored avatars & their data. Necessary because HashMap is slow to respond after ignoring.
property var userModelData: [] // This simple list is essentially a mirror of the userModel listModel without all the extra complexities.
property bool iAmAdmin: false
@ -478,6 +477,9 @@ Item {
}
}
break;
case 'clearIgnored':
ignored = ({});
break;
default:
console.log('Unrecognized message:', JSON.stringify(message));
}

View file

@ -332,6 +332,13 @@ button.clicked.connect(onClicked);
pal.visibleChanged.connect(onVisibleChanged);
pal.closed.connect(off);
Users.usernameFromIDReply.connect(usernameFromIDReply);
function clearIgnoredInQMLAndRefreshPAL() {
pal.sendToQml({ method: 'clearIgnored' });
removeOverlays();
populateUserList();
}
Window.domainChanged.connect(clearIgnoredInQMLAndRefreshPAL);
Window.domainConnectionRefused.connect(clearIgnoredInQMLAndRefreshPAL);
//
// Cleanup.
@ -342,6 +349,8 @@ Script.scriptEnding.connect(function () {
pal.visibleChanged.disconnect(onVisibleChanged);
pal.closed.disconnect(off);
Users.usernameFromIDReply.disconnect(usernameFromIDReply);
Window.domainChanged.disconnect(clearIgnoredInQMLAndRefreshPAL);
Window.domainConnectionRefused.disconnect(clearIgnoredInQMLAndRefreshPAL);
off();
});