SHA256
Стрелка «назад» в каналах шагает по истории, а не по кругу
Ответ → запись → канал → список каналов: если на страницу пришли из канала или обсуждения, «назад» возвращает по истории. Раньше повторный переход гонял по кругу запись и открытый из неё ответ.
This commit is contained in:
@@ -22,7 +22,7 @@ import {
|
||||
showToast,
|
||||
softHaptic,
|
||||
} from '../services/channels-ux.js';
|
||||
import { getPreviousTrackedPath, parseRouteFromPath, toPrettyPath } from '../router.js';
|
||||
import { navigateUp, parseRouteFromPath, toPrettyPath } from '../router.js';
|
||||
import { renderAvatar, renderUserAvatar } from '../components/avatar-image.js';
|
||||
import { openChannelEditor } from '../components/channel-editor.js';
|
||||
import { createDropdownMenu } from '../components/dropdown-menu.js';
|
||||
@@ -370,19 +370,8 @@ function resolveThreadBackRoute(selector, resolvedChannelLabel = '') {
|
||||
return buildChannelRouteFromThread(selector, resolvedChannelLabel) || 'channels-list';
|
||||
}
|
||||
|
||||
function resolveThreadPreviousInChannels(selector, resolvedChannelLabel = '') {
|
||||
const previousPath = String(getPreviousTrackedPath() || '').trim();
|
||||
if (previousPath) {
|
||||
const previousRoute = parseRouteFromPath(previousPath);
|
||||
const previousPageId = String(previousRoute?.pageId || '').trim();
|
||||
if (
|
||||
previousPageId === 'channel-thread-view'
|
||||
|| previousPageId === 'channel-view'
|
||||
) {
|
||||
return previousPath;
|
||||
}
|
||||
}
|
||||
return resolveThreadBackRoute(selector, resolvedChannelLabel);
|
||||
function isChannelPage(route) {
|
||||
return route?.pageId === 'channel-thread-view' || route?.pageId === 'channel-view';
|
||||
}
|
||||
|
||||
function buildTargetFromNode(node) {
|
||||
@@ -1624,7 +1613,7 @@ export function render({ navigate, route, chrome }) {
|
||||
const header = createTopBar({
|
||||
center: threadHeaderButton,
|
||||
className: 'topbar--identity',
|
||||
back: state.session.isAuthorized ? { label: '<', onClick: () => navigate(resolveThreadPreviousInChannels(selector, activeResolvedChannelLabel)) } : null,
|
||||
back: state.session.isAuthorized ? { label: '<', onClick: () => navigateUp(isChannelPage, resolveThreadBackRoute(selector, activeResolvedChannelLabel)) } : null,
|
||||
actions: [{
|
||||
label: '⋯',
|
||||
ariaLabel: 'Меню обсуждения',
|
||||
|
||||
Reference in New Issue
Block a user