SHA256
Добавить текстовые ссылки SHiNE
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { mountPublicChannelSidebar } from '../services/public-channel-sidebar.js';
|
||||
import { appendShineMessageLinks } from '../services/shine-message-links.js';
|
||||
import { confirmDialog } from '../components/confirm-dialog.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import { rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
softHaptic,
|
||||
} from '../services/channels-ux.js';
|
||||
import { getPreviousTrackedPath, parseRouteFromPath } from '../router.js';
|
||||
import { renderUserAvatar } from '../components/avatar-image.js';
|
||||
import { renderAvatar, renderUserAvatar } from '../components/avatar-image.js';
|
||||
import { openChannelEditor } from '../components/channel-editor.js';
|
||||
import { createDropdownMenu } from '../components/dropdown-menu.js';
|
||||
import { createEmojiPicker } from '../components/emoji-picker.js';
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
} from '../services/attachment-format.js';
|
||||
import { loadProfileSnapshot } from '../services/user-profile-params.js';
|
||||
import { extractLoginFromBlockchainName, makeProfileRoute, makeShineChannelRoute, makeShineMessageRoute } from '../services/shine-routes.js';
|
||||
import { parsePublicationOrdinal, publicationAtOrdinal, ordinalForPublication } from '../services/channel-message-ordinals.js';
|
||||
|
||||
export const pageMeta = { id: 'channel-thread-view', title: 'Обсуждение', hideToolbar: true, shellMode: { scrollbar: 'hidden', topFade: false, contentUnderTopbar: false, contentWidth: 'wide' } };
|
||||
const MSG_SUBTYPE_TEXT_POST = 10;
|
||||
@@ -159,16 +160,17 @@ function buildAbsoluteRouteUrl(routePath = '') {
|
||||
|
||||
function parseThreadSelector(route) {
|
||||
const params = route?.params || {};
|
||||
if (params.ownerBlockchainName && params.channelName && params.messageBlockNumber) {
|
||||
if (params.ownerBlockchainName && params.channelName && params.messageOrdinal) {
|
||||
return {
|
||||
short: {
|
||||
ownerBlockchainName: String(params.ownerBlockchainName || '').trim(),
|
||||
channelName: String(params.channelName || '').trim(),
|
||||
},
|
||||
publicationOrdinal: parsePublicationOrdinal(params.messageOrdinal),
|
||||
message: {
|
||||
blockchainName: '',
|
||||
blockNumber: toSafeInt(params.messageBlockNumber),
|
||||
blockHash: normalizeRouteHash(params.messageBlockHash),
|
||||
blockNumber: null,
|
||||
blockHash: '',
|
||||
},
|
||||
channel: {
|
||||
ownerBlockchainName: '',
|
||||
@@ -323,13 +325,20 @@ async function resolveChannelDisplayNameFromServer(channelSelector) {
|
||||
}
|
||||
}
|
||||
|
||||
function buildThreadRouteFromTarget(target, selector) {
|
||||
function buildThreadRouteFromTarget(target, selector, focusOrdinal = null) {
|
||||
if (!target) return '';
|
||||
const ownerBch = String(selector?.short?.ownerBlockchainName || selector?.channel?.ownerBlockchainName || '').trim();
|
||||
const ownerBch = String(selector?.channel?.ownerBlockchainName || selector?.short?.ownerBlockchainName || '').trim();
|
||||
const focus = selector?.message;
|
||||
const sameFocus = !!focus && Number(focus.blockNumber) === Number(target.blockNumber)
|
||||
&& String(focus.blockchainName || '').toLowerCase() === String(target.blockchainName || '').toLowerCase();
|
||||
return makeShineMessageRoute({
|
||||
ownerLogin: extractLoginFromBlockchainName(ownerBch) || extractLoginFromBlockchainName(target.blockchainName),
|
||||
messageBlockchainName: target.blockchainName,
|
||||
messageBlockNumber: target.blockNumber,
|
||||
// A channel link needs the POST ordinal; replies still use their technical address.
|
||||
messageOrdinal: sameFocus ? focusOrdinal : '',
|
||||
channelName: sameFocus ? selector?.short?.channelName || '' : '',
|
||||
channelOwnerBlockchainName: ownerBch,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -649,9 +658,12 @@ function openEditMessageModal({ initialText = '', allowEmptyText = false, onSave
|
||||
});
|
||||
}
|
||||
|
||||
function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
function renderNodeCard(node, heading, handlers, localNumber, { focusPost = false, channelOwnerBlockchainName = '' } = {}) {
|
||||
const card = document.createElement('article');
|
||||
card.className = 'card stack thread-node-card channel-message-card';
|
||||
const isOwnerPost = focusPost && channelOwnerBlockchainName
|
||||
&& String(node?.authorBlockchainName || '').trim().toLowerCase() === channelOwnerBlockchainName.trim().toLowerCase();
|
||||
if (isOwnerPost) card.classList.add('channel-message-card--owner');
|
||||
|
||||
const author = node?.authorLogin || 'автор';
|
||||
const versions = Array.isArray(node?.versions) ? node.versions : [];
|
||||
@@ -724,6 +736,7 @@ function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
if (node?.createdAtMs) timestamp.title = new Date(node.createdAtMs).toLocaleString('ru-RU');
|
||||
authorBlock.append(title, timestamp);
|
||||
authorTile.append(avatar, authorBlock);
|
||||
if (isOwnerPost) authorTile.hidden = true;
|
||||
headRow.append(authorTile);
|
||||
const typeMeta = getChannelMessageTypeMeta(node?.msgSubType);
|
||||
if (typeMeta) {
|
||||
@@ -781,7 +794,7 @@ function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
}
|
||||
const body = document.createElement('p');
|
||||
body.className = 'channel-message-body';
|
||||
body.textContent = parsedText.text;
|
||||
appendShineMessageLinks(body, parsedText.text, { navigate: handlers?.navigate });
|
||||
card.append(body);
|
||||
}
|
||||
|
||||
@@ -803,7 +816,7 @@ function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
|
||||
const likeButton = document.createElement('button');
|
||||
likeButton.type = 'button';
|
||||
likeButton.className = 'ui-button channel-action-item thread-like-btn';
|
||||
likeButton.className = 'ui-button channel-action-item channel-action-like thread-like-btn';
|
||||
if (isLiked) likeButton.classList.add('is-liked');
|
||||
likeButton.innerHTML = `
|
||||
<span class="channel-action-icon" aria-hidden="true">${iconHtml('heart', isLiked)}</span>
|
||||
@@ -845,6 +858,11 @@ function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
replyButton.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
animatePress(event.currentTarget);
|
||||
if (!state.session.isAuthorized) {
|
||||
state.authReturnHash = window.location.pathname || '/channels';
|
||||
handlers.navigate('login-view');
|
||||
return;
|
||||
}
|
||||
openReplyModal({
|
||||
onSubmit: async (textValue) => handlers.onReply(target, textValue),
|
||||
isActive: handlers.isActive,
|
||||
@@ -861,7 +879,7 @@ function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
|
||||
const shareButton = document.createElement('button');
|
||||
shareButton.type = 'button';
|
||||
shareButton.className = 'ui-button channel-action-item thread-share-btn';
|
||||
shareButton.className = 'ui-button channel-action-item channel-action-share thread-share-btn';
|
||||
shareButton.innerHTML = `
|
||||
<span class="channel-action-icon" aria-hidden="true">${iconHtml('share')}</span>
|
||||
<span class="channel-action-label">Отправить</span>
|
||||
@@ -877,11 +895,22 @@ function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
// Точка возврата: docs/Future_Features/2026-05-24_1140_репосты_в_каналах_и_тредах.md
|
||||
const discussionButton = document.createElement('button');
|
||||
discussionButton.type = 'button';
|
||||
discussionButton.className = 'ui-button channel-action-item';
|
||||
discussionButton.innerHTML = `<span class="channel-action-icon">${iconHtml('message')}</span>${Number(replies) > 0 ? `<span>${replies}</span>` : ''}`;
|
||||
discussionButton.setAttribute('aria-label', `Открыть обсуждение, ответов: ${replies}`);
|
||||
discussionButton.addEventListener('click', () => handlers.onOpenThread(target));
|
||||
actions.append(likeButton, discussionButton, shareButton, replyButton);
|
||||
discussionButton.className = 'ui-button channel-action-item channel-action-discussion';
|
||||
discussionButton.innerHTML = `
|
||||
<span class="channel-action-icon" aria-hidden="true">${iconHtml('message')}</span>
|
||||
<span class="channel-action-label">Обсуждение</span>
|
||||
<span class="channel-action-counter">${replies || ''}</span>
|
||||
`;
|
||||
setActionTitle(discussionButton, `Открыть обсуждение, ответов: ${replies}`);
|
||||
discussionButton.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
animatePress(event.currentTarget);
|
||||
if (focusPost) card.closest('.channels-screen')?.querySelector('.thread-block--replies')?.scrollIntoView({ block: 'start', behavior: 'smooth' });
|
||||
else handlers.onOpenThread(target);
|
||||
});
|
||||
// Тот же вид и порядок кнопок, что в ленте канала.
|
||||
actions.append(likeButton, shareButton, discussionButton);
|
||||
menuItems.unshift({ label: 'Ответить', iconHtml: iconHtml('reply'), action: () => replyButton.click() });
|
||||
if (repostTarget) {
|
||||
const originalButton = document.createElement('button');
|
||||
originalButton.type = 'button';
|
||||
@@ -959,6 +988,15 @@ function renderNodeCard(node, heading, handlers, localNumber) {
|
||||
}
|
||||
if (versionsTotal > 1) menuItems.push({ label: 'История изменений', action: () => openMessageHistoryModal({ versions: versions }) });
|
||||
attachMessageMenu(card, headRow, menuItems);
|
||||
if (isOwnerPost) {
|
||||
const meta = document.createElement('div');
|
||||
meta.className = 'channel-message-meta';
|
||||
const moreButton = headRow.querySelector('.channel-message-more');
|
||||
meta.append(timestamp);
|
||||
if (moreButton) meta.append(moreButton);
|
||||
actions.append(meta);
|
||||
if (!headRow.querySelector('.channel-message-type-button')) headRow.hidden = true;
|
||||
}
|
||||
card.append(actions);
|
||||
authorTile.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
@@ -986,13 +1024,13 @@ function nodeKey(node) {
|
||||
}
|
||||
|
||||
// Исходная запись сверху: две строки, «Развернуть» — только если текст правда обрезан
|
||||
function renderThreadContext(node, { onOpenPost }) {
|
||||
function renderThreadContext(node, { onOpenPost, onNavigate }) {
|
||||
const parsed = parseMessageAttachments(resolveNodeText(node));
|
||||
const box = document.createElement('section');
|
||||
box.className = 'thread-context';
|
||||
const text = document.createElement('p');
|
||||
text.className = 'thread-context__text';
|
||||
text.textContent = parsed.text || (parsed.attachments.length ? 'Запись с вложением' : '');
|
||||
appendShineMessageLinks(text, parsed.text || (parsed.attachments.length ? 'Запись с вложением' : ''), { navigate: onNavigate });
|
||||
const meta = document.createElement('div');
|
||||
meta.className = 'thread-context__meta';
|
||||
const time = document.createElement('span');
|
||||
@@ -1089,7 +1127,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers }) {
|
||||
}
|
||||
const text = document.createElement('p');
|
||||
text.className = 'thread-comment__text';
|
||||
text.textContent = parsed.text;
|
||||
appendShineMessageLinks(text, parsed.text, { navigate: handlers?.navigate });
|
||||
item.append(text);
|
||||
|
||||
const actions = document.createElement('div');
|
||||
@@ -1238,7 +1276,7 @@ function createThreadComposer({ draftKey, isAuthorized, onLogin, onSend }) {
|
||||
const login = document.createElement('button');
|
||||
login.type = 'button';
|
||||
login.className = 'primary-btn channel-main-action';
|
||||
login.textContent = 'Войти и ответить';
|
||||
login.textContent = 'Войти / зарегистрироваться';
|
||||
login.addEventListener('click', onLogin);
|
||||
root.append(login);
|
||||
return { root, setReplyTo() {} };
|
||||
@@ -1339,8 +1377,11 @@ function createThreadComposer({ draftKey, isAuthorized, onLogin, onSend }) {
|
||||
export function render({ navigate, route, chrome }) {
|
||||
let selector = parseThreadSelector(route);
|
||||
const channelDisplayName = resolveChannelDisplayName(selector?.channel);
|
||||
const routeKey = `${selector?.message?.blockchainName || ''}:${selector?.message?.blockNumber || ''}:${selector?.message?.blockHash || ''}`;
|
||||
const routeKey = selector?.publicationOrdinal
|
||||
? `channel:${selector?.short?.ownerBlockchainName || ''}:${selector?.short?.channelName || ''}:${selector.publicationOrdinal}`
|
||||
: `${selector?.message?.blockchainName || ''}:${selector?.message?.blockNumber || ''}:${selector?.message?.blockHash || ''}`;
|
||||
let activeResolvedChannelLabel = channelDisplayName;
|
||||
let focusOrdinal = selector?.publicationOrdinal || null;
|
||||
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack channels-screen channels-screen--thread';
|
||||
@@ -1371,7 +1412,7 @@ export function render({ navigate, route, chrome }) {
|
||||
const header = createTopBar({
|
||||
center: threadHeaderButton,
|
||||
className: 'topbar--identity',
|
||||
back: { label: '<', onClick: () => navigate(resolveThreadPreviousInChannels(selector, activeResolvedChannelLabel)) },
|
||||
back: state.session.isAuthorized ? { label: '<', onClick: () => navigate(resolveThreadPreviousInChannels(selector, activeResolvedChannelLabel)) } : null,
|
||||
actions: [{
|
||||
label: '⋯',
|
||||
ariaLabel: 'Меню обсуждения',
|
||||
@@ -1416,6 +1457,11 @@ export function render({ navigate, route, chrome }) {
|
||||
navigate,
|
||||
isActive: () => !disposed,
|
||||
onToggleLike: async (target, action) => {
|
||||
if (!state.session.isAuthorized) {
|
||||
state.authReturnHash = window.location.pathname || '/channels';
|
||||
navigate('login-view');
|
||||
return;
|
||||
}
|
||||
const actionKey = makeReactionActionKey(target);
|
||||
if (!actionKey) throw new Error('Некорректная ссылка на сообщение для реакции.');
|
||||
if (pendingReactionActions.has(actionKey)) return;
|
||||
@@ -1511,7 +1557,7 @@ export function render({ navigate, route, chrome }) {
|
||||
},
|
||||
onShare: async (target) => {
|
||||
try {
|
||||
const routePath = buildThreadRouteFromTarget(target, selector);
|
||||
const routePath = buildThreadRouteFromTarget(target, selector, focusOrdinal);
|
||||
if (!routePath) throw new Error('Не удалось подготовить ссылку на обсуждение.');
|
||||
const result = await shareOrCopyLink({
|
||||
title: 'Сияние · Обсуждение',
|
||||
@@ -1527,7 +1573,7 @@ export function render({ navigate, route, chrome }) {
|
||||
}
|
||||
},
|
||||
onOpenThread: (target) => {
|
||||
const routePath = buildThreadRouteFromTarget(target, selector);
|
||||
const routePath = buildThreadRouteFromTarget(target, selector, focusOrdinal);
|
||||
if (!routePath) {
|
||||
showStatus('Не удалось определить ссылку на обсуждение.');
|
||||
return;
|
||||
@@ -1600,10 +1646,13 @@ export function render({ navigate, route, chrome }) {
|
||||
if (!hadContent) clearContent();
|
||||
showStatus('');
|
||||
selector = parseThreadSelector(route);
|
||||
focusOrdinal = selector?.publicationOrdinal || null;
|
||||
activeResolvedChannelLabel = resolveChannelDisplayName(selector?.channel);
|
||||
threadHeaderChannel.textContent = '…';
|
||||
threadHeaderButton.disabled = true;
|
||||
threadHeaderButton.onclick = null;
|
||||
threadHeaderButton.querySelector('.channel-thread-header-avatar')?.remove();
|
||||
threadHeaderTitle.textContent = 'Обсуждение';
|
||||
|
||||
if (!selector) {
|
||||
const invalid = document.createElement('div');
|
||||
@@ -1617,6 +1666,7 @@ export function render({ navigate, route, chrome }) {
|
||||
|
||||
try {
|
||||
let resolvedMessage = selector.message;
|
||||
let cachedChannelPayload = null;
|
||||
if (selector.short?.ownerBlockchainName && selector.short?.channelName) {
|
||||
const ownFeed = state.session.isAuthorized ? await authService.listSubscriptionsFeed(state.session.login, 1000) : {};
|
||||
if (disposed || seq !== refreshSeq) return;
|
||||
@@ -1681,7 +1731,7 @@ export function render({ navigate, route, chrome }) {
|
||||
const ownerBch = String(channel?.channel?.ownerBlockchainName || '').trim();
|
||||
const rootNo = Number(channel?.channel?.channelRoot?.blockNumber);
|
||||
const rootHash = normalizeRouteHash(channel?.channel?.channelRoot?.blockHash);
|
||||
if (!ownerBch || !Number.isFinite(rootNo) || !Number.isFinite(resolvedMessage?.blockNumber)) {
|
||||
if (!ownerBch || !Number.isFinite(rootNo) || !focusOrdinal) {
|
||||
throw new Error('Канал или сообщение не найдено.');
|
||||
}
|
||||
selector.channel = {
|
||||
@@ -1690,11 +1740,22 @@ export function render({ navigate, route, chrome }) {
|
||||
channelRootBlockHash: rootHash,
|
||||
};
|
||||
|
||||
// One-based channel publication ordinal -> original POST block reference.
|
||||
// Editions are deliberately excluded by GetChannelMessages on the server.
|
||||
cachedChannelPayload = await authService.getChannelMessages(selector.channel, null, 'asc', state.session.isAuthorized ? state.session.login : '');
|
||||
if (disposed || seq !== refreshSeq) return;
|
||||
const message = publicationAtOrdinal(cachedChannelPayload?.messages || [], focusOrdinal);
|
||||
const blockNumber = Number(message?.messageRef?.blockNumber);
|
||||
const blockHash = normalizeMessageHash(message?.messageRef?.blockHash);
|
||||
if (!Number.isSafeInteger(blockNumber) || blockNumber < 0 || !blockHash) {
|
||||
throw new Error(`Публикация №${focusOrdinal} не найдена в канале.`);
|
||||
}
|
||||
resolvedMessage = {
|
||||
blockchainName: ownerBch,
|
||||
blockNumber: resolvedMessage.blockNumber,
|
||||
blockHash: normalizeMessageHash(resolvedMessage?.blockHash),
|
||||
blockchainName: String(message?.authorBlockchainName || ownerBch),
|
||||
blockNumber,
|
||||
blockHash,
|
||||
};
|
||||
selector.message = { ...resolvedMessage };
|
||||
}
|
||||
|
||||
const payload = await authService.getMessageThread(resolvedMessage, 20, 2, 50, state.session.login);
|
||||
@@ -1729,8 +1790,51 @@ export function render({ navigate, route, chrome }) {
|
||||
activeResolvedChannelLabel = resolvedChannelLabel;
|
||||
const fallbackChannel = String(selector?.channel?.ownerBlockchainName || '').trim() || 'неизвестно';
|
||||
const resolvedChannelTitle = resolvedChannelLabel || fallbackChannel;
|
||||
const channelOwner = extractLoginFromBlockchainName(selector?.channel?.ownerBlockchainName || focus?.channelInfo?.ownerBlockchainName || selector?.short?.ownerBlockchainName || '');
|
||||
const channelSlug = String(selector?.short?.channelName || (resolvedChannelLabel.includes('/') ? resolvedChannelLabel.split('/').slice(1).join('/') : '')).trim();
|
||||
let title = channelTitleByLabel.get(resolvedChannelTitle) || channelSlug || resolvedChannelTitle;
|
||||
let avatarAr = '';
|
||||
let avatarSha256 = '';
|
||||
// Метаданные канала доступны гостям: заголовок и аватар берём из того же API, что у ленты.
|
||||
if (selector?.channel?.ownerBlockchainName && selector?.channel?.channelRootBlockNumber != null && Number.isFinite(Number(selector.channel.channelRootBlockNumber))) {
|
||||
try {
|
||||
const channelPayload = cachedChannelPayload || await authService.getChannelMessages(selector.channel, null, 'asc', state.session.isAuthorized ? state.session.login : '');
|
||||
if (disposed || seq !== refreshSeq) return;
|
||||
if (!focusOrdinal && focus) {
|
||||
focusOrdinal = ordinalForPublication(channelPayload?.messages || [], {
|
||||
blockchainName: String(focus?.authorBlockchainName || selector.channel.ownerBlockchainName),
|
||||
blockNumber: focus?.messageRef?.blockNumber,
|
||||
blockHash: focus?.messageRef?.blockHash,
|
||||
});
|
||||
}
|
||||
const meta = channelPayload?.channel || {};
|
||||
title = String(meta.displayName || meta.channelName || title).trim();
|
||||
avatarAr = String(meta.avaAr || '').trim();
|
||||
avatarSha256 = String(meta.avaSha256 || '').trim().toLowerCase();
|
||||
if (!selector.short && meta.channelName) selector.short = { ownerBlockchainName: selector.channel.ownerBlockchainName, channelName: String(meta.channelName) };
|
||||
} catch {
|
||||
// Обсуждение должно открываться даже при временной недоступности метаданных канала.
|
||||
}
|
||||
}
|
||||
const shortName = String(selector?.short?.channelName || channelSlug).trim();
|
||||
const visibleOwner = channelOwner || extractLoginFromBlockchainName(selector?.short?.ownerBlockchainName || '');
|
||||
const number = focusOrdinal || (selector?.short ? null : Number(selector?.message?.blockNumber));
|
||||
const headerNumber = Number.isSafeInteger(number) && number > 0 ? ` · №${number}` : '';
|
||||
if (threadHeaderButton) {
|
||||
threadHeaderChannel.textContent = channelTitleByLabel.get(resolvedChannelTitle) || resolvedChannelTitle;
|
||||
threadHeaderTitle.textContent = `${title}${headerNumber}`;
|
||||
threadHeaderChannel.textContent = `${visibleOwner ? `@${visibleOwner}` : ''}${visibleOwner && shortName ? ' / ' : ''}${shortName}`;
|
||||
threadHeaderButton.querySelector('.channel-thread-header-avatar')?.remove();
|
||||
const avatar = renderAvatar({
|
||||
initials: (title[0] || 'К').toUpperCase(),
|
||||
avatar: (avatarAr || avatarSha256) ? { ar: avatarAr, sha256Hex: avatarSha256 } : null,
|
||||
authorLogin: visibleOwner,
|
||||
size: 'xl',
|
||||
className: 'channel-profile-avatar channel-thread-header-avatar',
|
||||
title,
|
||||
alt: 'Аватар канала',
|
||||
});
|
||||
avatar.style.setProperty('--channel-avatar-size', '40px');
|
||||
threadHeaderButton.prepend(avatar);
|
||||
threadHeaderButton.title = 'Открыть канал';
|
||||
threadHeaderButton.disabled = false;
|
||||
threadHeaderButton.onclick = (event) => {
|
||||
@@ -1743,13 +1847,6 @@ export function render({ navigate, route, chrome }) {
|
||||
}
|
||||
|
||||
clearContent();
|
||||
const channelOwner = extractLoginFromBlockchainName(selector?.channel?.ownerBlockchainName || focus?.channelInfo?.ownerBlockchainName || '');
|
||||
if (!state.session.isAuthorized) mountPublicChannelSidebar(screen, {
|
||||
owner: channelOwner,
|
||||
channel: resolvedChannelTitle,
|
||||
subscribers: payload?.channel?.subscribersCount ?? payload?.focus?.channelInfo?.subscribersCount ?? null,
|
||||
navigate,
|
||||
});
|
||||
const openPost = () => {
|
||||
const routeToChannel = buildChannelRouteFromThread(selector, resolvedChannelLabel);
|
||||
if (routeToChannel) navigate(routeToChannel);
|
||||
@@ -1769,7 +1866,7 @@ export function render({ navigate, route, chrome }) {
|
||||
title: 'Поделиться записью',
|
||||
kicker: `${resolvedChannelTitle} · запись`,
|
||||
text: parseMessageAttachments(resolveNodeText(focus)).text,
|
||||
url: buildAbsoluteRouteUrl(buildThreadRouteFromTarget(focusTarget, selector)),
|
||||
url: buildAbsoluteRouteUrl(buildThreadRouteFromTarget(focusTarget, selector, focusOrdinal)),
|
||||
});
|
||||
} },
|
||||
];
|
||||
@@ -1778,13 +1875,13 @@ export function render({ navigate, route, chrome }) {
|
||||
if (ancestors.length) {
|
||||
const ancestorsWrap = document.createElement('div');
|
||||
ancestorsWrap.className = 'thread-block thread-block--ancestors';
|
||||
ancestors.forEach((node) => ancestorsWrap.append(renderThreadContext(node, { onOpenPost: openPost })));
|
||||
ancestors.forEach((node) => ancestorsWrap.append(renderThreadContext(node, { onOpenPost: openPost, onNavigate: navigate })));
|
||||
screen.append(ancestorsWrap);
|
||||
}
|
||||
if (focus) {
|
||||
const focusWrap = document.createElement('div');
|
||||
focusWrap.className = 'thread-block thread-block--focus';
|
||||
focusWrap.append(renderThreadContext(focus, { onOpenPost: openPost }));
|
||||
focusWrap.append(renderNodeCard(focus, '', handlers, focusOrdinal || Number(selector?.message?.blockNumber ?? 0), { focusPost: true, channelOwnerBlockchainName: selector?.channel?.ownerBlockchainName || '' }));
|
||||
screen.append(focusWrap);
|
||||
}
|
||||
|
||||
@@ -1829,7 +1926,7 @@ export function render({ navigate, route, chrome }) {
|
||||
title: 'Поделиться комментарием',
|
||||
kicker: `${node.authorLogin} · комментарий`,
|
||||
text: parseMessageAttachments(resolveNodeText(node)).text,
|
||||
url: `${buildAbsoluteRouteUrl(buildThreadRouteFromTarget(focusTarget, selector))}#comment-${node?.messageRef?.blockNumber ?? ''}`,
|
||||
url: `${buildAbsoluteRouteUrl(buildThreadRouteFromTarget(focusTarget, selector, focusOrdinal))}#comment-${node?.messageRef?.blockNumber ?? ''}`,
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user