Compare commits

...

4 commits

Author SHA1 Message Date
ryan-0324
43cdb335c9 fix: apply reported changes 2024-09-19 11:07:13 -04:00
ryan-0324
9bcd772f22 Merge branch 'dev' of https://github.com/Vendicated/Vencord into discord-types 2024-09-19 10:44:59 -04:00
Nuckyz
b875ebf92d
UserVoiceShow: Fix setting name
Some checks are pending
Sync to Codeberg / codeberg (push) Waiting to run
test / test (push) Waiting to run
2024-09-19 08:48:56 -03:00
Vendicated
c7e5295da0
SearchReply => FullSearchContext ~ now adds all options back
Some checks are pending
Sync to Codeberg / codeberg (push) Waiting to run
test / test (push) Waiting to run
2024-09-18 21:33:46 +02:00
18 changed files with 109 additions and 132 deletions

View file

@ -40,7 +40,7 @@
"@vap/shiki": "0.10.5", "@vap/shiki": "0.10.5",
"fflate": "^0.8.2", "fflate": "^0.8.2",
"gifenc": "github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3", "gifenc": "github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3",
"monaco-editor": "^0.51.0", "monaco-editor": "^0.52.0",
"nanoid": "^5.0.7" "nanoid": "^5.0.7"
}, },
"devDependencies": { "devDependencies": {

View file

@ -129,10 +129,6 @@ export default {
return constructor && Object.getPrototypeOf(constructor); return constructor && Object.getPrototypeOf(constructor);
}, },
includeOptional: true, includeOptional: true,
ignoredRemovals: {
// Seems to have been removed
fields: ["voiceBackgroundDisplay"],
},
}, },
ForumLayout: { ForumLayout: {
type: "enum", type: "enum",
@ -171,12 +167,6 @@ export default {
VideoQualityMode: { VideoQualityMode: {
type: "enum", type: "enum",
}, },
/*
// This seems to have been removed
VoiceCallBackgroundType: {
type: "enum",
},
*/
}, },
"./general/channels/ForumChannelRecord.ts": { "./general/channels/ForumChannelRecord.ts": {
ForumChannelRecord: { ForumChannelRecord: {

View file

@ -37,7 +37,6 @@ export declare abstract class ChannelRecordBase extends ChannelRecordProperties
isAnnouncementThread(): this is ThreadChannelRecord<ChannelType.ANNOUNCEMENT_THREAD>; isAnnouncementThread(): this is ThreadChannelRecord<ChannelType.ANNOUNCEMENT_THREAD>;
isArchivedLockedThread(): boolean; isArchivedLockedThread(): boolean;
isArchivedThread(): boolean; isArchivedThread(): boolean;
isBroadcastChannel(): boolean;
isCategory(): this is GuildCategoryChannelRecord; isCategory(): this is GuildCategoryChannelRecord;
isDirectory(): this is GuildDirectoryChannelRecord; isDirectory(): this is GuildDirectoryChannelRecord;
isDM(): this is DMChannelRecord; isDM(): this is DMChannelRecord;
@ -134,10 +133,6 @@ export declare abstract class ChannelRecordProperties {
userLimit_?: number | undefined; userLimit_?: number | undefined;
version?: number | undefined; version?: number | undefined;
videoQualityMode?: VideoQualityMode | undefined; videoQualityMode?: VideoQualityMode | undefined;
/** @todo This seems to have been removed. */
voiceBackgroundDisplay?: { type: VoiceCallBackgroundType.EMPTY; }
| { resourceId: string; type: VoiceCallBackgroundType.GRADIENT; }
| Nullish;
} }
export interface ForumTag { export interface ForumTag {
@ -258,10 +253,3 @@ export enum VideoQualityMode {
AUTO = 1, AUTO = 1,
FULL = 2, FULL = 2,
} }
// Original name: VoiceCallBackgroundTypes
/** @todo This seems to have been removed. */
export enum VoiceCallBackgroundType {
EMPTY = 0,
GRADIENT = 1,
}

View file

@ -36,8 +36,6 @@ export declare class ForumChannelRecord<ChannelType extends ForumChannelType = F
isMessageRequest?: undefined; isMessageRequest?: undefined;
isMessageRequestTimestamp?: undefined; isMessageRequestTimestamp?: undefined;
isSpam?: undefined; isSpam?: undefined;
lastMessageId: ChannelRecordBase["lastMessageId"];
lastPinTimestamp: ChannelRecordBase["lastPinTimestamp"];
linkedLobby?: undefined; linkedLobby?: undefined;
member?: undefined; member?: undefined;
memberCount?: undefined; memberCount?: undefined;
@ -67,5 +65,4 @@ export declare class ForumChannelRecord<ChannelType extends ForumChannelType = F
userLimit_?: undefined; userLimit_?: undefined;
version: ChannelRecordBase["version"]; version: ChannelRecordBase["version"];
videoQualityMode?: undefined; videoQualityMode?: undefined;
voiceBackgroundDisplay?: undefined;
} }

View file

@ -44,8 +44,6 @@ export declare abstract class GuildTextualChannelRecordBase extends ChannelRecor
isMessageRequest?: undefined; isMessageRequest?: undefined;
isMessageRequestTimestamp?: undefined; isMessageRequestTimestamp?: undefined;
isSpam?: undefined; isSpam?: undefined;
lastMessageId: ChannelRecordBase["lastMessageId"];
lastPinTimestamp: ChannelRecordBase["lastPinTimestamp"];
/** @todo May only be nullish. */ /** @todo May only be nullish. */
linkedLobby: ChannelRecordBase["linkedLobby"]; linkedLobby: ChannelRecordBase["linkedLobby"];
member?: undefined; member?: undefined;
@ -76,7 +74,6 @@ export declare abstract class GuildTextualChannelRecordBase extends ChannelRecor
userLimit_?: undefined; userLimit_?: undefined;
version: ChannelRecordBase["version"]; version: ChannelRecordBase["version"];
videoQualityMode?: undefined; videoQualityMode?: undefined;
voiceBackgroundDisplay?: undefined;
} }
export type GuildTextChannelProperties = Optional<PartialOnUndefined<OmitOptional<ChannelRecordOwnProperties<GuildTextChannelRecord>>>, Nullish, "guild_id" | "name" | "permissionOverwrites_" | "type">; export type GuildTextChannelProperties = Optional<PartialOnUndefined<OmitOptional<ChannelRecordOwnProperties<GuildTextChannelRecord>>>, Nullish, "guild_id" | "name" | "permissionOverwrites_" | "type">;

View file

@ -41,7 +41,6 @@ export declare abstract class GuildVocalChannelRecordBase extends ChannelRecordB
isMessageRequest?: undefined; isMessageRequest?: undefined;
isMessageRequestTimestamp?: undefined; isMessageRequestTimestamp?: undefined;
isSpam?: undefined; isSpam?: undefined;
lastMessageId: ChannelRecordBase["lastMessageId"];
lastPinTimestamp: undefined; lastPinTimestamp: undefined;
linkedLobby?: undefined; linkedLobby?: undefined;
member?: undefined; member?: undefined;
@ -73,7 +72,6 @@ export declare abstract class GuildVocalChannelRecordBase extends ChannelRecordB
userLimit_: Defined<ChannelRecordBase["userLimit_"]>; userLimit_: Defined<ChannelRecordBase["userLimit_"]>;
version: ChannelRecordBase["version"]; version: ChannelRecordBase["version"];
videoQualityMode: ChannelRecordBase["videoQualityMode"]; videoQualityMode: ChannelRecordBase["videoQualityMode"];
voiceBackgroundDisplay: Defined<ChannelRecordBase["voiceBackgroundDisplay"]>;
} }
export type GuildVoiceChannelProperties = Optional<PartialOnUndefined<OmitOptional<ChannelRecordOwnProperties<GuildVoiceChannelRecord>>>, Nullish, "guild_id" | "name" | "permissionOverwrites_">; export type GuildVoiceChannelProperties = Optional<PartialOnUndefined<OmitOptional<ChannelRecordOwnProperties<GuildVoiceChannelRecord>>>, Nullish, "guild_id" | "name" | "permissionOverwrites_">;

