Поправил пуши для личных сообщений

This commit is contained in:
AidarKC
2026-10-21 11:47:27 +03:00
parent aa5addb5d9
commit 7a6ab3b35a
22 changed files with 723 additions and 678 deletions
+16 -1
View File
@@ -5,14 +5,29 @@
// Сервер не трогаем: знакомства – из графа связей каждого человека, подписки – из списка
// «Подписки» его профиля (публичные каналы), город – из параметра city его профиля.
import { state } from '../../state.js';
import { CONNECTIONS_GRAPH_CHANGED } from '../../services/connections-graph-cache.js';
const PREFIX = { ties: 'shine-network-ties-v1:', subs: 'shine-network-subs-v1:', cities: 'shine-network-cities-v1:' };
const PREFIX = { ties: 'shine-network-ties-v2:', subs: 'shine-network-subs-v1:', cities: 'shine-network-cities-v1:' };
export const PEOPLE_DATA_FRESH_MS = 12 * 60 * 60 * 1000; // старше – освежаются в фоне
const TYPE_CODE = { close_friend: 3, family: 3, friend: 2, contact: 1 };
const CODE_TYPE = { 3: 'close_friend', 2: 'friend', 1: 'contact' };
const memory = new Map(); // `${kind}|${owner}|${center}` → запись
let peopleGeneration = 0;
export function peopleDataGeneration() { return peopleGeneration; }
export function invalidatePeopleData() {
peopleGeneration += 1;
memory.clear();
const owner = ownerLogin();
if (!owner) return;
for (const prefix of Object.values(PREFIX)) {
try { localStorage.removeItem(prefix + owner); } catch { /* хранилище может быть недоступно */ }
}
}
if (typeof window !== 'undefined') window.addEventListener(CONNECTIONS_GRAPH_CHANGED, invalidatePeopleData);
function ownerLogin() {
return String(state.session?.login || '').trim().toLowerCase();
}