Update BetterFriendList.plugin.js

This commit is contained in:
Mirco Wittrien 2020-11-16 09:51:45 +01:00
parent f044a51493
commit 785759acc5
1 changed files with 59 additions and 53 deletions

View File

@ -14,8 +14,13 @@ module.exports = (_ => {
"info": {
"name": "BetterFriendList",
"author": "DevilBro",
"version": "1.3.0",
"version": "1.3.1",
"description": "Add extra controls to the friends page, like sort by name/status, search and all/request/blocked amount"
},
"changeLog": {
"fixed": {
"Crash": "No longer crashes when pressing Ctrl in the friend list"
}
}
};
@ -210,15 +215,15 @@ module.exports = (_ => {
return newSection;
});
}
let getSectionTitle = e.instance.props.getSectionTitle;
e.instance.props.getSectionTitle = (...args) => {
if (!BDFDB.PatchUtils.isPatched(this, e.instance.props, "getSectionTitle")) BDFDB.PatchUtils.patch(this, e.instance.props, "getSectionTitle", {after: e2 => {
if (typeof e2.returnValue == "string") {
let users = e.instance.props.statusSections.flat(10);
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._betterfriendlisttitle,
children: getSectionTitle(...args).replace(users.length, users.filter(u => u && u.key != placeHolderId).length)
children: e2.returnValue.replace(users.length, users.filter(u => u && u.key != placeHolderId).length)
}),
settings.addSortOptions && [
{key: "usernameLower", label: BDFDB.LanguageUtils.LanguageStrings.FRIENDS_COLUMN_NAME},
@ -268,7 +273,8 @@ module.exports = (_ => {
})
].flat(10).filter(n => n)
});
};
}
}}, {force: true, noCache: true});
}
processPeopleListSectionedNonLazy (e) {