View file

@ -47,8 +47,6 @@ export declare abstract class PrivateChannelRecordBase extends ChannelRecordBase
isMessageRequest: ChannelRecordBase["isMessageRequest"]; isMessageRequest: ChannelRecordBase["isMessageRequest"];
isMessageRequestTimestamp: ChannelRecordBase["isMessageRequestTimestamp"]; isMessageRequestTimestamp: ChannelRecordBase["isMessageRequestTimestamp"];
isSpam: Defined<ChannelRecordBase["isSpam"]>; isSpam: Defined<ChannelRecordBase["isSpam"]>;
lastMessageId: ChannelRecordBase["lastMessageId"];
lastPinTimestamp: ChannelRecordBase["lastPinTimestamp"];
linkedLobby?: undefined; linkedLobby?: undefined;
member?: undefined; member?: undefined;
memberCount?: undefined; memberCount?: undefined;
@ -77,7 +75,6 @@ export declare abstract class PrivateChannelRecordBase extends ChannelRecordBase
userLimit_?: undefined; userLimit_?: undefined;
version?: undefined; version?: undefined;
videoQualityMode?: undefined; videoQualityMode?: undefined;
voiceBackgroundDisplay?: undefined;
} }
export type DMChannelProperties = Omit<Optional<PartialOnUndefined<OmitOptional<ChannelRecordOwnProperties<DMChannelRecord>>>, Nullish, "guild_id" | "name" | "safetyWarnings">, "rawRecipients" | "recipients"> export type DMChannelProperties = Omit<Optional<PartialOnUndefined<OmitOptional<ChannelRecordOwnProperties<DMChannelRecord>>>, Nullish, "guild_id" | "name" | "safetyWarnings">, "rawRecipients" | "recipients">

