Create codemod for updating Toast calls to v2 (#10045)

This commit is contained in:
DS Boyce
2026-03-12 11:35:58 -07:00
committed by GitHub
parent 9c9970f680
commit 35cb2bcf94
62 changed files with 422 additions and 171 deletions
+19 -7
View File
@@ -22,7 +22,6 @@ import {
} from '#/state/queries/profile'
import {useSession} from '#/state/session'
import {EventStopper} from '#/view/com/util/EventStopper'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button'
import {useDialogControl} from '#/components/Dialog'
@@ -52,6 +51,7 @@ import {
useReportDialogControl,
} from '#/components/moderation/ReportDialog'
import * as Prompt from '#/components/Prompt'
import * as Toast from '#/components/Toast'
import {useFullVerificationState} from '#/components/verification'
import {VerificationCreatePrompt} from '#/components/verification/VerificationCreatePrompt'
import {VerificationRemovePrompt} from '#/components/verification/VerificationRemovePrompt'
@@ -149,7 +149,9 @@ let ProfileMenu = ({
} catch (e: any) {
if (e?.name !== 'AbortError') {
ax.logger.error('Failed to unmute account', {message: e})
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
type: 'error',
})
}
}
} else {
@@ -159,7 +161,9 @@ let ProfileMenu = ({
} catch (e: any) {
if (e?.name !== 'AbortError') {
ax.logger.error('Failed to mute account', {message: e})
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
type: 'error',
})
}
}
}
@@ -173,7 +177,9 @@ let ProfileMenu = ({
} catch (e: any) {
if (e?.name !== 'AbortError') {
ax.logger.error('Failed to unblock account', {message: e})
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
type: 'error',
})
}
}
} else {
@@ -183,7 +189,9 @@ let ProfileMenu = ({
} catch (e: any) {
if (e?.name !== 'AbortError') {
ax.logger.error('Failed to block account', {message: e})
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
type: 'error',
})
}
}
}
@@ -196,7 +204,9 @@ let ProfileMenu = ({
} catch (e: any) {
if (e?.name !== 'AbortError') {
ax.logger.error('Failed to follow account', {message: e})
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
type: 'error',
})
}
}
}, [_, ax, queueFollow])
@@ -208,7 +218,9 @@ let ProfileMenu = ({
} catch (e: any) {
if (e?.name !== 'AbortError') {
ax.logger.error('Failed to unfollow account', {message: e})
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
Toast.show(_(msg`There was an issue! ${e.toString()}`), {
type: 'error',
})
}
}
}, [_, ax, queueUnfollow])