Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
thororen1234 2024-11-05 15:27:42 -05:00
commit d1455b3761
89 changed files with 369 additions and 285 deletions

View file

@ -15,23 +15,13 @@ import { Settings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { proxyLazy } from "@utils/lazy";
import { Logger } from "@utils/Logger";
import { classes } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { findByCodeLazy, findByPropsLazy } from "@webpack";
import {
ChannelStore,
FluxDispatcher,
i18n,
Menu,
MessageStore,
Parser,
SelectedChannelStore,
Timestamp,
UserStore,
useStateFromStores,
} from "@webpack/common";
import { ChannelStore, FluxDispatcher, Menu, MessageStore, Parser, SelectedChannelStore, Timestamp, UserStore, useStateFromStores } from "@webpack/common";
import { Message } from "discord-types/general";
import overlayStyle from "./deleteStyleOverlay.css?managed";
@ -188,30 +178,23 @@ export default definePlugin({
(oldMsg, newMsg) => oldMsg?.editHistory === newMsg?.editHistory,
);
return (
Settings.plugins.MessageLogger.inlineEdits && (
<>
{message.editHistory?.map(edit => (
<div className="messagelogger-edited">
{parseEditContent(edit.content, message)}
<Timestamp
timestamp={edit.timestamp}
isEdited={true}
isInline={false}
>
<span className={styles.edited}>
{" "}
({i18n.Messages.MESSAGE_EDITED})
</span>
</Timestamp>
</div>
))}
</>
)
return Settings.plugins.MessageLogger.inlineEdits && (
<>
{message.editHistory?.map(edit => (
<div className="messagelogger-edited">
{parseEditContent(edit.content, message)}
<Timestamp
timestamp={edit.timestamp}
isEdited={true}
isInline={false}
>
<span className={styles.edited}>{" "}({getIntlMessage("MESSAGE_EDITED")})</span>
</Timestamp>
</div>
))}
</>
);
},
{ noop: true },
),
}, { noop: true }),
makeEdit(newMessage: any, oldMessage: any): any {
return {
@ -505,7 +488,7 @@ export default definePlugin({
{
// Message content renderer
find: 'Messages.MESSAGE_EDITED,")"',
find: "#{intl::MESSAGE_EDITED}",
replacement: [
{
// Render editHistory in the deepest div for message content
@ -558,7 +541,7 @@ export default definePlugin({
},
{
// Message group rendering
find: "Messages.NEW_MESSAGES_ESTIMATED_WITH_DATE",
find: "#{intl::NEW_MESSAGES_ESTIMATED_WITH_DATE}",
replacement: [
{
match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\|\|/,