mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
default sounds to off, show correct setting in user settings page
This commit is contained in:
@@ -102,6 +102,7 @@
|
|||||||
"incoming-message-sound": "Incoming message sound",
|
"incoming-message-sound": "Incoming message sound",
|
||||||
"outgoing-message-sound": "Outgoing message sound",
|
"outgoing-message-sound": "Outgoing message sound",
|
||||||
"notification-sound": "Notification sound",
|
"notification-sound": "Notification sound",
|
||||||
|
"no-sound": "No sound",
|
||||||
|
|
||||||
"browsing": "Browsing Settings",
|
"browsing": "Browsing Settings",
|
||||||
"open_links_in_new_tab": "Open outgoing links in new tab",
|
"open_links_in_new_tab": "Open outgoing links in new tab",
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ settingsController.get = function(req, res, callback) {
|
|||||||
},
|
},
|
||||||
sounds: function(next) {
|
sounds: function(next) {
|
||||||
meta.sounds.getFiles(next);
|
meta.sounds.getFiles(next);
|
||||||
|
},
|
||||||
|
soundsMapping: function(next) {
|
||||||
|
meta.sounds.getMapping(userData.uid, next);
|
||||||
}
|
}
|
||||||
}, next);
|
}, next);
|
||||||
},
|
},
|
||||||
@@ -47,10 +50,15 @@ settingsController.get = function(req, res, callback) {
|
|||||||
userData.languages = results.languages;
|
userData.languages = results.languages;
|
||||||
userData.homePageRoutes = results.homePageRoutes;
|
userData.homePageRoutes = results.homePageRoutes;
|
||||||
|
|
||||||
var soundSettings = ['notificationSound', 'incomingChatSound', 'outgoingChatSound'];
|
var soundSettings = {
|
||||||
soundSettings.forEach(function(setting) {
|
'notificationSound': 'notification',
|
||||||
|
'incomingChatSound': 'chat-incoming',
|
||||||
|
'outgoingChatSound': 'chat-outgoing'
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.keys(soundSettings).forEach(function(setting) {
|
||||||
userData[setting] = Object.keys(results.sounds).map(function(name) {
|
userData[setting] = Object.keys(results.sounds).map(function(name) {
|
||||||
return {name: name, selected: name === userData.settings[setting]};
|
return {name: name, selected: name === results.soundsMapping[soundSettings[setting]]};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -75,13 +75,13 @@ module.exports = function(Meta) {
|
|||||||
var defaultMapping = results.defaultMapping || {};
|
var defaultMapping = results.defaultMapping || {};
|
||||||
var soundMapping = {};
|
var soundMapping = {};
|
||||||
soundMapping.notification = (userSettings.notificationSound || userSettings.notificationSound === '') ?
|
soundMapping.notification = (userSettings.notificationSound || userSettings.notificationSound === '') ?
|
||||||
userSettings.notificationSound : defaultMapping.notification || 'notification.mp3';
|
userSettings.notificationSound : defaultMapping.notification || '';
|
||||||
|
|
||||||
soundMapping['chat-incoming'] = (userSettings.incomingChatSound || userSettings.incomingChatSound === '') ?
|
soundMapping['chat-incoming'] = (userSettings.incomingChatSound || userSettings.incomingChatSound === '') ?
|
||||||
userSettings.incomingChatSound : defaultMapping['chat-incoming'] || 'waterdrop-high.mp3';
|
userSettings.incomingChatSound : defaultMapping['chat-incoming'] || '';
|
||||||
|
|
||||||
soundMapping['chat-outgoing'] = (userSettings.outgoingChatSound || userSettings.outgoingChatSound === '') ?
|
soundMapping['chat-outgoing'] = (userSettings.outgoingChatSound || userSettings.outgoingChatSound === '') ?
|
||||||
userSettings.outgoingChatSound : defaultMapping['chat-outgoing'] || undefined;
|
userSettings.outgoingChatSound : defaultMapping['chat-outgoing'] || '';
|
||||||
|
|
||||||
callback(null, soundMapping);
|
callback(null, soundMapping);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-xs-9">
|
<div class="form-group col-xs-9">
|
||||||
<select class="form-control" id="notification" name="notification">
|
<select class="form-control" id="notification" name="notification">
|
||||||
<option value=""></option>
|
<option value="">[[user:no-sound]]</option>
|
||||||
<!-- BEGIN sounds -->
|
<!-- BEGIN sounds -->
|
||||||
<option value="{sounds.name}">{sounds.name}</option>
|
<option value="{sounds.name}">{sounds.name}</option>
|
||||||
<!-- END sounds -->
|
<!-- END sounds -->
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-xs-9">
|
<div class="form-group col-xs-9">
|
||||||
<select class="form-control" id="chat-incoming" name="chat-incoming">
|
<select class="form-control" id="chat-incoming" name="chat-incoming">
|
||||||
<option value=""></option>
|
<option value="">[[user:no-sound]]</option>
|
||||||
<!-- BEGIN sounds -->
|
<!-- BEGIN sounds -->
|
||||||
<option value="{sounds.name}">{sounds.name}</option>
|
<option value="{sounds.name}">{sounds.name}</option>
|
||||||
<!-- END sounds -->
|
<!-- END sounds -->
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-xs-9">
|
<div class="form-group col-xs-9">
|
||||||
<select class="form-control" id="chat-outgoing" name="chat-outgoing">
|
<select class="form-control" id="chat-outgoing" name="chat-outgoing">
|
||||||
<option value=""></option>
|
<option value="">[[user:no-sound]]</option>
|
||||||
<!-- BEGIN sounds -->
|
<!-- BEGIN sounds -->
|
||||||
<option value="{sounds.name}">{sounds.name}</option>
|
<option value="{sounds.name}">{sounds.name}</option>
|
||||||
<!-- END sounds -->
|
<!-- END sounds -->
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<button type="button" class="form-control btn btn-sm btn-default" data-action="play"><span class="hidden-xs">Play </span><i class="fa fa-play"></i></button>
|
<button type="button" class="form-control btn btn-sm btn-default" data-action="play"><span class="hidden-xs">Play </span><i class="fa fa-play"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<input data-action="upload" data-title="Upload Sound" data-route="{config.relative_path}/api/admin/upload/sound" type="button" class="btn btn-primary" value="Upload New Sound"></input>
|
<input data-action="upload" data-title="Upload Sound" data-route="{config.relative_path}/api/admin/upload/sound" type="button" class="btn btn-primary" value="Upload New Sound"></input>
|
||||||
|
|||||||
Reference in New Issue
Block a user