diff --git a/public/src/admin/general/sounds.js b/public/src/admin/general/sounds.js index fc5f0aa7ee..5e17015dd7 100644 --- a/public/src/admin/general/sounds.js +++ b/public/src/admin/general/sounds.js @@ -13,20 +13,6 @@ define('admin/general/sounds', ['sounds', 'settings', 'admin/settings'], functio Sounds.playSound(soundName); }); - // Load Form Values - Settings.load('sounds', $('.sounds form')); - - // Saving of Form Values - var saveEl = $('#save'); - saveEl.on('click', function () { - Settings.save('sounds', $('.sounds form'), function () { - socket.emit('admin.fireEvent', { - name: 'event:sounds.reloadMapping', - }); - app.alertSuccess('[[admin/general/sounds:saved]]'); - }); - }); - AdminSettings.prepare(); }; diff --git a/src/controllers/admin/sounds.js b/src/controllers/admin/sounds.js index bc4730a865..164bf4a427 100644 --- a/src/controllers/admin/sounds.js +++ b/src/controllers/admin/sounds.js @@ -1,23 +1,23 @@ 'use strict'; var plugins = require('../../plugins'); -var db = require('../../database'); +var meta = require('../../meta'); var soundsController = {}; soundsController.get = function (req, res, next) { - db.getObject('settings:sounds', function (err, settings) { + var types = [ + 'notification', + 'chat-incoming', + 'chat-outgoing', + ]; + meta.configs.getFields(types, function (err, settings) { if (err) { return next(err); } settings = settings || {}; - var types = [ - 'notification', - 'chat-incoming', - 'chat-outgoing', - ]; var output = {}; types.forEach(function (type) { diff --git a/src/meta/sounds.js b/src/meta/sounds.js index af6cbe3a2a..24f2518df7 100644 --- a/src/meta/sounds.js +++ b/src/meta/sounds.js @@ -9,8 +9,6 @@ var async = require('async'); var file = require('../file'); var plugins = require('../plugins'); var user = require('../user'); -var db = require('../database'); - var soundsPath = path.join(__dirname, '../../build/public/sounds'); var uploadsPath = path.join(__dirname, '../../public/uploads/sounds'); @@ -100,7 +98,7 @@ module.exports = function (Meta) { Meta.sounds.getUserSoundMap = function getUserSoundMap(uid, callback) { async.parallel({ defaultMapping: function (next) { - db.getObject('settings:sounds', next); + Meta.configs.getFields(keys, next); }, userSettings: function (next) { user.getSettings(uid, next); @@ -112,18 +110,18 @@ module.exports = function (Meta) { var userSettings = results.userSettings; userSettings = { - notification: userSettings.notificationSound, - 'chat-incoming': userSettings.incomingChatSound, - 'chat-outgoing': userSettings.outgoingChatSound, + notification: userSettings.notificationSound || userSettings['notification-sound'], + 'chat-incoming': userSettings.incomingChatSound || userSettings['chat-incoming-sound'], + 'chat-outgoing': userSettings.outgoingChatSound || userSettings['chat-outgoing-sound'], }; var defaultMapping = results.defaultMapping || {}; var soundMapping = {}; keys.forEach(function (key) { if (userSettings[key] || userSettings[key] === '') { - soundMapping[key] = userSettings[key] || null; + soundMapping[key] = userSettings[key] || ''; } else { - soundMapping[key] = defaultMapping[key] || null; + soundMapping[key] = defaultMapping[key] || ''; } }); diff --git a/src/views/admin/general/sounds.tpl b/src/views/admin/general/sounds.tpl index c7b8df97a7..e5c7fc848d 100644 --- a/src/views/admin/general/sounds.tpl +++ b/src/views/admin/general/sounds.tpl @@ -7,7 +7,7 @@
- @@ -33,7 +33,7 @@
- @@ -54,7 +54,7 @@
-