mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
feat: change notif controls to toggles
This commit is contained in:
@@ -107,10 +107,10 @@
|
||||
"nodebb-plugin-spam-be-gone": "2.3.2",
|
||||
"nodebb-plugin-web-push": "0.7.6",
|
||||
"nodebb-rewards-essentials": "1.0.2",
|
||||
"nodebb-theme-harmony": "2.2.21",
|
||||
"nodebb-theme-harmony": "2.2.23",
|
||||
"nodebb-theme-lavender": "7.1.21",
|
||||
"nodebb-theme-peace": "2.2.51",
|
||||
"nodebb-theme-persona": "14.2.13",
|
||||
"nodebb-theme-persona": "14.2.15",
|
||||
"nodebb-widget-essentials": "7.0.42",
|
||||
"nodemailer": "8.0.1",
|
||||
"nprogress": "0.2.0",
|
||||
|
||||
@@ -93,9 +93,9 @@
|
||||
"notificationType-upvote": "When someone upvotes your post",
|
||||
"notificationType-new-topic": "When someone you follow posts a topic",
|
||||
"notificationType-new-topic-with-tag": "When a topic is posted with a tag you follow",
|
||||
"notificationType-new-topic-in-category": "When a topic is posted in a category you are watching",
|
||||
"notificationType-new-reply": "When a new reply is posted in a topic you are watching",
|
||||
"notificationType-post-edit": "When a post is edited in a topic you are watching",
|
||||
"notificationType-new-topic-in-category": "When a topic is posted in a watched category",
|
||||
"notificationType-new-reply": "When a reply is posted in a watched topic",
|
||||
"notificationType-post-edit": "When a post is edited in a watched topic",
|
||||
"notificationType-follow": "When someone starts following you",
|
||||
"notificationType-new-chat": "When you receive a chat message",
|
||||
"notificationType-new-group-chat": "When you receive a group chat message",
|
||||
|
||||
@@ -155,6 +155,8 @@
|
||||
"upvote-notif-freq.threshold": "On 1, 5, 10, 25, 50, 100, 150, 200...",
|
||||
"upvote-notif-freq.logarithmic": "On 10, 100, 1000...",
|
||||
"upvote-notif-freq.disabled": "Disabled",
|
||||
"notification-type-web": "Web",
|
||||
"notification-type-email": "Email",
|
||||
|
||||
"browsing": "Browsing Settings",
|
||||
"unread.cutoff": "Unread cutoff (Maximum %1 days)",
|
||||
|
||||
@@ -73,6 +73,8 @@ get:
|
||||
type: string
|
||||
label:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
none:
|
||||
type: boolean
|
||||
notification:
|
||||
|
||||
@@ -49,6 +49,8 @@ define('forum/account/settings', [
|
||||
components.get('user/sessions').find('.timeago').timeago();
|
||||
|
||||
handleChatAllowDenyList();
|
||||
|
||||
handleNotificationToggles();
|
||||
};
|
||||
|
||||
function loadSettings() {
|
||||
@@ -224,5 +226,24 @@ define('forum/account/settings', [
|
||||
}
|
||||
}
|
||||
|
||||
function handleNotificationToggles() {
|
||||
$('[component="notification/table"]').on('click', '[data-value]', function () {
|
||||
const $el = $(this);
|
||||
const isTurnedOn = parseInt($el.attr('data-value'), 10) === 0;
|
||||
$el.attr('data-value', isTurnedOn ? 1 : 0);
|
||||
$el.find('i').first().toggleClass('hidden', !isTurnedOn);
|
||||
$el.find('i').last().toggleClass('hidden', isTurnedOn);
|
||||
|
||||
const row = $el.parents('[component="notification/setting"]');
|
||||
const isNotifOn = row.find('[data-type="notification"]').attr('data-value') === '1';
|
||||
const isEmailOn = row.find('[data-type="email"]').attr('data-value') === '1';
|
||||
const newSelectValue = [
|
||||
isNotifOn && 'notification',
|
||||
isEmailOn && 'email',
|
||||
].filter(Boolean).join('') || 'none';
|
||||
row.find('input[data-property]').val(newSelectValue);
|
||||
});
|
||||
}
|
||||
|
||||
return AccountSettings;
|
||||
});
|
||||
|
||||
@@ -189,6 +189,7 @@ async function getNotificationSettings(userData) {
|
||||
return {
|
||||
name: type,
|
||||
label: `[[notifications:${type.replace(/_/g, '-')}]]`,
|
||||
value: setting,
|
||||
none: setting === 'none',
|
||||
notification: setting === 'notification',
|
||||
email: setting === 'email',
|
||||
|
||||
Reference in New Issue
Block a user