mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-04-20 14:44:45 +08:00
fix(ui): extend mixed channel check to both Antigravity and Anthropic accounts
Problem: - When creating Anthropic Console accounts to groups with Antigravity accounts, the mixed channel warning was not triggered - Only Antigravity accounts triggered the confirmation dialog Solution: - Renamed isAntigravityAccount to needsMixedChannelCheck - Extended check to include both 'antigravity' and 'anthropic' platforms - Updated all 8 call sites in CreateAccountModal and EditAccountModal Changes: - frontend/src/components/account/CreateAccountModal.vue: 4 updates - frontend/src/components/account/EditAccountModal.vue: 4 updates Testing: - Frontend compilation: passed - Backend unit tests: passed - OAuth flow: confirmation parameter correctly passed in Step 2 - Backend compatibility: verified with checkMixedChannelRisk logic Impact: - Both Antigravity and Anthropic accounts now show mixed channel warning - OAuth accounts correctly pass confirm_mixed_channel_risk parameter - No breaking changes to existing functionality
This commit is contained in:
@@ -1 +1 @@
|
|||||||
0.1.81.9
|
0.1.81.10
|
||||||
|
|||||||
@@ -2545,7 +2545,7 @@ const splitTempUnschedKeywords = (value: string) => {
|
|||||||
.filter((item) => item.length > 0)
|
.filter((item) => item.length > 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
const isAntigravityAccount = (platform: AccountPlatform) => platform === 'antigravity'
|
const needsMixedChannelCheck = (platform: AccountPlatform) => platform === 'antigravity' || platform === 'anthropic'
|
||||||
|
|
||||||
const buildMixedChannelDetails = (resp?: CheckMixedChannelResponse) => {
|
const buildMixedChannelDetails = (resp?: CheckMixedChannelResponse) => {
|
||||||
const details = resp?.details
|
const details = resp?.details
|
||||||
@@ -2579,7 +2579,7 @@ const openMixedChannelDialog = (opts: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const withAntigravityConfirmFlag = (payload: CreateAccountRequest): CreateAccountRequest => {
|
const withAntigravityConfirmFlag = (payload: CreateAccountRequest): CreateAccountRequest => {
|
||||||
if (isAntigravityAccount(payload.platform) && antigravityMixedChannelConfirmed.value) {
|
if (needsMixedChannelCheck(payload.platform) && antigravityMixedChannelConfirmed.value) {
|
||||||
return {
|
return {
|
||||||
...payload,
|
...payload,
|
||||||
confirm_mixed_channel_risk: true
|
confirm_mixed_channel_risk: true
|
||||||
@@ -2591,7 +2591,7 @@ const withAntigravityConfirmFlag = (payload: CreateAccountRequest): CreateAccoun
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ensureAntigravityMixedChannelConfirmed = async (onConfirm: () => Promise<void>): Promise<boolean> => {
|
const ensureAntigravityMixedChannelConfirmed = async (onConfirm: () => Promise<void>): Promise<boolean> => {
|
||||||
if (!isAntigravityAccount(form.platform)) {
|
if (!needsMixedChannelCheck(form.platform)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (antigravityMixedChannelConfirmed.value) {
|
if (antigravityMixedChannelConfirmed.value) {
|
||||||
@@ -2628,7 +2628,7 @@ const submitCreateAccount = async (payload: CreateAccountRequest) => {
|
|||||||
emit('created')
|
emit('created')
|
||||||
handleClose()
|
handleClose()
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.response?.status === 409 && error.response?.data?.error === 'mixed_channel_warning' && isAntigravityAccount(form.platform)) {
|
if (error.response?.status === 409 && error.response?.data?.error === 'mixed_channel_warning' && needsMixedChannelCheck(form.platform)) {
|
||||||
openMixedChannelDialog({
|
openMixedChannelDialog({
|
||||||
message: error.response?.data?.message,
|
message: error.response?.data?.message,
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
|
|||||||
@@ -1535,7 +1535,7 @@ function toPositiveNumber(value: unknown) {
|
|||||||
return Math.trunc(num)
|
return Math.trunc(num)
|
||||||
}
|
}
|
||||||
|
|
||||||
const isAntigravityAccount = () => props.account?.platform === 'antigravity'
|
const needsMixedChannelCheck = () => props.account?.platform === 'antigravity' || props.account?.platform === 'anthropic'
|
||||||
|
|
||||||
const buildMixedChannelDetails = (resp?: CheckMixedChannelResponse) => {
|
const buildMixedChannelDetails = (resp?: CheckMixedChannelResponse) => {
|
||||||
const details = resp?.details
|
const details = resp?.details
|
||||||
@@ -1569,7 +1569,7 @@ const openMixedChannelDialog = (opts: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const withAntigravityConfirmFlag = (payload: Record<string, unknown>) => {
|
const withAntigravityConfirmFlag = (payload: Record<string, unknown>) => {
|
||||||
if (isAntigravityAccount() && antigravityMixedChannelConfirmed.value) {
|
if (needsMixedChannelCheck() && antigravityMixedChannelConfirmed.value) {
|
||||||
return {
|
return {
|
||||||
...payload,
|
...payload,
|
||||||
confirm_mixed_channel_risk: true
|
confirm_mixed_channel_risk: true
|
||||||
@@ -1581,7 +1581,7 @@ const withAntigravityConfirmFlag = (payload: Record<string, unknown>) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ensureAntigravityMixedChannelConfirmed = async (onConfirm: () => Promise<void>): Promise<boolean> => {
|
const ensureAntigravityMixedChannelConfirmed = async (onConfirm: () => Promise<void>): Promise<boolean> => {
|
||||||
if (!isAntigravityAccount()) {
|
if (!needsMixedChannelCheck()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (antigravityMixedChannelConfirmed.value) {
|
if (antigravityMixedChannelConfirmed.value) {
|
||||||
@@ -1632,7 +1632,7 @@ const submitUpdateAccount = async (accountID: number, updatePayload: Record<stri
|
|||||||
emit('updated')
|
emit('updated')
|
||||||
handleClose()
|
handleClose()
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error.response?.status === 409 && error.response?.data?.error === 'mixed_channel_warning' && isAntigravityAccount()) {
|
if (error.response?.status === 409 && error.response?.data?.error === 'mixed_channel_warning' && needsMixedChannelCheck()) {
|
||||||
openMixedChannelDialog({
|
openMixedChannelDialog({
|
||||||
message: error.response?.data?.message,
|
message: error.response?.data?.message,
|
||||||
onConfirm: async () => {
|
onConfirm: async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user