fix(ui): открыть вкладку каналов по умолчанию и исправить резолв owner/channel

This commit is contained in:
AidarKC
2026-05-19 00:41:19 +03:00
parent b85643ca33
commit f1fbb35296
4 changed files with 45 additions and 5 deletions
+20
View File
@@ -60,6 +60,13 @@ function looksLikeBlockchainName(value) {
return /^[^-]+-\d+$/.test(raw);
}
function extractLoginFromBlockchainName(value) {
const raw = String(value || '').trim();
const match = raw.match(/^(.+)-\d+$/);
if (!match) return '';
return String(match[1] || '').trim();
}
function makeReactionActionKey(messageRef) {
const login = String(state.session.login || '').trim().toLowerCase();
const blockchainName = String(messageRef?.blockchainName || '').trim();
@@ -433,6 +440,7 @@ async function loadFromApi(route, channelId) {
if (selector?.ownerBlockchainName && selector?.channelName) {
const routeOwnerRaw = String(selector.ownerBlockchainName || '').trim();
const routeOwnerNormalized = routeOwnerRaw.toLowerCase();
const routeOwnerLoginFromBch = extractLoginFromBlockchainName(routeOwnerRaw);
const allRows = await getAllRows();
let channel = allRows.find((item) => (
String(item?.channel?.ownerBlockchainName || '').trim().toLowerCase() === routeOwnerNormalized
@@ -458,6 +466,18 @@ async function loadFromApi(route, channelId) {
// ignore fallback lookup failures
}
}
if (!channel && routeOwnerLoginFromBch) {
try {
const ownerFeed = await authService.listSubscriptionsFeed(routeOwnerLoginFromBch, 500);
const ownerRows = Array.isArray(ownerFeed?.ownedChannels) ? ownerFeed.ownedChannels : [];
channel = ownerRows.find((item) => (
String(item?.channel?.ownerBlockchainName || '').trim().toLowerCase() === routeOwnerNormalized
&& String(item?.channel?.channelName || '').trim().toLowerCase() === selector.channelName.toLowerCase()
));
} catch {
// ignore owner feed lookup failures
}
}
if (!channel?.channel?.ownerBlockchainName || channel?.channel?.channelRoot?.blockNumber == null) {
throw new Error('Канал не найден.');
}