mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 14:13:01 -04:00
Add BetterBlockedContext to BetterBlockedUsers
This commit is contained in:
parent
c24fe61710
commit
eae8947a09
3 changed files with 50 additions and 27 deletions
|
@ -25,7 +25,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
|
||||||
- BetterActivities by D3SOX, Arjix, AutumnVN
|
- BetterActivities by D3SOX, Arjix, AutumnVN
|
||||||
- BetterAudioPlayer by Creations
|
- BetterAudioPlayer by Creations
|
||||||
- BetterBanReasons by Inbestigator
|
- BetterBanReasons by Inbestigator
|
||||||
- BetterBlockedUsers by TheArmagan
|
- BetterBlockedUsers by TheArmagan & Elvyra
|
||||||
- BetterInvites by iamme
|
- BetterInvites by iamme
|
||||||
- BetterPlusReacts by Joona
|
- BetterPlusReacts by Joona
|
||||||
- BetterQuickReact by Ven & Sqaaakoi
|
- BetterQuickReact by Ven & Sqaaakoi
|
||||||
|
|
|
@ -6,18 +6,30 @@
|
||||||
|
|
||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
|
|
||||||
import { EquicordDevs } from "@utils/constants";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { getIntlMessage, openUserProfile } from "@utils/discord";
|
import { Devs, EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import { openUserProfile } from "@utils/discord";
|
||||||
import { Button, React, RelationshipStore, TextInput, UserStore } from "@webpack/common";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
import { FluxDispatcher, React, RelationshipStore, TextInput, UserStore } from "@webpack/common";
|
||||||
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
let lastSearch = "";
|
let lastSearch = "";
|
||||||
let updateFunc = (v: any) => { };
|
let updateFunc = (v: any) => { };
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
hideBlockedWarning: {
|
||||||
|
default: true,
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Skip the warning about blocked/ignored users when opening the profile through the blocklist.",
|
||||||
|
restartNeeded: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "BetterBlockedUsers",
|
name: "BetterBlockedUsers",
|
||||||
description: "Allows you to search in blocked users list and makes names selectable in settings.",
|
description: "Allows you to search in blocked users list and makes names clickable in settings.",
|
||||||
authors: [EquicordDevs.TheArmagan],
|
authors: [EquicordDevs.TheArmagan, Devs.Elvyra],
|
||||||
|
settings,
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: '"],{numberOfBlockedUsers:',
|
find: '"],{numberOfBlockedUsers:',
|
||||||
|
@ -27,8 +39,8 @@ export default definePlugin({
|
||||||
replace: ",$1.listType==='blocked'?$self.renderSearchInput():null"
|
replace: ",$1.listType==='blocked'?$self.renderSearchInput():null"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=userId:(\i).*?\}\)\]\}\),)(\(.*?\)\}\))/,
|
match: /(?<=className:\i.userInfo,)(?=children:.{0,20}user:(\i))/,
|
||||||
replace: "$self.renderUser($1,$2),",
|
replace: "style:{cursor:'pointer'},onClick:()=>$self.openUserProfile($1),"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=\}=(\i).{0,10}(\i).useState\(.{0,1}\);)/,
|
match: /(?<=\}=(\i).{0,10}(\i).useState\(.{0,1}\);)/,
|
||||||
|
@ -39,7 +51,28 @@ export default definePlugin({
|
||||||
replace: "$1(searchResults.length?searchResults:$2)"
|
replace: "$1(searchResults.length?searchResults:$2)"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
find: "UserProfileModalHeaderActionButtons",
|
||||||
|
replacement: [
|
||||||
|
{
|
||||||
|
match: /(?<=return \i)\|\|(\i)===.*?.FRIEND/,
|
||||||
|
replace: (_, type) => `?null:${type} === 1|| ${type} === 2`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(?<=\i.bot.{0,50}children:.*?onClose:)(\i)/,
|
||||||
|
replace: "() => {$1();$self.closeSettingsWindow()}",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: ',["user"])',
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=isIgnored:.*?,\[\i,\i]=\i.useState\()\i\|\|\i\|\|\i.*?]\);/,
|
||||||
|
replace: "false);"
|
||||||
|
},
|
||||||
|
predicate: () => settings.store.hideBlockedWarning,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
renderSearchInput() {
|
renderSearchInput() {
|
||||||
const [value, setValue] = React.useState(lastSearch);
|
const [value, setValue] = React.useState(lastSearch);
|
||||||
|
@ -61,19 +94,6 @@ export default definePlugin({
|
||||||
}} value={value}
|
}} value={value}
|
||||||
></TextInput>;
|
></TextInput>;
|
||||||
},
|
},
|
||||||
renderUser(userId: string, rest: any) {
|
|
||||||
return (
|
|
||||||
<div style={{ display: "flex", gap: "8px" }}>
|
|
||||||
<Button color={Button.Colors.PRIMARY} onClick={() => openUserProfile(userId)}>
|
|
||||||
{getIntlMessage("SHOW_USER_PROFILE")}
|
|
||||||
</Button>
|
|
||||||
{rest}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
getSearchResults() {
|
|
||||||
return !!lastSearch;
|
|
||||||
},
|
|
||||||
setUpdateFunc(e, setResults) {
|
setUpdateFunc(e, setResults) {
|
||||||
if (e.listType !== "blocked") return;
|
if (e.listType !== "blocked") return;
|
||||||
updateFunc = setResults;
|
updateFunc = setResults;
|
||||||
|
@ -86,5 +106,11 @@ export default definePlugin({
|
||||||
if (!user) return id === search;
|
if (!user) return id === search;
|
||||||
return id === search || user?.username?.toLowerCase()?.includes(search) || user?.globalName?.toLowerCase()?.includes(search);
|
return id === search || user?.username?.toLowerCase()?.includes(search) || user?.globalName?.toLowerCase()?.includes(search);
|
||||||
}) as string[];
|
}) as string[];
|
||||||
}
|
},
|
||||||
|
closeSettingsWindow: () => {
|
||||||
|
FluxDispatcher.dispatch({ type: "LAYER_POP" });
|
||||||
|
},
|
||||||
|
openUserProfile: (user: User) => {
|
||||||
|
openUserProfile(user.id);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[class*="usersList_"] [class*="text_"] {
|
|
||||||
user-select: text !important;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue