fix(settings): code-managed keys in advanced panel only
Align can_edit lists with deploy SQL: runtime Montzar/price keys stay in tenant advanced settings (read-only), not super admin catalog. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -214,6 +214,7 @@ import {
|
||||
formatValueForSave,
|
||||
helpText,
|
||||
isSettingVisible,
|
||||
isCodeManagedSettingKey,
|
||||
isSettingLocked,
|
||||
isSettingActive,
|
||||
isSwitchOn,
|
||||
@@ -308,6 +309,7 @@ const filteredRows = computed(() =>
|
||||
(baseData.value || []).filter((row) => {
|
||||
if (row.id == null || !matchesFilter(row)) return false
|
||||
if (!isSettingVisible(row.key)) return false
|
||||
if (isCodeManagedSettingKey(row.key) && !isSystemMode.value) return false
|
||||
if (isSystemMode.value) return true
|
||||
return isEditable(row)
|
||||
})
|
||||
@@ -427,6 +429,7 @@ function rowColSpan(row: Const): number {
|
||||
}
|
||||
|
||||
function isReadonly(row: Const): boolean {
|
||||
if (isCodeManagedSettingKey(row.key)) return true
|
||||
if (isSystemMode.value) return false
|
||||
return isSettingLocked(row.can_edit)
|
||||
}
|
||||
|
||||
@@ -174,6 +174,31 @@ export function supportMessengerIdPlaceholder(messenger?: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* کلیدهایی که کد tenant مستقیم مینویسد — can_edit=1 در DB (خارج از سوپرادمین)،
|
||||
* فقط در «تنظیمات پیشرفته» دیده میشوند و از UI قابل ویرایش نیستند.
|
||||
* همتراز SuperAdminProgramSettingsOverlay::RUNTIME_KEYS (+ tracking_systems جدا).
|
||||
*/
|
||||
export const SETTING_CODE_MANAGED_KEYS = new Set([
|
||||
'montzar_last_product_log',
|
||||
'montzar_order_response',
|
||||
'montzar_live_price',
|
||||
'montzar_mazaneh',
|
||||
'montzar_diff',
|
||||
'montzar_truly_buy_mazaneh',
|
||||
'montzar_truly_sell_mazaneh',
|
||||
'montzar_token',
|
||||
'montzar_closed',
|
||||
'up_price',
|
||||
'down_price',
|
||||
'price_extreme_date',
|
||||
'do_send_liman',
|
||||
])
|
||||
|
||||
export function isCodeManagedSettingKey(key?: string | null): boolean {
|
||||
return SETTING_CODE_MANAGED_KEYS.has(String(key ?? '').trim())
|
||||
}
|
||||
|
||||
/** کلیدهای legacy — در پنل نمایش داده نمیشوند */
|
||||
export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
|
||||
'main_product_price',
|
||||
@@ -183,9 +208,6 @@ export const HIDDEN_LEGACY_SETTING_KEYS = new Set([
|
||||
'goldir_price',
|
||||
'price_primary_source',
|
||||
'price_method',
|
||||
'montzar_last_product_log',
|
||||
'montzar_order_response',
|
||||
'service_charge_percentage',
|
||||
'support_messenger',
|
||||
'support_messenger_id',
|
||||
// JSON از صفحهٔ اختصاصی «سایتهای ریگیری» مدیریت میشود؛ سوییچ نمایش در تنظیمات میماند
|
||||
@@ -1099,17 +1121,14 @@ export const SETTING_LOCKED_KEYS = new Set([
|
||||
'logo_login', 'logo_register', 'title_pwa', 'title_fav',
|
||||
'main_product', 'main_wallet_products', 'metal_type', 'main_metal',
|
||||
'montify_name',
|
||||
'montzar_base_url', 'montzar_closed',
|
||||
'montzar_diff', 'montzar_last_product_log', 'montzar_live_price', 'montzar_mazaneh',
|
||||
'montzar_order_response', 'montzar_token',
|
||||
'montzar_truly_buy_mazaneh', 'montzar_truly_sell_mazaneh',
|
||||
'montzar_base_url',
|
||||
'node_client_id', 'node_shared_secret',
|
||||
'payping_fin_customer_id', 'payping_fin_sync_enabled', 'payping_fin_token', 'payping_fin_url',
|
||||
'payping_gateway_items', 'payping_gateway_name',
|
||||
'payping_round_toman', 'payping_start_url', 'payping_strict_failed_withdraw', 'payping_verify_url',
|
||||
'permision__enabled',
|
||||
'price_extreme_date', 'price_provider', 'profit_gold_api_enabled',
|
||||
'send_to_tahesab', 'send_to_pargar', 'accounting_provider', 'service_charge_percentage',
|
||||
'price_provider', 'profit_gold_api_enabled',
|
||||
'send_to_tahesab', 'send_to_pargar', 'accounting_provider',
|
||||
'sse_path',
|
||||
'tahesab_bank_account', 'tahesab_db', 'tahesab_host', 'tahesab_port', 'tahesab_token',
|
||||
'zarin_api', 'zarin_token', 'zarin_noe_kar', 'zarin_gorohe_kar', 'zarin_name_g', 'zarin_uid_prefix',
|
||||
@@ -1120,7 +1139,6 @@ export const SETTING_LOCKED_KEYS = new Set([
|
||||
'price_channel_access',
|
||||
'price_channel_bale_to', 'price_channel_telegram_to', 'price_channel_rubika_to',
|
||||
'unit',
|
||||
'up_price', 'down_price',
|
||||
'wss_enabled',
|
||||
'zaarbox_api_url',
|
||||
'show_to_users_chat', 'chat_api', 'chat_api_key', 'chat_upload_url', 'chat_download_url'
|
||||
@@ -1150,6 +1168,9 @@ export const SETTING_EDITABLE_KEYS = new Set([
|
||||
'min_first_buy', 'min_withdraw', 'min_deposit', 'minimum_sell',
|
||||
'montzar_mobile', 'montzar_open_buy', 'montzar_open_sell',
|
||||
'montzar_password', 'montzar_product_id',
|
||||
'montzar_closed', 'montzar_diff', 'montzar_last_product_log', 'montzar_live_price', 'montzar_mazaneh',
|
||||
'montzar_order_response', 'montzar_token',
|
||||
'montzar_truly_buy_mazaneh', 'montzar_truly_sell_mazaneh',
|
||||
'open_register',
|
||||
'referral_id', 'referral_limit', 'referral_gift_on_first_order', 'referral_gift_buy_from_montzar',
|
||||
'register_jibit_verify', 'register_referral_bonus_message', 'register_referral_sms_to_referrer',
|
||||
@@ -1158,6 +1179,7 @@ export const SETTING_EDITABLE_KEYS = new Set([
|
||||
'products_site_link_enabled', 'products_site_link_url', 'products_site_link_text',
|
||||
'startDay',
|
||||
'support_messengers', 'support_messenger_text',
|
||||
'up_price', 'down_price', 'price_extreme_date', 'do_send_liman',
|
||||
'has_chat',
|
||||
'deposit_support_message_text', 'deposit_account_holder', 'deposit_card_number', 'deposit_account_number', 'deposit_sheba',
|
||||
'deposit_method_card_to_card', 'deposit_method_gateway', 'deposit_method_identified', 'deposit_method_shetab',
|
||||
|
||||
Reference in New Issue
Block a user