mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
fix(updater): use channel display labels in mac-only error (#12175)
This commit is contained in:
@@ -246,6 +246,34 @@ describe('updater', () => {
|
||||
expect(powerMonitorOnMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it.each([
|
||||
['hourly', 'v1.4.160-hourly.202607281400', 'Hourly builds are produced only for macOS.'],
|
||||
['adhoc', 'v1.4.160-adhoc.20260728140533', 'Adhoc builds are produced only for macOS.']
|
||||
] as const)(
|
||||
'uses the display label in the mac-only %s pinned-build error',
|
||||
async (channel, tag, message) => {
|
||||
const platformSpy = vi.spyOn(process, 'platform', 'get').mockReturnValue('linux')
|
||||
try {
|
||||
const send = vi.fn()
|
||||
const { setupAutoUpdater, checkForUpdatesFromMenu } = await import('./updater')
|
||||
setupAutoUpdater({ webContents: { send } } as never, {
|
||||
getLastUpdateCheckAt: () => Date.now()
|
||||
})
|
||||
|
||||
checkForUpdatesFromMenu({ channel, targetTag: tag })
|
||||
|
||||
expect(send).toHaveBeenCalledWith('updater:status', {
|
||||
state: 'error',
|
||||
message,
|
||||
userInitiated: true
|
||||
})
|
||||
expect(autoUpdaterMock.checkForUpdates).not.toHaveBeenCalled()
|
||||
} finally {
|
||||
platformSpy.mockRestore()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
it.runIf(process.platform === 'darwin')(
|
||||
'allows a validated local build to downgrade through the normal updater lifecycle',
|
||||
async () => {
|
||||
|
||||
+2
-1
@@ -71,6 +71,7 @@ import { listReleaseBuilds, resolveTargetBuild } from './updater-release-builds'
|
||||
import {
|
||||
hasDedicatedReleaseRepo,
|
||||
isChannelSupportedOnPlatform,
|
||||
RELEASE_CHANNEL_LABELS,
|
||||
type ReleaseBuild,
|
||||
type ReleaseChannel
|
||||
} from '../shared/release-channel'
|
||||
@@ -1680,7 +1681,7 @@ async function checkForPinnedBuild(channel: ReleaseChannel, tag: string): Promis
|
||||
if (!isChannelSupportedOnPlatform(channel, process.platform)) {
|
||||
sendStatus({
|
||||
state: 'error',
|
||||
message: `${channel} builds are produced only for macOS.`,
|
||||
message: `${RELEASE_CHANNEL_LABELS[channel]} builds are produced only for macOS.`,
|
||||
userInitiated: true
|
||||
})
|
||||
return
|
||||
|
||||
@@ -11,6 +11,7 @@ import { translate } from '@/i18n/i18n'
|
||||
import { getShortcutPlatform } from '@/lib/shortcut-platform'
|
||||
import {
|
||||
RELEASE_CHANNELS,
|
||||
RELEASE_CHANNEL_LABELS,
|
||||
getVersionChannel,
|
||||
hasDedicatedReleaseRepo,
|
||||
isChannelSupportedOnPlatform,
|
||||
@@ -19,13 +20,6 @@ import {
|
||||
type ReleaseChannel
|
||||
} from '../../../../shared/release-channel'
|
||||
|
||||
const CHANNEL_LABELS: Record<ReleaseChannel, string> = {
|
||||
stable: 'Stable',
|
||||
rc: 'RC',
|
||||
hourly: 'Hourly',
|
||||
adhoc: 'Adhoc'
|
||||
}
|
||||
|
||||
const CHANNEL_DESCRIPTIONS: Record<ReleaseChannel, string> = {
|
||||
stable: 'Shipped releases. What everyone else is running.',
|
||||
rc: 'Release candidates cut ahead of each stable.',
|
||||
@@ -200,10 +194,10 @@ export function ReleaseChannelSection(): React.JSX.Element {
|
||||
return {
|
||||
value: channel,
|
||||
label: supported ? (
|
||||
CHANNEL_LABELS[channel]
|
||||
RELEASE_CHANNEL_LABELS[channel]
|
||||
) : (
|
||||
<span className="inline-flex items-center gap-1">
|
||||
{CHANNEL_LABELS[channel]}
|
||||
{RELEASE_CHANNEL_LABELS[channel]}
|
||||
<Apple className="size-3" aria-hidden="true" />
|
||||
</span>
|
||||
),
|
||||
@@ -213,14 +207,14 @@ export function ReleaseChannelSection(): React.JSX.Element {
|
||||
: translate(
|
||||
'auto.components.settings.ReleaseChannelSection.devChannelMacOnlyAria',
|
||||
'{{value0}} (macOS only)',
|
||||
{ value0: CHANNEL_LABELS[channel] }
|
||||
{ value0: RELEASE_CHANNEL_LABELS[channel] }
|
||||
),
|
||||
tooltip: supported
|
||||
? undefined
|
||||
: translate(
|
||||
'auto.components.settings.ReleaseChannelSection.devChannelMacOnly',
|
||||
'{{value0}} builds are produced only for macOS. Linux and Windows stay on Stable or RC.',
|
||||
{ value0: CHANNEL_LABELS[channel] }
|
||||
{ value0: RELEASE_CHANNEL_LABELS[channel] }
|
||||
)
|
||||
}
|
||||
})}
|
||||
|
||||
@@ -4,6 +4,13 @@ export type ReleaseChannel = 'stable' | 'rc' | 'hourly' | 'adhoc'
|
||||
|
||||
export const RELEASE_CHANNELS: readonly ReleaseChannel[] = ['stable', 'rc', 'hourly', 'adhoc']
|
||||
|
||||
export const RELEASE_CHANNEL_LABELS: Readonly<Record<ReleaseChannel, string>> = {
|
||||
stable: 'Stable',
|
||||
rc: 'RC',
|
||||
hourly: 'Hourly',
|
||||
adhoc: 'Adhoc'
|
||||
}
|
||||
|
||||
/** Dev builds live in their own repos so their tags never enter the main
|
||||
* releases atom feed, which only exposes the 10 newest entries — 24 hourly
|
||||
* tags a day would evict every stable/RC entry and strand real users. */
|
||||
|
||||
Reference in New Issue
Block a user