added setting to disable notification sounds

v1.18.x
barisusakli 11 years ago
parent 36e949acea
commit 0f66e80a5a

@ -49,5 +49,7 @@
"paginate_description" : "Paginate topics and posts instead of using infinite scroll.", "paginate_description" : "Paginate topics and posts instead of using infinite scroll.",
"topics_per_page": "Topics per Page", "topics_per_page": "Topics per Page",
"posts_per_page": "Posts per Page" "posts_per_page": "Posts per Page",
"notification_sounds" : "Play a sound when you receive a notification."
} }

@ -67,6 +67,9 @@ define(['buzz'], function(buzz) {
}; };
Sounds.play = function(name) { Sounds.play = function(name) {
if (!config.notificationSounds) {
return;
}
var ready = function() { var ready = function() {
if (Sounds.mapping[name] && Sounds.loaded[Sounds.mapping[name]]) { if (Sounds.mapping[name] && Sounds.loaded[Sounds.mapping[name]]) {
Sounds.loaded[Sounds.mapping[name]].play(); Sounds.loaded[Sounds.mapping[name]].play();

@ -47,6 +47,7 @@ apiController.getConfig = function(req, res, next) {
config.usePagination = settings.usePagination; config.usePagination = settings.usePagination;
config.topicsPerPage = settings.topicsPerPage; config.topicsPerPage = settings.topicsPerPage;
config.postsPerPage = settings.postsPerPage; config.postsPerPage = settings.postsPerPage;
config.notificationSounds = settings.notificationSounds;
if (res.locals.isAPI) { if (res.locals.isAPI) {
res.json(200, config); res.json(200, config);

@ -28,7 +28,7 @@ module.exports = function(User) {
settings.usePagination = settings.usePagination ? parseInt(settings.usePagination, 10) === 1 : parseInt(meta.config.usePagination, 10) === 1; settings.usePagination = settings.usePagination ? parseInt(settings.usePagination, 10) === 1 : parseInt(meta.config.usePagination, 10) === 1;
settings.topicsPerPage = settings.topicsPerPage ? parseInt(settings.topicsPerPage, 10) : parseInt(meta.config.topicsPerPage, 10) || 20; settings.topicsPerPage = settings.topicsPerPage ? parseInt(settings.topicsPerPage, 10) : parseInt(meta.config.topicsPerPage, 10) || 20;
settings.postsPerPage = settings.postsPerPage ? parseInt(settings.postsPerPage, 10) : parseInt(meta.config.postsPerPage, 10) || 10; settings.postsPerPage = settings.postsPerPage ? parseInt(settings.postsPerPage, 10) : parseInt(meta.config.postsPerPage, 10) || 10;
settings.notificationSounds = settings.notificationSounds ? parseInt(settings.notificationSounds, 10) === 1 : true;
callback(null, settings); callback(null, settings);
}); });
}); });
@ -46,7 +46,8 @@ module.exports = function(User) {
showemail: data.showemail, showemail: data.showemail,
usePagination: data.usePagination, usePagination: data.usePagination,
topicsPerPage: data.topicsPerPage, topicsPerPage: data.topicsPerPage,
postsPerPage: data.postsPerPage postsPerPage: data.postsPerPage,
notificationSounds: data.notificationSounds
}, callback); }, callback);
}; };
}; };
Loading…
Cancel
Save