SHA256
Ускорить публикацию блоков в Arweave
This commit is contained in:
@@ -30,8 +30,6 @@ export function render({ navigate, chrome }) {
|
||||
|
||||
function renderProfile() {
|
||||
if (!card) return;
|
||||
const official = card.accountRole === 'primary';
|
||||
const shining = card.shineStatus === 'shining';
|
||||
body.innerHTML = profileCardHtml({
|
||||
card,
|
||||
login,
|
||||
@@ -42,8 +40,6 @@ export function render({ navigate, chrome }) {
|
||||
].join(''),
|
||||
}) + `
|
||||
<div class="nav-list profile-more-list">
|
||||
<button class="nav-row" type="button" data-profile-list="primary_given"><span class="nav-row__label">Подтверждённые мной аккаунты</span><span class="nav-row__hint">Аккаунты, за которые вы поручились</span></button>
|
||||
<button class="nav-row" type="button" data-profile-list="shine_given"><span class="nav-row__label">Отмеченные мной как сияющие</span></button>
|
||||
<button class="nav-row" type="button" data-self-profile-action="profiles"><span class="nav-row__label">Сменить профиль</span><span class="nav-row__hint">Другие аккаунты на этом устройстве</span></button>
|
||||
</div>`;
|
||||
|
||||
@@ -55,8 +51,6 @@ export function render({ navigate, chrome }) {
|
||||
avatar: card.avatar,
|
||||
size: 'xl',
|
||||
className: 'user-profile-hero-avatar',
|
||||
glow: shining,
|
||||
official,
|
||||
}));
|
||||
|
||||
status.textContent = '';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { SHINE_CONNECTIONS_LOGO_SRC } from '../components/shine-logo.js';
|
||||
import { renderUserAvatar } from '../components/avatar-image.js';
|
||||
import { authService, state } from '../state.js';
|
||||
import { loadRelationsForPair, loadUserProfileCard } from '../services/user-connections.js';
|
||||
import { state } from '../state.js';
|
||||
import { loadUserProfileCard } from '../services/user-connections.js';
|
||||
import { makeProfileLinksRoute } from '../services/shine-routes.js';
|
||||
import { navigateBack } from '../router.js';
|
||||
import { profileCardHtml, profileTileHtml } from '../components/profile-card.js';
|
||||
@@ -18,27 +18,6 @@ function escapeHtml(text) {
|
||||
.replaceAll("'", ''');
|
||||
}
|
||||
|
||||
function effectiveSocial(flags = {}) {
|
||||
if (flags.outCloseFriend) return 'close_friend';
|
||||
if (flags.outFriend) return 'friend';
|
||||
if (flags.outContact) return 'contact';
|
||||
return 'none';
|
||||
}
|
||||
|
||||
function relationMenuHtml(flags = {}) {
|
||||
const current = effectiveSocial(flags);
|
||||
const rows = [
|
||||
['friend', 'Друг'],
|
||||
['close_friend', 'Близкий друг'],
|
||||
['contact', 'Контакт'],
|
||||
];
|
||||
return rows.map(([kind, label]) => `
|
||||
<button type="button" class="user-profile-add-option${current === kind ? ' is-current' : ''}" data-relation-kind="${kind}">
|
||||
<span>${escapeHtml(label)}</span>
|
||||
<span class="user-profile-add-option-check" aria-hidden="true">${current === kind ? '✓' : ''}</span>
|
||||
</button>`).join('');
|
||||
}
|
||||
|
||||
export function render({ navigate, route, chrome }) {
|
||||
const requestedLogin = String(route?.params?.login || '').trim();
|
||||
const selfLogin = String(state.session.login || '').trim();
|
||||
@@ -61,80 +40,16 @@ export function render({ navigate, route, chrome }) {
|
||||
screen.append(status, body);
|
||||
|
||||
let card = null;
|
||||
let relationFlags = null;
|
||||
let relationLoadPromise = null;
|
||||
let addMenu = null;
|
||||
let addActionButton = null;
|
||||
|
||||
function updateRelationUi() {
|
||||
if (!addMenu) return;
|
||||
addMenu.innerHTML = relationMenuHtml(relationFlags || {});
|
||||
const social = effectiveSocial(relationFlags || {});
|
||||
addActionButton?.classList.toggle('is-active', social !== 'none');
|
||||
addActionButton?.setAttribute('aria-label', social === 'none' ? 'Добавить' : 'Изменить связь');
|
||||
}
|
||||
|
||||
async function ensureRelationFlags() {
|
||||
if (relationFlags) return relationFlags;
|
||||
if (relationLoadPromise) return relationLoadPromise;
|
||||
if (!selfLogin || !card?.login) return {};
|
||||
relationLoadPromise = loadRelationsForPair({ currentLogin: selfLogin, targetLogin: card.login })
|
||||
.then((flags) => {
|
||||
relationFlags = flags || {};
|
||||
updateRelationUi();
|
||||
return relationFlags;
|
||||
})
|
||||
.finally(() => {
|
||||
relationLoadPromise = null;
|
||||
});
|
||||
return relationLoadPromise;
|
||||
}
|
||||
|
||||
async function setRelationKind(kind, enabled) {
|
||||
await authService.setUserRelation({
|
||||
login: selfLogin,
|
||||
toLogin: card.login,
|
||||
kind,
|
||||
enabled,
|
||||
storagePwd: state.session.storagePwdInMemory,
|
||||
});
|
||||
}
|
||||
|
||||
async function changeSocial(next) {
|
||||
const flags = await ensureRelationFlags();
|
||||
const current = effectiveSocial(flags);
|
||||
if (current === next) return;
|
||||
|
||||
if (next === 'contact') {
|
||||
if (flags.outCloseFriend) await setRelationKind('close_friend', false);
|
||||
if (flags.outFriend) await setRelationKind('friend', false);
|
||||
if (!flags.outContact) await setRelationKind('contact', true);
|
||||
}
|
||||
if (next === 'friend') {
|
||||
if (flags.outCloseFriend) await setRelationKind('close_friend', false);
|
||||
if (!flags.outFriend) await setRelationKind('friend', true);
|
||||
}
|
||||
if (next === 'close_friend' && !flags.outCloseFriend) {
|
||||
await setRelationKind('close_friend', true);
|
||||
}
|
||||
|
||||
relationFlags = await loadRelationsForPair({ currentLogin: selfLogin, targetLogin: card.login });
|
||||
updateRelationUi();
|
||||
}
|
||||
|
||||
function renderProfile() {
|
||||
if (!card) return;
|
||||
const isSelf = card.login.toLowerCase() === selfLogin.toLowerCase();
|
||||
const official = card.accountRole === 'primary';
|
||||
const shining = card.shineStatus === 'shining';
|
||||
|
||||
body.innerHTML = profileCardHtml({
|
||||
card,
|
||||
login: requestedLogin,
|
||||
isSelf,
|
||||
beforeTilesHtml: '<div class="user-profile-add-menu" hidden></div>',
|
||||
tilesHtml: isSelf ? '' : [
|
||||
profileTileHtml({ icon: 'user-plus', label: 'Добавить', attrs: 'data-profile-action="add" aria-haspopup="menu" aria-expanded="false"' }),
|
||||
profileTileHtml({ icon: 'user-plus', label: 'Добавить связь', attrs: 'data-profile-action="add"' }),
|
||||
profileTileHtml({ label: 'Связи', attrs: 'data-profile-action="links"', iconMarkup: `<img class="pf-tile-mandala" src="${SHINE_CONNECTIONS_LOGO_SRC}" alt="" aria-hidden="true">` }),
|
||||
profileTileHtml({ icon: 'message', label: 'Написать', attrs: 'data-profile-action="chat"' }),
|
||||
].join(''),
|
||||
@@ -148,21 +63,12 @@ export function render({ navigate, route, chrome }) {
|
||||
avatar: card.avatar,
|
||||
size: 'xl',
|
||||
className: 'user-profile-hero-avatar',
|
||||
glow: shining,
|
||||
official,
|
||||
}));
|
||||
|
||||
addMenu = body.querySelector('.user-profile-add-menu');
|
||||
addActionButton = body.querySelector('[data-profile-action="add"]');
|
||||
updateRelationUi();
|
||||
status.textContent = '';
|
||||
|
||||
if (!isSelf && selfLogin) {
|
||||
void ensureRelationFlags().catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
body.addEventListener('click', async (event) => {
|
||||
body.addEventListener('click', (event) => {
|
||||
if (!card) return;
|
||||
const listButton = event.target.closest('[data-profile-list]');
|
||||
if (listButton) {
|
||||
@@ -171,34 +77,9 @@ export function render({ navigate, route, chrome }) {
|
||||
return;
|
||||
}
|
||||
|
||||
const relationButton = event.target.closest('[data-relation-kind]');
|
||||
if (relationButton) {
|
||||
if (!selfLogin) {
|
||||
status.className = 'status-line user-profile-status is-unavailable';
|
||||
status.textContent = 'Для добавления пользователя необходимо войти.';
|
||||
return;
|
||||
}
|
||||
const next = relationButton.dataset.relationKind;
|
||||
try {
|
||||
addMenu?.classList.add('is-busy');
|
||||
await changeSocial(next);
|
||||
if (addMenu) addMenu.hidden = true;
|
||||
addActionButton?.setAttribute('aria-expanded', 'false');
|
||||
status.className = 'status-line user-profile-status';
|
||||
status.textContent = '';
|
||||
} catch (error) {
|
||||
status.className = 'status-line user-profile-status is-unavailable';
|
||||
status.textContent = `Ошибка: ${error?.message || 'Не удалось изменить связь'}`;
|
||||
} finally {
|
||||
addMenu?.classList.remove('is-busy');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const actionButton = event.target.closest('[data-profile-action]');
|
||||
const action = actionButton?.dataset.profileAction;
|
||||
if (action === 'add') {
|
||||
if (!addMenu) return;
|
||||
navigate(`SHiNE/${encodeURIComponent(card.login)}/manage`);
|
||||
return;
|
||||
}
|
||||
@@ -211,17 +92,6 @@ export function render({ navigate, route, chrome }) {
|
||||
}
|
||||
});
|
||||
|
||||
const handleOutsidePointer = (event) => {
|
||||
if (!addMenu || addMenu.hidden) return;
|
||||
if (event.target instanceof Node && body.contains(event.target)) {
|
||||
const insideActions = event.target.closest?.('.user-profile-actions-wrap');
|
||||
if (insideActions) return;
|
||||
}
|
||||
addMenu.hidden = true;
|
||||
addActionButton?.setAttribute('aria-expanded', 'false');
|
||||
};
|
||||
document.addEventListener('pointerdown', handleOutsidePointer);
|
||||
|
||||
async function refresh() {
|
||||
card = await loadUserProfileCard(requestedLogin);
|
||||
renderProfile();
|
||||
@@ -232,9 +102,5 @@ export function render({ navigate, route, chrome }) {
|
||||
status.textContent = `Ошибка: ${error?.message || 'unknown'}`;
|
||||
});
|
||||
|
||||
screen.cleanup = () => {
|
||||
document.removeEventListener('pointerdown', handleOutsidePointer);
|
||||
};
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
@@ -2,54 +2,231 @@ import { createTopBar } from '../components/topbar.js';
|
||||
import { authService, state } from '../state.js';
|
||||
import { loadRelationsForPair, loadUserProfileCard } from '../services/user-connections.js';
|
||||
import { navigateBack } from '../router.js';
|
||||
import { escapeProfileHtml } from '../components/profile-card.js';
|
||||
|
||||
export const pageMeta = { id: 'user-relation-manage-view', title: 'Добавить' };
|
||||
export const pageMeta = { id: 'user-relation-manage-view', title: 'Добавить связь' };
|
||||
|
||||
function effectiveSocial(f) { if (f.outCloseFriend) return 'close_friend'; if (f.outFriend) return 'friend'; if (f.outContact) return 'contact'; return 'none'; }
|
||||
const SOCIAL_LABELS = {
|
||||
none: 'Нет связи',
|
||||
contact: 'Контакт',
|
||||
friend: 'Друг',
|
||||
close_friend: 'Близкий друг',
|
||||
};
|
||||
|
||||
export function render({route, chrome}) {
|
||||
const targetLogin = String(route?.params?.login || '').trim(); const selfLogin = String(state.session.login || '').trim();
|
||||
const screen = document.createElement('section'); screen.className = 'stack';
|
||||
const body = document.createElement('div'); body.className = 'stack'; const status = document.createElement('div'); status.className = 'status-line';
|
||||
chrome?.setTopbar(createTopBar({ title: 'Добавить', back: { label: '←', onClick: () => navigateBack() } }));
|
||||
screen.append(
|
||||
status,
|
||||
body,
|
||||
);
|
||||
let flags, selfCard, targetCard;
|
||||
const MUTUAL_LABELS = {
|
||||
contact: 'контакты',
|
||||
friend: 'друзья',
|
||||
close_friend: 'близкие друзья',
|
||||
};
|
||||
|
||||
async function setKind(kind, enabled) { await authService.setUserRelation({ login: selfLogin, toLogin: targetLogin, kind, enabled, storagePwd: state.session.storagePwdInMemory }); }
|
||||
async function changeSocial(next) {
|
||||
const current = effectiveSocial(flags); if (current === next) return;
|
||||
if (next === 'none') { if (flags.outCloseFriend) await setKind('close_friend', false); if (flags.outFriend) await setKind('friend', false); if (flags.outContact) await setKind('contact', false); }
|
||||
if (next === 'contact') { if (flags.outCloseFriend) await setKind('close_friend', false); if (flags.outFriend) await setKind('friend', false); if (!flags.outContact) await setKind('contact', true); }
|
||||
if (next === 'friend') { if (flags.outCloseFriend) await setKind('close_friend', false); if (!flags.outFriend) await setKind('friend', true); }
|
||||
if (next === 'close_friend' && !flags.outCloseFriend) await setKind('close_friend', true);
|
||||
await refresh();
|
||||
function effectiveSocial(flags = {}, direction = 'out') {
|
||||
const prefix = direction === 'in' ? 'in' : 'out';
|
||||
if (flags[`${prefix}CloseFriend`]) return 'close_friend';
|
||||
if (flags[`${prefix}Friend`]) return 'friend';
|
||||
if (flags[`${prefix}Contact`]) return 'contact';
|
||||
return 'none';
|
||||
}
|
||||
|
||||
function relationSummaryHtml(flags = {}) {
|
||||
const outgoing = effectiveSocial(flags, 'out');
|
||||
const incoming = effectiveSocial(flags, 'in');
|
||||
|
||||
if (outgoing !== 'none' && outgoing === incoming) {
|
||||
return `
|
||||
<div class="relation-manage-mutual">
|
||||
<span class="relation-manage-mutual-label">Взаимно:</span>
|
||||
<strong>${escapeProfileHtml(MUTUAL_LABELS[outgoing])}</strong>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
status.textContent = 'Загрузка...'; body.innerHTML = '';
|
||||
[selfCard, targetCard, flags] = await Promise.all([loadUserProfileCard(selfLogin), loadUserProfileCard(targetLogin), loadRelationsForPair({ currentLogin: selfLogin, targetLogin })]);
|
||||
const social = effectiveSocial(flags);
|
||||
const canPrimary = selfCard.accountRole === 'primary' && targetCard.accountRole !== 'non_voting';
|
||||
const canShine = selfCard.accountRole === 'primary' && selfCard.shineStatus === 'shining' && targetCard.shineStatus !== 'not_interested';
|
||||
body.innerHTML = `
|
||||
<div class="card stack"><b>Связь с ${targetLogin}</b>
|
||||
<div class="row wrap-row" data-social>${['none','contact','friend','close_friend'].map(v => `<button class="secondary-btn ${social===v?'is-active':''}" data-social-kind="${v}">${({none:'Нет',contact:'Контакт',friend:'Друг',close_friend:'Близкий друг'})[v]}</button>`).join('')}</div>
|
||||
return `
|
||||
<div class="relation-manage-current">
|
||||
<div class="relation-manage-current-row">
|
||||
<span>Вы к пользователю</span>
|
||||
<strong>${escapeProfileHtml(SOCIAL_LABELS[outgoing])}</strong>
|
||||
</div>
|
||||
${canPrimary ? `<div class="card row"><span>Основной аккаунт</span><button class="secondary-btn" data-confirm="official_account">${flags.outOfficialAccount ? 'Убрать подтверждение' : 'Подтвердить'}</button></div>` : ''}
|
||||
${canShine ? `<div class="card row"><span>Сияющий</span><button class="secondary-btn" data-confirm="shine_confirmed">${flags.outShineConfirmed ? 'Убрать подтверждение' : 'Подтвердить'}</button></div>` : ''}
|
||||
${incoming !== 'none' ? `
|
||||
<div class="relation-manage-current-row">
|
||||
<span>Пользователь к вам</span>
|
||||
<strong>${escapeProfileHtml(SOCIAL_LABELS[incoming])}</strong>
|
||||
</div>` : ''}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function socialButtonsHtml(flags = {}) {
|
||||
const current = effectiveSocial(flags, 'out');
|
||||
const kinds = ['none', 'contact', 'friend', 'close_friend'];
|
||||
return kinds.map((kind) => `
|
||||
<button type="button" class="secondary-btn relation-manage-choice${current === kind ? ' is-active' : ''}" data-social-kind="${kind}">
|
||||
${escapeProfileHtml(SOCIAL_LABELS[kind])}
|
||||
</button>`).join('');
|
||||
}
|
||||
|
||||
function officialBlockHtml(flags = {}) {
|
||||
return `
|
||||
<section class="card stack relation-manage-card relation-manage-card--official">
|
||||
<div class="relation-manage-card-head">
|
||||
<strong>Основной аккаунт</strong>
|
||||
<span>Этот аккаунт — основной</span>
|
||||
</div>
|
||||
<div class="relation-manage-confirmations">
|
||||
${flags.outOfficialAccount ? '<div class="relation-manage-confirmation">✓ Вы подтвердили его основной аккаунт</div>' : ''}
|
||||
${flags.inOfficialAccount ? '<div class="relation-manage-confirmation">✓ Этот пользователь подтвердил ваш основной аккаунт</div>' : ''}
|
||||
</div>
|
||||
<button type="button" class="secondary-btn relation-manage-confirm-btn" data-confirm="official_account">
|
||||
${flags.outOfficialAccount ? 'Убрать подтверждение' : 'Подтвердить основной аккаунт'}
|
||||
</button>
|
||||
</section>`;
|
||||
}
|
||||
|
||||
function shineBlockHtml(flags = {}) {
|
||||
return `
|
||||
<section class="card stack relation-manage-card relation-manage-card--shine">
|
||||
<div class="relation-manage-card-head">
|
||||
<strong>Сияющий</strong>
|
||||
<span>Этот аккаунт — сияющий</span>
|
||||
</div>
|
||||
<div class="relation-manage-confirmations">
|
||||
${flags.outShineConfirmed ? '<div class="relation-manage-confirmation">✓ Вы подтверждаете его сияющим</div>' : ''}
|
||||
${flags.inShineConfirmed ? '<div class="relation-manage-confirmation">✓ Этот пользователь подтверждает вас сияющим</div>' : ''}
|
||||
</div>
|
||||
<button type="button" class="secondary-btn relation-manage-confirm-btn" data-confirm="shine_confirmed">
|
||||
${flags.outShineConfirmed ? 'Убрать подтверждение' : 'Подтвердить как сияющего'}
|
||||
</button>
|
||||
</section>`;
|
||||
}
|
||||
|
||||
export function render({ route, chrome }) {
|
||||
const targetLogin = String(route?.params?.login || '').trim();
|
||||
const selfLogin = String(state.session.login || '').trim();
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack relation-manage-screen';
|
||||
|
||||
const body = document.createElement('div');
|
||||
body.className = 'stack relation-manage-body';
|
||||
const status = document.createElement('div');
|
||||
status.className = 'status-line relation-manage-status';
|
||||
|
||||
chrome?.setTopbar(createTopBar({
|
||||
title: 'Добавить связь',
|
||||
back: { label: '←', onClick: () => navigateBack() },
|
||||
}));
|
||||
screen.append(status, body);
|
||||
|
||||
let flags = {};
|
||||
let selfCard = null;
|
||||
let targetCard = null;
|
||||
let busy = false;
|
||||
|
||||
async function setKind(kind, enabled) {
|
||||
await authService.setUserRelation({
|
||||
login: selfLogin,
|
||||
toLogin: targetLogin,
|
||||
kind,
|
||||
enabled,
|
||||
storagePwd: state.session.storagePwdInMemory,
|
||||
});
|
||||
}
|
||||
|
||||
async function changeSocial(next) {
|
||||
const current = effectiveSocial(flags, 'out');
|
||||
if (current === next) return;
|
||||
|
||||
if (next === 'none') {
|
||||
if (flags.outCloseFriend) await setKind('close_friend', false);
|
||||
if (flags.outFriend) await setKind('friend', false);
|
||||
if (flags.outContact) await setKind('contact', false);
|
||||
}
|
||||
if (next === 'contact') {
|
||||
if (flags.outCloseFriend) await setKind('close_friend', false);
|
||||
if (flags.outFriend) await setKind('friend', false);
|
||||
if (!flags.outContact) await setKind('contact', true);
|
||||
}
|
||||
if (next === 'friend') {
|
||||
if (flags.outCloseFriend) await setKind('close_friend', false);
|
||||
if (!flags.outFriend) await setKind('friend', true);
|
||||
}
|
||||
if (next === 'close_friend' && !flags.outCloseFriend) {
|
||||
await setKind('close_friend', true);
|
||||
}
|
||||
}
|
||||
|
||||
function renderBody() {
|
||||
const canPrimary = selfCard?.accountRole === 'primary' && targetCard?.accountRole === 'primary';
|
||||
const canShine = selfCard?.shineStatus === 'shining' && targetCard?.shineStatus === 'shining';
|
||||
|
||||
body.innerHTML = `
|
||||
<section class="card stack relation-manage-card relation-manage-card--social">
|
||||
<div class="relation-manage-card-head">
|
||||
<strong>Связь</strong>
|
||||
<span>@${escapeProfileHtml(targetCard?.login || targetLogin)}</span>
|
||||
</div>
|
||||
${relationSummaryHtml(flags)}
|
||||
<div class="relation-manage-choices" aria-label="Изменить ваше отношение к пользователю">
|
||||
${socialButtonsHtml(flags)}
|
||||
</div>
|
||||
</section>
|
||||
${canPrimary ? officialBlockHtml(flags) : ''}
|
||||
${canShine ? shineBlockHtml(flags) : ''}
|
||||
`;
|
||||
}
|
||||
|
||||
async function refresh({ loading = true } = {}) {
|
||||
if (loading) {
|
||||
status.className = 'status-line relation-manage-status';
|
||||
status.textContent = 'Загрузка...';
|
||||
}
|
||||
[selfCard, targetCard, flags] = await Promise.all([
|
||||
loadUserProfileCard(selfLogin),
|
||||
loadUserProfileCard(targetLogin),
|
||||
loadRelationsForPair({ currentLogin: selfLogin, targetLogin }),
|
||||
]);
|
||||
renderBody();
|
||||
status.className = 'status-line relation-manage-status';
|
||||
status.textContent = '';
|
||||
}
|
||||
|
||||
body.addEventListener('click', async (e) => {
|
||||
const btn = e.target.closest('button'); if (!btn) return;
|
||||
const social = btn.dataset.socialKind; const confirm = btn.dataset.confirm;
|
||||
try { status.textContent = 'Сохранение...'; if (social) await changeSocial(social); else if (confirm) { const enabled = confirm === 'official_account' ? !flags.outOfficialAccount : !flags.outShineConfirmed; await setKind(confirm, enabled); await refresh(); } }
|
||||
catch (err) { status.className='status-line is-unavailable'; status.textContent=`Ошибка: ${err.message || 'unknown'}`; }
|
||||
body.addEventListener('click', async (event) => {
|
||||
const button = event.target.closest('button');
|
||||
if (!button || busy) return;
|
||||
|
||||
const social = button.dataset.socialKind;
|
||||
const confirm = button.dataset.confirm;
|
||||
if (!social && !confirm) return;
|
||||
|
||||
busy = true;
|
||||
body.classList.add('is-busy');
|
||||
status.className = 'status-line relation-manage-status';
|
||||
status.textContent = 'Сохранение...';
|
||||
|
||||
try {
|
||||
if (social) {
|
||||
await changeSocial(social);
|
||||
} else if (confirm === 'official_account') {
|
||||
await setKind('official_account', !flags.outOfficialAccount);
|
||||
} else if (confirm === 'shine_confirmed') {
|
||||
await setKind('shine_confirmed', !flags.outShineConfirmed);
|
||||
}
|
||||
await refresh({ loading: false });
|
||||
} catch (error) {
|
||||
status.className = 'status-line relation-manage-status is-unavailable';
|
||||
status.textContent = `Ошибка: ${error?.message || 'Не удалось изменить связь'}`;
|
||||
} finally {
|
||||
busy = false;
|
||||
body.classList.remove('is-busy');
|
||||
}
|
||||
});
|
||||
refresh().catch(e => { status.className='status-line is-unavailable'; status.textContent=`Ошибка: ${e.message || 'unknown'}`; });
|
||||
|
||||
if (!selfLogin || !targetLogin) {
|
||||
status.className = 'status-line relation-manage-status is-unavailable';
|
||||
status.textContent = 'Не удалось определить пользователя.';
|
||||
return screen;
|
||||
}
|
||||
|
||||
refresh().catch((error) => {
|
||||
status.className = 'status-line relation-manage-status is-unavailable';
|
||||
status.textContent = `Ошибка: ${error?.message || 'Не удалось загрузить связи'}`;
|
||||
});
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user