View file

@ -36,8 +36,6 @@ export declare class ThreadChannelRecord<ChannelType extends ThreadChannelType =
isMessageRequest?: undefined; isMessageRequest?: undefined;
isMessageRequestTimestamp?: undefined; isMessageRequestTimestamp?: undefined;
isSpam?: undefined; isSpam?: undefined;
lastMessageId: ChannelRecordBase["lastMessageId"];
lastPinTimestamp: ChannelRecordBase["lastMessageId"];
linkedLobby?: undefined; linkedLobby?: undefined;
member: ChannelRecordBase["member"]; member: ChannelRecordBase["member"];
memberCount: Defined<ChannelRecordBase["memberCount"]>; memberCount: Defined<ChannelRecordBase["memberCount"]>;
@ -66,5 +64,4 @@ export declare class ThreadChannelRecord<ChannelType extends ThreadChannelType =
userLimit_: undefined; userLimit_: undefined;
version?: undefined; version?: undefined;
videoQualityMode: undefined; videoQualityMode: undefined;
voiceBackgroundDisplay?: undefined;
} }

View file

@ -34,8 +34,6 @@ export declare class UnknownChannelRecord extends ChannelRecordBase {
isMessageRequest: ChannelRecordBase["isMessageRequest"]; isMessageRequest: ChannelRecordBase["isMessageRequest"];
isMessageRequestTimestamp: ChannelRecordBase["isMessageRequestTimestamp"]; isMessageRequestTimestamp: ChannelRecordBase["isMessageRequestTimestamp"];
isSpam: ChannelRecordBase["isSpam"]; isSpam: ChannelRecordBase["isSpam"];
lastMessageId: ChannelRecordBase["lastMessageId"];
lastPinTimestamp: ChannelRecordBase["lastPinTimestamp"];
linkedLobby: ChannelRecordBase["linkedLobby"]; linkedLobby: ChannelRecordBase["linkedLobby"];
member: ChannelRecordBase["member"]; member: ChannelRecordBase["member"];
memberCount: ChannelRecordBase["memberCount"]; memberCount: ChannelRecordBase["memberCount"];

File diff suppressed because one or more lines are too long

View file

@ -63,8 +63,8 @@ importers:
specifier: github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3 specifier: github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3
version: https://codeload.github.com/mattdesl/gifenc/tar.gz/64842fca317b112a8590f8fef2bf3825da8f6fe3 version: https://codeload.github.com/mattdesl/gifenc/tar.gz/64842fca317b112a8590f8fef2bf3825da8f6fe3
monaco-editor: monaco-editor:
specifier: ^0.51.0 specifier: ^0.52.0
version: 0.51.0 version: 0.52.0
nanoid: nanoid:
specifier: ^5.0.7 specifier: ^5.0.7
version: 5.0.7 version: 5.0.7
@ -1756,8 +1756,8 @@ packages:
moment@2.29.4: moment@2.29.4:
resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==} resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==}
monaco-editor@0.51.0: monaco-editor@0.52.0:
resolution: {integrity: sha512-xaGwVV1fq343cM7aOYB6lVE4Ugf0UyimdD/x5PWcWBMKENwectaEu77FAN7c5sFiyumqeJdX1RPTh1ocioyDjw==} resolution: {integrity: sha512-OeWhNpABLCeTqubfqLMXGsqf6OmPU6pHM85kF3dhy6kq5hnhuVS1p3VrEW/XhWHc71P2tHyS5JFySD8mgs1crw==}
ms@2.0.0: ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
@ -3879,7 +3879,7 @@ snapshots:
moment@2.29.4: {} moment@2.29.4: {}
monaco-editor@0.51.0: {} monaco-editor@0.52.0: {}
ms@2.0.0: {} ms@2.0.0: {}

