SHA256
Исправить регистр ключей и ответные связи
This commit is contained in:
@@ -2213,7 +2213,9 @@
|
||||
"text_066": "Subscribed",
|
||||
"text_067": "Subscribed.",
|
||||
"text_070": "Signed.",
|
||||
"text_071": "Category of notifications"
|
||||
"text_071": "Category of notifications",
|
||||
"text_072": "Add close friend in return",
|
||||
"text_073": "You are close friends now"
|
||||
},
|
||||
"user_profile_list_view": {
|
||||
"text_002": "Message",
|
||||
|
||||
@@ -2346,7 +2346,9 @@
|
||||
"text_068": "Подписался",
|
||||
"text_069": "Подписалась",
|
||||
"text_070": "Подписался(-ась)",
|
||||
"text_071": "Категория уведомлений"
|
||||
"text_071": "Категория уведомлений",
|
||||
"text_072": "Добавить в близкие друзья в ответ",
|
||||
"text_073": "Теперь вы близкие друзья"
|
||||
},
|
||||
"user_profile_list_view": {
|
||||
"text_001": "Список",
|
||||
|
||||
@@ -57,6 +57,24 @@ function actionLabel(item, activeTab) {
|
||||
: eventActionLabel(item.sourceMsgSubType, gender);
|
||||
}
|
||||
|
||||
function reciprocalRelationKind(item) {
|
||||
return Number(item?.connectionTypeCode ?? item?.sourceMsgSubType) === CONNECTION_CLOSE_FRIEND
|
||||
? 'close_friend'
|
||||
: 'friend';
|
||||
}
|
||||
|
||||
function reciprocalRelationLabel(kind) {
|
||||
return kind === 'close_friend'
|
||||
? t('screens.notifications_view.text_072')
|
||||
: t('screens.notifications_view.text_009');
|
||||
}
|
||||
|
||||
function reciprocalRelationSuccessLabel(kind) {
|
||||
return kind === 'close_friend'
|
||||
? t('screens.notifications_view.text_073')
|
||||
: t('screens.notifications_view.text_015');
|
||||
}
|
||||
|
||||
export const pageMeta = { id: 'notifications-view', get title() { return t('screens.notifications_view.text_001'); } };
|
||||
|
||||
function normalizeItem(item) {
|
||||
@@ -192,10 +210,19 @@ function renderHead(item) {
|
||||
|| item.sourceLogin || t('screens.notifications_view.text_030');
|
||||
const head = document.createElement('div');
|
||||
head.className = 'notification-card__head';
|
||||
const identity = document.createElement('div');
|
||||
identity.className = 'notification-card__identity';
|
||||
const name = document.createElement('strong');
|
||||
name.className = 'notification-card__name';
|
||||
name.textContent = fullName;
|
||||
head.append(name);
|
||||
identity.append(name);
|
||||
if (item.sourceLogin) {
|
||||
const login = document.createElement('span');
|
||||
login.className = 'notification-card__login';
|
||||
login.textContent = item.sourceLogin;
|
||||
identity.append(login);
|
||||
}
|
||||
head.append(identity);
|
||||
const time = document.createElement('span');
|
||||
time.className = 'notification-card__time';
|
||||
time.textContent = formatListTime(item.createdAtMs);
|
||||
@@ -301,8 +328,7 @@ function renderItem(item, activeTab, navigate) {
|
||||
function refreshItemRow(row, item, activeTab) {
|
||||
if (!row?.isConnected) return;
|
||||
row.querySelector('.notification-avatar')?.replaceWith(renderAvatar(item));
|
||||
const name = row.querySelector('.notification-card__name');
|
||||
if (name) name.textContent = renderHead(item).querySelector('.notification-card__name').textContent;
|
||||
row.querySelector('.notification-card__head')?.replaceWith(renderHead(item));
|
||||
const action = row.querySelector('.notification-card__action');
|
||||
if (action && activeTab !== 'replies') action.textContent = actionLabel(item, activeTab);
|
||||
if (activeTab === 'replies' && item.engagement && !row.querySelector('.notification-engagement')) {
|
||||
@@ -453,24 +479,25 @@ export function render({ navigate, chrome } = {}) {
|
||||
const row = rowByItem.get(item);
|
||||
const body = row?.querySelector('.notification-card__body');
|
||||
if (!body) continue;
|
||||
const kind = reciprocalRelationKind(item);
|
||||
const button = document.createElement('button');
|
||||
button.type = 'button';
|
||||
button.className = 'secondary-btn notification-card__answer';
|
||||
button.textContent = t('screens.notifications_view.text_009');
|
||||
button.textContent = reciprocalRelationLabel(kind);
|
||||
button.addEventListener('click', async (event) => {
|
||||
event.stopPropagation();
|
||||
button.disabled = true;
|
||||
button.textContent = t('screens.notifications_view.text_010');
|
||||
try {
|
||||
await authService.setUserRelation({ login: self, toLogin: login, kind: 'friend', enabled: true, storagePwd: state.session.storagePwdInMemory });
|
||||
await authService.setUserRelation({ login: self, toLogin: login, kind, enabled: true, storagePwd: state.session.storagePwdInMemory });
|
||||
const done = document.createElement('span');
|
||||
done.className = 'notification-card__answered';
|
||||
done.innerHTML = `${iconHtml('check')}<span>${th('screens.notifications_view.text_046')}</span>`;
|
||||
done.innerHTML = `${iconHtml('check')}<span>${th(reciprocalRelationSuccessLabel(kind))}</span>`;
|
||||
button.replaceWith(done);
|
||||
showToast(t('screens.notifications_view.text_015'));
|
||||
showToast(reciprocalRelationSuccessLabel(kind));
|
||||
} catch (error) {
|
||||
button.disabled = false;
|
||||
button.textContent = t('screens.notifications_view.text_011');
|
||||
button.textContent = reciprocalRelationLabel(kind);
|
||||
showToast(toUserMessage(error, t('screens.notifications_view.text_016')), { kind: 'error' });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user