diff --git a/src/plugins/serverInfo/GuildInfoModal.tsx b/src/plugins/serverInfo/GuildInfoModal.tsx index a0d138cda..d3c676941 100644 --- a/src/plugins/serverInfo/GuildInfoModal.tsx +++ b/src/plugins/serverInfo/GuildInfoModal.tsx @@ -31,7 +31,8 @@ export function openGuildInfoModal(guild: Guild) { const enum Tabs { ServerInfo, Friends, - BlockedUsers + BlockedUsers, + IgnoredUsers } interface GuildProps { @@ -44,7 +45,8 @@ interface RelationshipProps extends GuildProps { const fetched = { friends: false, - blocked: false + blocked: false, + ignored: false }; function renderTimestamp(timestamp: number) { @@ -56,10 +58,12 @@ function renderTimestamp(timestamp: number) { function GuildInfoModal({ guild }: GuildProps) { const [friendCount, setFriendCount] = useState(); const [blockedCount, setBlockedCount] = useState(); + const [ignoredCount, setIgnoredCount] = useState(); useEffect(() => { fetched.friends = false; fetched.blocked = false; + fetched.ignored = false; }, []); const [currentTab, setCurrentTab] = useState(Tabs.ServerInfo); @@ -132,12 +136,19 @@ function GuildInfoModal({ guild }: GuildProps) { > Blocked Users{blockedCount !== undefined ? ` (${blockedCount})` : ""} + + Ignored Users{ignoredCount !== undefined ? ` (${ignoredCount})` : ""} +
{currentTab === Tabs.ServerInfo && } {currentTab === Tabs.Friends && } {currentTab === Tabs.BlockedUsers && } + {currentTab === Tabs.IgnoredUsers && }
); @@ -211,7 +222,13 @@ function BlockedUsersTab({ guild, setCount }: RelationshipProps) { return UserList("blocked", guild, blockedIds, setCount); } -function UserList(type: "friends" | "blocked", guild: Guild, ids: string[], setCount: (count: number) => void) { +function IgnoredUserTab({ guild, setCount }: RelationshipProps) { + const ignoredIds = Object.keys(RelationshipStore.getRelationships()).filter(id => RelationshipStore.isIgnored(id)); + return UserList("ignored", guild, ignoredIds, setCount); +} + + +function UserList(type: "friends" | "blocked" | "ignored", guild: Guild, ids: string[], setCount: (count: number) => void) { const missing = [] as string[]; const members = [] as string[]; diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index 8579f8b92..ff668425f 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -50,6 +50,7 @@ export let GuildMemberStore: Stores.GuildMemberStore & t.FluxStore; export let RelationshipStore: Stores.RelationshipStore & t.FluxStore & { /** Get the date (as a string) that the relationship was created */ getSince(userId: string): string; + isIgnored(userId: string): boolean; }; export let EmojiStore: t.EmojiStore;