View file

@ -0,0 +1,5 @@
# FullSearchContext
Makes the message context menu in message search results have all options you'd expect.
![](https://github.com/user-attachments/assets/472d1327-3935-44c7-b7c4-0978b5348550)

View file

@ -0,0 +1,85 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import type { ChannelRecord, MessageRecord } from "@vencord/discord-types";
import { findByPropsLazy } from "@webpack";
import { ChannelStore, ContextMenuApi, i18n, UserStore } from "@webpack/common";
import type { MouseEvent } from "react";
const { useMessageMenu } = findByPropsLazy("useMessageMenu");
function MessageMenu({ message, channel, onHeightUpdate }: {
message: MessageRecord;
channel: ChannelRecord;
onHeightUpdate: any;
}) {
const canReport = message.author.id !== UserStore.getCurrentUser()!.id && !message.author.system;
return useMessageMenu({
navId: "message-actions",
ariaLabel: i18n.Messages.MESSAGE_UTILITIES_A11Y_LABEL,
message,
channel,
canReport,
onHeightUpdate,
onClose: () => { ContextMenuApi.closeContextMenu(); },
textSelection: "",
favoriteableType: null,
favoriteableId: null,
favoriteableName: null,
itemHref: undefined,
itemSrc: undefined,
itemSafeSrc: undefined,
itemTextContent: undefined,
});
}
migratePluginSettings("FullSearchContext", "SearchReply");
export default definePlugin({
name: "FullSearchContext",
description: "Makes the message context menu in message search results have all options you'd expect",
authors: [Devs.Ven, Devs.Aria],
patches: [{
find: "onClick:this.handleMessageClick,",
replacement: {
match: /this(?=\.handleContextMenu\(\i,\i\))/,
replace: "$self"
}
}],
handleContextMenu(event: MouseEvent, message: MessageRecord) {
const channel = ChannelStore.getChannel(message.channel_id);
if (!channel) return;
event.stopPropagation();
ContextMenuApi.openContextMenu(event, contextMenuProps => (
<MessageMenu
message={message}
channel={channel}
onHeightUpdate={contextMenuProps.onHeightUpdate}
/>
));
}
});

View file

@ -1,6 +0,0 @@
# SearchReply
Adds a reply button to search results.
![the plugin in action](https://github.com/Vendicated/Vencord/assets/45497981/07e741d3-0f97-4e5c-82b0-80712ecf2cbb)

View file

@ -1,74 +0,0 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { findGroupChildrenByChildId, type NavContextMenuPatchCallback } from "@api/ContextMenu";
import { ReplyIcon } from "@components/Icons";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import type { MessageRecord } from "@vencord/discord-types";
import { findByCodeLazy } from "@webpack";
import { ChannelStore, i18n, Menu, Permissions, PermissionStore, SelectedChannelStore } from "@webpack/common";
const replyToMessage = findByCodeLazy(".TEXTAREA_FOCUS)", "showMentionToggle:");
const messageContextMenuPatch = ((children, { message }: { message: MessageRecord; }) => {
// make sure the message is in the selected channel
if (SelectedChannelStore.getChannelId() !== message.channel_id) return;
const channel = ChannelStore.getChannel(message.channel_id);
if (!channel) return;
if (!channel.isPrivate() && !PermissionStore.can(Permissions.SEND_MESSAGES, channel)) return;
// dms and group chats
const dmGroup = findGroupChildrenByChildId("pin", children);
if (dmGroup && !dmGroup.some(child => child?.props?.id === "reply")) {
const pinIndex = dmGroup.findIndex(c => c?.props.id === "pin");
dmGroup.splice(pinIndex + 1, 0, (
<Menu.MenuItem
id="reply"
label={i18n.Messages.MESSAGE_ACTION_REPLY}
icon={ReplyIcon}
action={e => { replyToMessage(channel, message, e); }}
/>
));
return;
}
// servers
const serverGroup = findGroupChildrenByChildId("mark-unread", children);
if (serverGroup && !serverGroup.some(child => child?.props?.id === "reply")) {
serverGroup.unshift((
<Menu.MenuItem
id="reply"
label={i18n.Messages.MESSAGE_ACTION_REPLY}
icon={ReplyIcon}
action={e => { replyToMessage(channel, message, e); }}
/>
));
return;
}
}) satisfies NavContextMenuPatchCallback;
export default definePlugin({
name: "SearchReply",
description: "Adds a reply button to search results",
authors: [Devs.Aria],
contextMenus: {
"message": messageContextMenuPatch
}
});

View file

@ -105,7 +105,7 @@ function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
<UserSummaryItem <UserSummaryItem
users={users} users={users}
renderIcon={false} renderIcon={false}
max={7} max={14}
size={18} size={18}
/> />
</div> </div>
@ -170,6 +170,7 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId }: VoiceChanne
<Tooltip <Tooltip
text={<VoiceChannelTooltip channel={channel} />} text={<VoiceChannelTooltip channel={channel} />}
tooltipClassName={cl("tooltip-container")} tooltipClassName={cl("tooltip-container")}
tooltipContentClassName={cl("tooltip-content")}
> >
{props => {props =>
isLocked ? isLocked ?

View file

@ -32,7 +32,7 @@ const settings = definePluginSettings({
default: true, default: true,
restartNeeded: true restartNeeded: true
}, },
showInVoiceMemberList: { showInMemberList: {
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
description: "Show a user's Voice Channel indicator in the member and DMs list", description: "Show a user's Voice Channel indicator in the member and DMs list",
default: true, default: true,
@ -82,12 +82,12 @@ export default definePlugin({
match: /\.subtext,children:.+?}\)\]}\)(?=])/, match: /\.subtext,children:.+?}\)\]}\)(?=])/,
replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})" replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})"
}, },
predicate: () => settings.store.showInVoiceMemberList predicate: () => settings.store.showInMemberList
} }
], ],
start() { start() {
if (settings.store.showInVoiceMemberList) { if (settings.store.showInMemberList) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />); addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
} }

View file

@ -15,7 +15,13 @@
} }
.vc-uvs-tooltip-container { .vc-uvs-tooltip-container {
max-width: 200px; max-width: 300px;
}
.vc-uvs-tooltip-content {
display: flex;
flex-direction: column;
gap: 6px;
} }
.vc-uvs-guild-name { .vc-uvs-guild-name {
@ -31,7 +37,5 @@
.vc-uvs-vc-members { .vc-uvs-vc-members {
display: flex; display: flex;
margin: 8px 0;
flex-direction: row;
gap: 6px; gap: 6px;
} }