- {Parser.parse(edit.content, true, {
- channelId,
- messageId,
- allowLinks: true,
- allowHeading: true,
- allowList: true,
- allowEmojiLinks: true,
- viewingChannelId: SelectedChannelStore.getChannelId(),
- })}
+ {parseEditContent(edit.content, message)}
openHistoryModal(message)}
+ aria-role="button"
+ >
+ {children}
+
+ );
+ },
+
+ Messages: proxyLazy(() => ({
+ DELETED_MESSAGE_COUNT: getMessage("{count, plural, =0 {No deleted messages} one {{count} deleted message} other {{count} deleted messages}}")
+ })),
+
patches: [
{
// MessageStore
@@ -332,7 +368,8 @@ export default definePlugin({
match: /this\.customRenderedContent=(\i)\.customRenderedContent,/,
replace: "this.customRenderedContent = $1.customRenderedContent," +
"this.deleted = $1.deleted || false," +
- "this.editHistory = $1.editHistory || [],"
+ "this.editHistory = $1.editHistory || []," +
+ "this.firstEditTimestamp = $1.firstEditTimestamp || this.editedTimestamp || this.timestamp,"
}
]
},
@@ -345,7 +382,7 @@ export default definePlugin({
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
match: /(?<=null!=\i\.edited_timestamp\)return )\i\(\i,\{reactions:(\i)\.reactions.{0,50}\}\)/,
replace:
- "Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory })"
+ "Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory, firstEditTimestamp:$1.firstEditTimestamp })"
},
{
@@ -364,7 +401,8 @@ export default definePlugin({
" return $2;" +
"})())," +
"deleted: arguments[1]?.deleted," +
- "editHistory: arguments[1]?.editHistory"
+ "editHistory: arguments[1]?.editHistory," +
+ "firstEditTimestamp: new Date(arguments[1]?.firstEditTimestamp ?? $2.editedTimestamp ?? $2.timestamp)"
},
{
// Preserve deleted attribute on attachments
@@ -412,6 +450,11 @@ export default definePlugin({
// Render editHistory in the deepest div for message content
match: /(\)\("div",\{id:.+?children:\[)/,
replace: "$1 (!!arguments[0].message.editHistory?.length && $self.renderEdits(arguments[0])),"
+ },
+ {
+ // Make edit marker clickable
+ match: /"span",\{(?=className:\i\.edited,)/,
+ replace: "$self.EditMarker,{message:arguments[0].message,"
}
]
},
@@ -441,6 +484,30 @@ export default definePlugin({
replace: "children:arguments[0].message.deleted?[]:$1"
}
]
+ },
+ {
+ // Message grouping
+ find: "NON_COLLAPSIBLE.has(",
+ replacement: {
+ match: /if\((\i)\.blocked\)return \i\.\i\.MESSAGE_GROUP_BLOCKED;/,
+ replace: '$&else if($1.deleted) return"MESSAGE_GROUP_DELETED";',
+ },
+ predicate: () => Settings.plugins.MessageLogger.collapseDeleted
+ },
+ {
+ // Message group rendering
+ find: "Messages.NEW_MESSAGES_ESTIMATED_WITH_DATE",
+ replacement: [
+ {
+ match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\|\|/,
+ replace: '$&$1.type==="MESSAGE_GROUP_DELETED"||',
+ },
+ {
+ match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\?.*?:/,
+ replace: '$&$1.type==="MESSAGE_GROUP_DELETED"?$self.Messages.DELETED_MESSAGE_COUNT:',
+ },
+ ],
+ predicate: () => Settings.plugins.MessageLogger.collapseDeleted
}
]
});
diff --git a/src/plugins/messageLogger/messageLogger.css b/src/plugins/messageLogger/messageLogger.css
index a112b1961..2759129d9 100644
--- a/src/plugins/messageLogger/messageLogger.css
+++ b/src/plugins/messageLogger/messageLogger.css
@@ -38,3 +38,17 @@
.theme-light .messagelogger-edited {
opacity: 0.5;
}
+
+.messagelogger-edit-marker {
+ cursor: pointer;
+}
+
+.vc-ml-modal-timestamp {
+ cursor: unset;
+ height: unset;
+}
+
+.vc-ml-modal-tab-bar {
+ flex-wrap: wrap;
+ gap: 16px;
+}
diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx
index 68b33eed0..56c285ecd 100644
--- a/src/plugins/viewRaw/index.tsx
+++ b/src/plugins/viewRaw/index.tsx
@@ -55,6 +55,7 @@ function cleanMessage(msg: Message) {
const cloneAny = clone as any;
delete cloneAny.editHistory;
delete cloneAny.deleted;
+ delete cloneAny.firstEditTimestamp;
cloneAny.attachments?.forEach(a => delete a.deleted);
return clone;
From 5bd10c860861b1c2ab8bf61b029592c0805c497d Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Mon, 15 Jul 2024 05:09:13 +0200
Subject: [PATCH 11/14] MessageLogger: fix edit modal close button
---
src/plugins/messageLogger/HistoryModal.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/messageLogger/HistoryModal.tsx b/src/plugins/messageLogger/HistoryModal.tsx
index a7715203d..d1b5bf29c 100644
--- a/src/plugins/messageLogger/HistoryModal.tsx
+++ b/src/plugins/messageLogger/HistoryModal.tsx
@@ -39,7 +39,7 @@ export function HistoryModal({ modalProps, message }: { modalProps: ModalProps;
Message Edit History
-
+
From c3852cb892e88eef6509d5114bd17910e72703cb Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Wed, 17 Jul 2024 02:34:05 +0200
Subject: [PATCH 12/14] fix badges on canary
---
package.json | 1 +
src/plugins/_api/badges/index.tsx | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index cfd4bd010..5d8f9f97d 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
"buildReporterDesktop": "pnpm build --reporter",
"watch": "pnpm build --watch",
+ "dev": "pnpm watch",
"watchWeb": "pnpm buildWeb --watch",
"generatePluginJson": "tsx scripts/generatePluginList.ts",
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types",
diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx
index 94dc673a5..89a992ac3 100644
--- a/src/plugins/_api/badges/index.tsx
+++ b/src/plugins/_api/badges/index.tsx
@@ -91,7 +91,7 @@ export default definePlugin({
/* new profiles */
{
- find: ".PANEL]:14",
+ find: ".FULL_SIZE]:26",
replacement: {
match: /(?<=(\i)=\(0,\i\.\i\)\(\i\);)return 0===\i.length\?/,
replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&"
From 67632ecc113ef490a322c894c6bb11e9c4c4b2e7 Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Wed, 17 Jul 2024 02:35:53 +0200
Subject: [PATCH 13/14] MentionAvatars: fix mentions being ultra wide in topics
---
src/plugins/mentionAvatars/styles.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/mentionAvatars/styles.css b/src/plugins/mentionAvatars/styles.css
index 33404d7b5..022f968c0 100644
--- a/src/plugins/mentionAvatars/styles.css
+++ b/src/plugins/mentionAvatars/styles.css
@@ -1,6 +1,6 @@
.vc-mentionAvatars-avatar {
vertical-align: middle;
- width: 1em;
+ width: 1em !important; /* insane discord sets width: 100% in channel topic */
height: 1em;
margin: 0 4px 0.2rem 2px;
border-radius: 50%;
From 80b493d7a863831e7770463f03d56048ae9bdced Mon Sep 17 00:00:00 2001
From: Vendicated
Date: Wed, 17 Jul 2024 21:30:10 +0200
Subject: [PATCH 14/14] WhoReacted: fix errors
---
src/plugins/messageLinkEmbeds/index.tsx | 1 +
src/plugins/whoReacted/index.tsx | 32 +++++++++++++------------
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/plugins/messageLinkEmbeds/index.tsx b/src/plugins/messageLinkEmbeds/index.tsx
index cf180d0d4..9fd677389 100644
--- a/src/plugins/messageLinkEmbeds/index.tsx
+++ b/src/plugins/messageLinkEmbeds/index.tsx
@@ -147,6 +147,7 @@ async function fetchMessage(channelID: string, messageID: string) {
if (!msg) return;
const message: Message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id);
+ if (!message) return;
messageCache.set(message.id, {
message,
diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx
index 5721dc912..679fe714e 100644
--- a/src/plugins/whoReacted/index.tsx
+++ b/src/plugins/whoReacted/index.tsx
@@ -43,14 +43,23 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) {
},
oldFormErrors: true
})
- .then(res => FluxDispatcher.dispatch({
- type: "MESSAGE_REACTION_ADD_USERS",
- channelId: msg.channel_id,
- messageId: msg.id,
- users: res.body,
- emoji,
- reactionType: type
- }))
+ .then(res => {
+ for (const user of res.body) {
+ FluxDispatcher.dispatch({
+ type: "USER_UPDATE",
+ user
+ });
+ }
+
+ FluxDispatcher.dispatch({
+ type: "MESSAGE_REACTION_ADD_USERS",
+ channelId: msg.channel_id,
+ messageId: msg.id,
+ users: res.body,
+ emoji,
+ reactionType: type
+ });
+ })
.catch(console.error)
.finally(() => sleep(250));
}
@@ -148,13 +157,6 @@ export default definePlugin({
const reactions = getReactionsWithQueue(message, emoji, type);
const users = Object.values(reactions).filter(Boolean) as User[];
- for (const user of users) {
- FluxDispatcher.dispatch({
- type: "USER_UPDATE",
- user
- });
- }
-
return (