Добавлен канал личных публикаций

This commit is contained in:
AidarKC
2026-11-28 01:18:53 +03:00
parent 7d3f5db206
commit d1ca64d1c1
28 changed files with 325 additions and 473 deletions
+8 -11
View File
@@ -215,11 +215,7 @@ function allFeedSummaries() {
...(feed.ownedChannels || []),
...(feed.followedUsersChannels || []),
...(feed.followedChannels || []),
].filter((summary) => {
const typeCode = Number(summary?.channel?.channelTypeCode ?? 1);
const channelName = String(summary?.channel?.channelName || '').trim().toLowerCase();
return typeCode !== 0 && channelName !== 'stories';
});
].filter((summary) => summary?.channel && !summary.channel.deleted);
}
const channelTitleByLabel = new Map();
@@ -240,7 +236,7 @@ function resolveChannelDisplayName(channelSelector) {
const found = allFeedSummaries().find((summary) => (
String(summary?.channel?.ownerBlockchainName || '') === ownerBch
&& Number(summary?.channel?.channelRoot?.blockNumber) === rootNo
&& normalizeRouteHash(summary?.channel?.channelRoot?.blockHash) === rootHash
&& (rootNo === 0 || normalizeRouteHash(summary?.channel?.channelRoot?.blockHash) === rootHash)
));
if (!found) return '';
const label = `${found.channel?.ownerLogin || t('screens.channel_thread_view.text_078')}/${found.channel?.channelName || t('screens.channel_thread_view.text_079')}`;
@@ -253,7 +249,7 @@ function resolveChannelHeadingFromNode(node) {
const ownerBch = String(info?.ownerBlockchainName || '').trim();
const rootBlockNumber = Number(info?.channelRoot?.blockNumber);
if (!ownerBch || !Number.isFinite(rootBlockNumber) || rootBlockNumber < 0) return '';
if (rootBlockNumber === 0) return t('screens.channel_thread_view.text_058');
if (rootBlockNumber === 0) return t('remaining.channels.publications');
const label = resolveChannelDisplayName({
ownerBlockchainName: ownerBch,
@@ -496,8 +492,8 @@ function openRepostModal({ navigate, channels = [], onSubmit, isActive = () => t
.map((item, index) => {
const owner = String(item?.ownerLogin || '').trim();
const name = String(item?.channelName || '').trim();
const label = `${owner || 'my'}/${name || 'channel'}`;
return `<option value="${index}">${label}</option>`;
const label = formatChannelAddress({ ownerLogin: owner, channelName: name, channelRootBlockNumber: item.selector.channelRootBlockNumber });
return `<option value="${index}">${escapeHtml(label)}</option>`;
})
.join('');
@@ -1539,6 +1535,7 @@ async function loadThreadData(sel, cacheKey, isCurrent) {
});
}
const meta = channelPayload?.channel || {};
if (Number(sel.channel.channelRootBlockNumber) === 0 && meta.channelRoot?.blockHash) sel.channel.channelRootBlockHash = normalizeRouteHash(meta.channelRoot.blockHash);
title = String(meta.displayName || meta.channelName || title).trim();
avatarAr = String(meta.avaAr || '').trim();
avatarPr = String(meta.avaPr || '').trim();
@@ -1737,6 +1734,7 @@ export function render({ navigate, route, chrome }) {
const feed = await authService.listSubscriptionsFeed(login, 1000);
if (disposed) return;
const channels = (Array.isArray(feed?.ownedChannels) ? feed.ownedChannels : [])
.filter((row) => !row?.channel?.deleted)
.map((row) => {
const selectorRow = {
ownerBlockchainName: String(row?.channel?.ownerBlockchainName || '').trim(),
@@ -1753,8 +1751,7 @@ export function render({ navigate, route, chrome }) {
selector: selectorRow,
};
})
.filter(Boolean)
.filter((item) => Number(item.channelTypeCode) !== 0 && String(item.channelName || '').trim().toLowerCase() !== 'stories');
.filter(Boolean);
if (!channels.length) throw new Error(t('screens.channel_thread_view.text_091'));
openRepostModal({