SHA256
Доработать согласия и статусы профиля
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { appendShineMessageLinks } from '../services/shine-message-links.js';
|
||||
import { confirmDialog } from '../components/confirm-dialog.js';
|
||||
import { confirmLikeAction } from '../components/like-action-sheet.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import { consumeReplyEditorOnOpen, rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
|
||||
import { attachMessageMenu } from '../components/message-menu.js';
|
||||
@@ -850,7 +851,7 @@ function renderNodeCard(node, heading, handlers, localNumber, { focusPost = fals
|
||||
likeButton.disabled = true;
|
||||
setActionTitle(likeButton, 'Лайк...');
|
||||
try {
|
||||
await handlers.onToggleLike(target, isLiked ? 'unlike' : 'like');
|
||||
await handlers.onToggleLike(target, isLiked ? 'unlike' : 'like', node);
|
||||
} catch (error) {
|
||||
logThreadRuntimeError('like_click', error, {
|
||||
action: isLiked ? 'unlike' : 'like',
|
||||
@@ -1175,7 +1176,7 @@ function renderComment({ node, parent, focus, channelOwner, handlers, nested = f
|
||||
like.setAttribute('aria-label', `${liked ? 'Убрать отметку «Нравится»' : 'Нравится'}, ${likes}`);
|
||||
like.addEventListener('click', async () => {
|
||||
like.disabled = true;
|
||||
try { await handlers.onToggleLike(target, liked ? 'unlike' : 'like'); }
|
||||
try { await handlers.onToggleLike(target, liked ? 'unlike' : 'like', node); }
|
||||
catch (error) { handlers.onActionError(error, liked ? 'unlike' : 'like'); }
|
||||
finally { if (like.isConnected) like.disabled = false; }
|
||||
});
|
||||
@@ -1662,7 +1663,7 @@ export function render({ navigate, route, chrome }) {
|
||||
navigate,
|
||||
isActive: () => !disposed,
|
||||
openReplyEditor: (node) => replyEditorOpener?.(node),
|
||||
onToggleLike: async (target, action) => {
|
||||
onToggleLike: async (target, action, counts = {}) => {
|
||||
if (!state.session.isAuthorized) {
|
||||
state.authReturnHash = window.location.pathname || '/channels';
|
||||
navigate('login-view');
|
||||
@@ -1672,6 +1673,9 @@ export function render({ navigate, route, chrome }) {
|
||||
if (!actionKey) throw new Error('Некорректная ссылка на сообщение для реакции.');
|
||||
if (pendingReactionActions.has(actionKey)) return;
|
||||
|
||||
const accepted = await confirmLikeAction({ liked: action === 'unlike', counts });
|
||||
if (!accepted || disposed) return;
|
||||
if (pendingReactionActions.has(actionKey)) return;
|
||||
const previousReaction = getMessageReactionState(target);
|
||||
const nextReaction = action === 'unlike' ? 'unliked' : 'liked';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user