mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-28 16:04:24 -04:00
Fix HolyNotes
This commit is contained in:
parent
04a6472e0a
commit
4cd4e44378
4 changed files with 10 additions and 11 deletions
|
@ -60,7 +60,7 @@ interface PluginModalProps extends ModalProps {
|
|||
onRestartNeeded(): void;
|
||||
}
|
||||
|
||||
function makeDummyUser(user: { username: string; id?: string; avatar?: string; }) {
|
||||
export function makeDummyUser(user: { username: string; id?: string; avatar?: string; }) {
|
||||
const newUser = new UserRecord({
|
||||
username: user.username,
|
||||
id: user.id ?? generateId(),
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { makeDummyUser } from "@components/PluginSettings/PluginModal";
|
||||
import { ChannelStore, lodash, Toasts, UserStore } from "@webpack/common";
|
||||
import { Channel, Message } from "discord-types/general";
|
||||
|
||||
import { User } from ".";
|
||||
import { Discord, HolyNotes } from "./types";
|
||||
import { deleteCacheFromDataStore, DeleteEntireStore, saveCacheToDataStore } from "./utils";
|
||||
|
||||
|
@ -145,7 +145,7 @@ export default new (class NoteHandler {
|
|||
for (const notebook in notebooks)
|
||||
for (const noteId in notebooks[notebook]) {
|
||||
const note = notebooks[notebook][noteId];
|
||||
const user = UserStore.getUser(note.author.id) ?? new User({ ...note.author });
|
||||
const user = UserStore.getUser(note.author.id) ?? makeDummyUser(note.author);
|
||||
|
||||
Object.assign(notebooks[notebook][noteId].author, {
|
||||
avatar: user.avatar,
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Channel, cozyMessage, groupStart, message, MessageType, User } from "@equicordplugins/holyNotes";
|
||||
import { makeDummyUser } from "@components/PluginSettings/PluginModal";
|
||||
import { MessageType } from "@equicordplugins/holyNotes";
|
||||
import { copyToClipboard } from "@utils/clipboard";
|
||||
import { classes } from "@utils/misc";
|
||||
import { ModalProps } from "@utils/modal";
|
||||
import { findComponentByCodeLazy } from "@webpack";
|
||||
import { findByCodeLazy, findByProps, findComponentByCodeLazy } from "@webpack";
|
||||
import { ContextMenuApi, FluxDispatcher, Menu, NavigationRouter, React } from "@webpack/common";
|
||||
|
||||
import noteHandler from "../../NoteHandler";
|
||||
import { HolyNotes } from "../../types";
|
||||
|
||||
|
||||
export const RenderMessage = ({
|
||||
note,
|
||||
notebook,
|
||||
|
@ -28,6 +28,8 @@ export const RenderMessage = ({
|
|||
fromDeleteModal: boolean;
|
||||
closeModal?: () => void;
|
||||
}) => {
|
||||
const { message, groupStart, cozyMessage } = findByProps("cozyMessage");
|
||||
const Channel = findByCodeLazy("computeLurkerPermissionsAllowList(){");
|
||||
const ChannelMessage = findComponentByCodeLazy("Message must not be a thread");
|
||||
|
||||
const [isHoldingDelete, setHoldingDelete] = React.useState(false);
|
||||
|
@ -91,7 +93,7 @@ export const RenderMessage = ({
|
|||
Object.assign(
|
||||
{ ...note },
|
||||
{
|
||||
author: new User({ ...note?.author }),
|
||||
author: makeDummyUser(note?.author),
|
||||
timestamp: new Date(note?.timestamp),
|
||||
// @ts-ignore
|
||||
embeds: note?.embeds?.map((embed: { timestamp: string | number | Date; }) =>
|
||||
|
|
|
@ -26,7 +26,7 @@ import { EquicordDevs } from "@utils/constants";
|
|||
import { classes } from "@utils/misc";
|
||||
import { openModal } from "@utils/modal";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByCodeLazy, findByProps, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { findByCodeLazy, findByProps, findComponentByCodeLazy } from "@webpack";
|
||||
import { ChannelStore, Menu } from "@webpack/common";
|
||||
import { Message } from "discord-types/general";
|
||||
|
||||
|
@ -35,10 +35,7 @@ import { NoteModal } from "./components/modals/Notebook";
|
|||
import noteHandler, { noteHandlerCache } from "./NoteHandler";
|
||||
import { DataStoreToCache, HolyNoteStore } from "./utils";
|
||||
|
||||
export const User = findByCodeLazy("isSystemUser(){");
|
||||
export const { message, groupStart, cozyMessage } = findByPropsLazy("cozyMessage");
|
||||
export const MessageType = findByCodeLazy("isEdited(){");
|
||||
export const Channel = findByCodeLazy("computeLurkerPermissionsAllowList(){");
|
||||
|
||||
const HeaderBarIcon = findComponentByCodeLazy(".HEADER_BAR_BADGE_TOP:", '.iconBadge,"top"');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue