fix(ui): открыть вкладку каналов по умолчанию и исправить резолв owner/channel
This commit is contained in:
parent
b85643ca33
commit
f1fbb35296
@ -1,2 +1,2 @@
|
||||
client.version=1.2.60
|
||||
server.version=1.2.54
|
||||
client.version=1.2.61
|
||||
server.version=1.2.55
|
||||
|
||||
@ -76,7 +76,7 @@ function installChannelsHoldSwitcher(button, navigate) {
|
||||
let pressed = false;
|
||||
let holdActive = false;
|
||||
let overlay = null;
|
||||
let selectedMode = 'dialogs';
|
||||
let selectedMode = 'feed';
|
||||
|
||||
const clearTimer = () => {
|
||||
if (holdTimer) {
|
||||
@ -120,7 +120,7 @@ function installChannelsHoldSwitcher(button, navigate) {
|
||||
button.addEventListener('pointerdown', (event) => {
|
||||
pressed = true;
|
||||
holdActive = false;
|
||||
selectedMode = 'dialogs';
|
||||
selectedMode = 'feed';
|
||||
clearTimer();
|
||||
holdTimer = window.setTimeout(() => {
|
||||
if (!pressed) return;
|
||||
@ -143,7 +143,7 @@ function installChannelsHoldSwitcher(button, navigate) {
|
||||
navigate(`channels-list/${mode}`);
|
||||
return;
|
||||
}
|
||||
navigate('channels-list/dialogs');
|
||||
navigate('channels-list/feed');
|
||||
});
|
||||
|
||||
button.addEventListener('pointercancel', () => {
|
||||
|
||||
@ -54,6 +54,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();
|
||||
@ -588,6 +595,7 @@ export function render({ navigate, route }) {
|
||||
];
|
||||
const ownerRaw = String(selector.short.ownerBlockchainName || '').trim();
|
||||
const ownerNormalized = ownerRaw.toLowerCase();
|
||||
const ownerLoginFromBch = extractLoginFromBlockchainName(ownerRaw);
|
||||
const channelNameNormalized = String(selector.short.channelName || '').trim().toLowerCase();
|
||||
let channel = allRows.find((item) => (
|
||||
String(item?.channel?.ownerBlockchainName || '').trim().toLowerCase() === ownerNormalized
|
||||
@ -613,6 +621,18 @@ export function render({ navigate, route }) {
|
||||
// ignore fallback lookup errors
|
||||
}
|
||||
}
|
||||
if (!channel && ownerLoginFromBch) {
|
||||
try {
|
||||
const ownerFeed = await authService.listSubscriptionsFeed(ownerLoginFromBch, 500);
|
||||
const ownerRows = Array.isArray(ownerFeed?.ownedChannels) ? ownerFeed.ownedChannels : [];
|
||||
channel = ownerRows.find((item) => (
|
||||
String(item?.channel?.ownerBlockchainName || '').trim().toLowerCase() === ownerNormalized
|
||||
&& String(item?.channel?.channelName || '').trim().toLowerCase() === channelNameNormalized
|
||||
));
|
||||
} catch {
|
||||
// ignore owner feed lookup errors
|
||||
}
|
||||
}
|
||||
const ownerBch = String(channel?.channel?.ownerBlockchainName || '').trim();
|
||||
const rootNo = Number(channel?.channel?.channelRoot?.blockNumber);
|
||||
const rootHash = normalizeRouteHash(channel?.channel?.channelRoot?.blockHash);
|
||||
|
||||
@ -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('Канал не найден.');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user