Отключить мультиаккаунтность и уточнить статусы профиля

This commit is contained in:
AidarKC
2026-11-27 13:22:15 +03:00
parent ae430e84c7
commit 91a8bb9c3c
40 changed files with 312 additions and 383 deletions
+2 -32
View File
@@ -26,15 +26,6 @@ export const PROFILE_SHINE_SHINING = 'shining';
export const PROFILE_SHINE_UNKNOWN = 'unknown';
export const PROFILE_SHINE_NOT_INTERESTED = 'not_interested';
export const PROFILE_GENDER_MALE = 'male';
export const PROFILE_GENDER_FEMALE = 'female';
export const PROFILE_GENDER_UNKNOWN = 'unknown';
export const PROFILE_GENDER_VALUES = Object.freeze([
PROFILE_GENDER_MALE,
PROFILE_GENDER_FEMALE,
PROFILE_GENDER_UNKNOWN,
]);
function normalizeItem(param, payload) {
if (!param) return null;
@@ -53,13 +44,6 @@ function parseToggleValue(value) {
return normalized === 'true' || normalized === 'yes' || normalized === '1';
}
function normalizeGenderValue(value) {
const normalized = String(value || '').trim().toLowerCase();
if (normalized === PROFILE_GENDER_MALE) return PROFILE_GENDER_MALE;
if (normalized === PROFILE_GENDER_FEMALE) return PROFILE_GENDER_FEMALE;
return PROFILE_GENDER_UNKNOWN;
}
async function getStoragePwd() {
const storagePwd = state.session.storagePwdInMemory;
if (!storagePwd) {
@@ -75,7 +59,7 @@ function normalizeListItems(payload) {
const row = rows[i];
if (!row || typeof row !== 'object') continue;
const param = String(row.param || '').trim();
if (!param) continue;
if (!param || param.toLowerCase() === 'gender') continue;
const item = normalizeItem(param, row);
if (item) normalized.push(item);
}
@@ -135,8 +119,6 @@ export async function loadProfileSnapshot(login) {
{ key: 'shine', get label() { return t('remaining.profile_fields.shine'); }, enabled: shineStatus === PROFILE_SHINE_SHINING, rawValue: shineStatus, timeMs: latestShine?.timeMs || 0 },
];
const latestGender = loadLatestByAliasesFromItems(items, ['gender']);
const gender = normalizeGenderValue(latestGender?.value || PROFILE_GENDER_UNKNOWN);
const latestAvatar = loadLatestByAliasesFromItems(items, ['ava']);
const parsedAvatar = parseAvatarReference(latestAvatar?.value || '');
const avatar = parsedAvatar.ok
@@ -168,8 +150,6 @@ export async function loadProfileSnapshot(login) {
accountRoleTimeMs: latestAccountRole?.timeMs || 0,
shineStatus,
shineTimeMs: latestShine?.timeMs || 0,
gender,
genderTimeMs: latestGender?.timeMs || 0,
avatar,
};
}
@@ -181,6 +161,7 @@ export function profileDisplayName(snapshot, fallback = '') {
}
export async function saveProfileParamBlock(login, key, value) {
if (String(key).trim().toLowerCase() === 'gender') throw new Error('gender_disabled');
const storagePwd = await getStoragePwd();
await authService.addBlockUserParam({
login,
@@ -210,17 +191,6 @@ export async function saveProfileToggle(login, key, enabled) {
throw new Error(`Неизвестный legacy toggle: ${key}`);
}
export async function saveProfileGender(login, gender) {
const normalized = normalizeGenderValue(gender);
const storagePwd = await getStoragePwd();
await authService.addBlockUserParam({
login,
param: 'gender',
value: normalized,
storagePwd,
});
}
export async function saveProfileAvatar(login, avatar) {
const ar = String(avatar?.ar || '').trim();
const pr = String(avatar?.pr || '').trim();