diff --git a/src/plugins/sortFriendRequests/index.tsx b/src/plugins/sortFriendRequests/index.tsx
index 42af9a3af..d53e6edbf 100644
--- a/src/plugins/sortFriendRequests/index.tsx
+++ b/src/plugins/sortFriendRequests/index.tsx
@@ -21,10 +21,10 @@ import "./styles.css";
import { definePluginSettings } from "@api/Settings";
import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
-import { Devs } from "@utils/constants";
+import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { User } from "@vencord/discord-types";
-import { DateUtils, RelationshipStore, Text, TooltipContainer } from "@webpack/common";
+import { DateUtils, Flex, RelationshipStore, Text, TooltipContainer } from "@webpack/common";
import { PropsWithChildren } from "react";
const formatter = new Intl.DateTimeFormat(undefined, {
@@ -50,24 +50,34 @@ const settings = definePluginSettings({
export default definePlugin({
name: "SortFriendRequests",
- authors: [Devs.Megu],
+ authors: [Devs.Megu, EquicordDevs.CallMeGii],
description: "Sorts friend requests by date of receipt",
settings,
- patches: [{
- find: "getRelationshipCounts(){",
- replacement: {
- match: /\}\)\.sortBy\((.+?)\)\.value\(\)/,
- replace: "}).sortBy(row => $self.wrapSort(($1), row)).value()"
+ patches: [
+ {
+ find: "getRelationshipCounts(){",
+ replacement: {
+ match: /\}\)\.sortBy\((.+?)\)\.value\(\)/,
+ replace: "}).sortBy(row => $self.wrapSort(($1), row)).value()"
+ }
+ }, {
+ find: "#{intl::FRIEND_REQUEST_CANCEL}",
+ replacement: {
+ predicate: () => settings.store.showDates,
+ match: /(?<=\.listItemContents,children:\[)\(0,.+?(?=,\(0)(?<=user:(\i).+?)/,
+ replace: (children, user) => `$self.WrapperDateComponent({user:${user},children:${children}})`
+ }
+ },
+ {
+ find: "peopleListItemRef",
+ replacement: {
+ predicate: () => settings.store.showDates,
+ match: /(?<=children:.*user:(\i),.*subText:).+?(?=,hovered:\i,showAccountIdentifier)/,
+ replace: "$self.makeSubtext($1, $&)"
+ }
}
- }, {
- find: "#{intl::FRIEND_REQUEST_CANCEL}",
- replacement: {
- predicate: () => settings.store.showDates,
- match: /(?<=\.listItemContents,children:\[)\(0,.+?(?=,\(0)(?<=user:(\i).+?)/,
- replace: (children, user) => `$self.WrapperDateComponent({user:${user},children:${children}})`
- }
- }],
+ ],
wrapSort(comparator: Function, row: any) {
return row.type === 3 || row.type === 4
@@ -75,6 +85,44 @@ export default definePlugin({
: comparator(row);
},
+ makeSubtext(user: User, origSubtext: any) {
+ const since = this.getSince(user);
+ if (isNaN(since.getTime())) {
+ return null;
+ }
+
+ return (
+
+ {origSubtext}
+
+
+
+
Added — {since.toDateString()}
+
+
+
+ );
+ },
+
WrapperDateComponent: ErrorBoundary.wrap(({ user, children }: PropsWithChildren<{ user: User; }>) => {
const since = getSince(user);
diff --git a/src/utils/constants.ts b/src/utils/constants.ts
index e37abdc79..b2e3e5544 100644
--- a/src/utils/constants.ts
+++ b/src/utils/constants.ts
@@ -1157,6 +1157,10 @@ export const EquicordDevs = Object.freeze({
name: "qouesm",
id: 130388483494641664n,
},
+ CallMeGii: {
+ name: "gii",
+ id: 156481332652802048n,
+ },
} satisfies Record);
// iife so #__PURE__ works correctly