Skip to content

Commit

Permalink
Add more FIXME and explain better TODOS for migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Jan 30, 2025
1 parent b2d5c00 commit 414539f
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/plugins/_api/chatButtons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default definePlugin({
{
find: '"sticker")',
replacement: {
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /return\((!)?\i\.\i(?:\|\||&&)(?=\(\i\.isDM.+?(\i)\.push)/,
replace: (m, not, children) => not
? `${m}(Vencord.Api.ChatButtons._injectButtons(${children},arguments[0]),true)&&`
Expand Down
1 change: 1 addition & 0 deletions src/plugins/_core/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default definePlugin({
replace: (_, sectionTypes, commaOrSemi, elements, element) => `${commaOrSemi} $self.addSettings(${elements}, ${element}, ${sectionTypes}) ${commaOrSemi}`
},
{
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /({(?=.+?function (\i).{0,160}(\i)=\i\.useMemo.{0,140}return \i\.useMemo\(\(\)=>\i\(\3).+?(?:function\(\){return |\(\)=>))\2/,
replace: (_, rest, settingsHook) => `${rest}$self.wrapSettingsHook(${settingsHook})`
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/ctrlEnterSend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default definePlugin({
{
find: ".selectPreviousCommandOption(",
replacement: {
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /(?<=(\i)\.which(?:!==|===)\i\.\i.ENTER(\|\||&&)).{0,100}(\(0,\i\.\i\)\(\i\)).{0,100}(?=(?:\|\||&&)\(\i\.preventDefault)/,
replace: (_, event, condition, codeblock) => `${condition === "||" ? "!" : ""}$self.shouldSubmit(${event},${codeblock})`
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/fakeNitro/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export default definePlugin({
},
{
// Disallow the emoji for premium locked if the intention doesn't allow it
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /(!)?(\i\.\i\.canUseEmojisEverywhere\(\i\))/,
replace: (m, not) => not
? `(${m}&&!${IS_BYPASSEABLE_INTENTION})`
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/messageTags/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default definePlugin({
settings,

async start() {
// TODO: Remove DataStore tags migration once enough time has passed
// TODO(OptionType.CUSTOM Related): Remove DataStore tags migration once enough time has passed
const oldTags = await DataStore.get<Tag[]>(DATA_KEY);
if (oldTags != null) {
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletions src/plugins/openInApp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default definePlugin({
replace: "true"
},
{
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /(!)?\(0,\i\.isDesktop\)\(\)/,
replace: (_, not) => not ? "false" : "true"
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/permissionFreeWill/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default definePlugin({
find: "#{intl::ONBOARDING_CHANNEL_THRESHOLD_WARNING}",
replacement: [
{
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /{(?:\i:(?:function\(\){return |\(\)=>)\i}?,?){2}}/,
replace: m => m.replaceAll(canonicalizeMatch(/(function\(\){return |\(\)=>)\i/g), "$1()=>Promise.resolve(true)")
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/pinDms/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function moveChannel(channelId: string, direction: -1 | 1) {
swapElementsInArray(category.channels, a, b);
}

// TODO: Remove DataStore PinnedDms migration once enough time has passed
// TODO(OptionType.CUSTOM Related): Remove DataStore PinnedDms migration once enough time has passed
async function migrateData() {
if (Settings.plugins.PinDMs.dmSectioncollapsed != null) {
settings.store.dmSectionCollapsed = Settings.plugins.PinDMs.dmSectioncollapsed;
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/showHiddenChannels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default definePlugin({
},
{
// Prevent Discord from trying to connect to hidden voice channels
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /(?=(\|\||&&)\i\.\i\.selectVoiceChannel\((\i)\.id\))/,
replace: (_, condition, channel) => condition === "||"
? `||$self.isHiddenChannel(${channel})`
Expand All @@ -124,6 +125,7 @@ export default definePlugin({
{
find: ".AUDIENCE),{isSubscriptionGated",
replacement: {
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /(!)?(\i)\.isRoleSubscriptionTemplatePreviewChannel\(\)/,
replace: (m, not, channel) => not
? `${m}&&!$self.isHiddenChannel(${channel})`
Expand Down Expand Up @@ -177,6 +179,7 @@ export default definePlugin({
},
// Make voice channels also appear as muted if they are muted
{
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /(?<=\.wrapper:\i\.notInteractive,)(.+?)(if\()?(\i)(?:\)return |\?)(\i\.MUTED)/,
replace: (_, otherClasses, isIf, isMuted, mutedClassExpression) => isIf
? `${isMuted}?${mutedClassExpression}:"",${otherClasses}if(${isMuted})return ""`
Expand All @@ -190,6 +193,7 @@ export default definePlugin({
{
// Make muted channels also appear as unread if hide unreads is false, using the HiddenIconWithMutedStyle and the channel is hidden
predicate: () => settings.store.hideUnreads === false && settings.store.showMode === ShowMode.HiddenIconWithMutedStyle,
// FIXME(Bundler change related): Remove old compatiblity once enough time has passed
match: /(?<=\.LOCKED(?:;if\(|:))(?<={channel:(\i).+?)/,
replace: (_, channel) => `!$self.isHiddenChannel(${channel})&&`
},
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/textReplace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export default definePlugin({
},

async start() {
// TODO: Remove DataStore rules migrations once enough time has passed
// TODO(OptionType.CUSTOM Related): Remove DataStore rules migrations once enough time has passed
const oldStringRules = await DataStore.get<Rule[]>(STRING_RULES_KEY);
if (oldStringRules != null) {
settings.store.stringRules = oldStringRules;
Expand Down

0 comments on commit 414539f

Please sign in to comment.