mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-04 11:57:44 +02:00
Resolve merge conflicts, minify only .js files
This commit is contained in:
@@ -27,6 +27,7 @@ editController.get = function (req, res, callback) {
|
||||
userData.maximumProfileImageSize = parseInt(meta.config.maximumProfileImageSize, 10);
|
||||
userData.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads, 10) === 1;
|
||||
userData.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;
|
||||
userData.profileImageDimension = parseInt(meta.config.profileImageDimension, 10) || 128;
|
||||
|
||||
userData.groups = userData.groups.filter(function (group) {
|
||||
return group && group.userTitleEnabled && !groups.isPrivilegeGroup(group.name) && group.name !== 'registered-users';
|
||||
@@ -36,7 +37,15 @@ editController.get = function (req, res, callback) {
|
||||
});
|
||||
|
||||
userData.title = '[[pages:account/edit, ' + userData.username + ']]';
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([{ text: userData.username, url: '/user/' + userData.userslug }, { text: '[[user:edit]]' }]);
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([
|
||||
{
|
||||
text: userData.username,
|
||||
url: '/user/' + userData.userslug,
|
||||
},
|
||||
{
|
||||
text: '[[user:edit]]',
|
||||
},
|
||||
]);
|
||||
userData.editButtons = [];
|
||||
|
||||
plugins.fireHook('filter:user.account.edit', userData, function (err, userData) {
|
||||
@@ -76,9 +85,17 @@ function renderRoute(name, req, res, next) {
|
||||
|
||||
userData.title = '[[pages:account/edit/' + name + ', ' + userData.username + ']]';
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([
|
||||
{ text: userData.username, url: '/user/' + userData.userslug },
|
||||
{ text: '[[user:edit]]', url: '/user/' + userData.userslug + '/edit' },
|
||||
{ text: '[[user:' + name + ']]' },
|
||||
{
|
||||
text: userData.username,
|
||||
url: '/user/' + userData.userslug,
|
||||
},
|
||||
{
|
||||
text: '[[user:edit]]',
|
||||
url: '/user/' + userData.userslug + '/edit',
|
||||
},
|
||||
{
|
||||
text: '[[user:' + name + ']]',
|
||||
},
|
||||
]);
|
||||
|
||||
res.render('account/edit/' + name, userData);
|
||||
@@ -139,7 +156,10 @@ editController.uploadPicture = function (req, res, next) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.json([{ name: userPhoto.name, url: image.url.startsWith('http') ? image.url : nconf.get('relative_path') + image.url }]);
|
||||
res.json([{
|
||||
name: userPhoto.name,
|
||||
url: image.url.startsWith('http') ? image.url : nconf.get('relative_path') + image.url,
|
||||
}]);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -154,7 +174,9 @@ editController.uploadCoverPicture = function (req, res, next) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.json([{ url: image.url }]);
|
||||
res.json([{
|
||||
url: image.url,
|
||||
}]);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -37,11 +37,8 @@ settingsController.get = function (req, res, callback) {
|
||||
homePageRoutes: function (next) {
|
||||
getHomePageRoutes(next);
|
||||
},
|
||||
sounds: function (next) {
|
||||
meta.sounds.getFiles(next);
|
||||
},
|
||||
soundsMapping: function (next) {
|
||||
meta.sounds.getMapping(userData.uid, next);
|
||||
meta.sounds.getUserSoundMap(userData.uid, next);
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
@@ -50,16 +47,44 @@ settingsController.get = function (req, res, callback) {
|
||||
userData.languages = results.languages;
|
||||
userData.homePageRoutes = results.homePageRoutes;
|
||||
|
||||
var soundSettings = {
|
||||
notificationSound: 'notification',
|
||||
incomingChatSound: 'chat-incoming',
|
||||
outgoingChatSound: 'chat-outgoing',
|
||||
var types = [
|
||||
'notification',
|
||||
'chat-incoming',
|
||||
'chat-outgoing',
|
||||
];
|
||||
var aliases = {
|
||||
notification: 'notificationSound',
|
||||
'chat-incoming': 'incomingChatSound',
|
||||
'chat-outgoing': 'outgoingChatSound',
|
||||
};
|
||||
|
||||
Object.keys(soundSettings).forEach(function (setting) {
|
||||
userData[setting] = Object.keys(results.sounds).map(function (name) {
|
||||
return { name: name, selected: name === results.soundsMapping[soundSettings[setting]] };
|
||||
types.forEach(function (type) {
|
||||
var soundpacks = plugins.soundpacks.map(function (pack) {
|
||||
var sounds = Object.keys(pack.sounds).map(function (soundName) {
|
||||
var value = pack.name + ' | ' + soundName;
|
||||
return {
|
||||
name: soundName,
|
||||
value: value,
|
||||
selected: value === results.soundsMapping[type],
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
name: pack.name,
|
||||
sounds: sounds,
|
||||
};
|
||||
});
|
||||
|
||||
userData[type + '-sound'] = soundpacks;
|
||||
// fallback
|
||||
userData[aliases[type]] = soundpacks.concat.apply([], soundpacks.map(function (pack) {
|
||||
return pack.sounds.map(function (sound) {
|
||||
return {
|
||||
name: sound.value,
|
||||
selected: sound.selected,
|
||||
};
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
plugins.fireHook('filter:user.customSettings', { settings: results.settings, customSettings: [], uid: req.uid }, next);
|
||||
|
||||
@@ -30,6 +30,14 @@ dashboardController.get = function (req, res, next) {
|
||||
link: '/admin/extend/plugins',
|
||||
},
|
||||
];
|
||||
|
||||
if (global.env !== 'production') {
|
||||
notices.push({
|
||||
done: false,
|
||||
notDoneText: '[[admin/general/dashboard:running-in-development]]',
|
||||
});
|
||||
}
|
||||
|
||||
plugins.fireHook('filter:admin.notices', notices, next);
|
||||
},
|
||||
}, function (err, results) {
|
||||
|
||||
@@ -1,24 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
var meta = require('../../meta');
|
||||
var plugins = require('../../plugins');
|
||||
var db = require('../../database');
|
||||
|
||||
var soundsController = {};
|
||||
|
||||
soundsController.get = function (req, res, next) {
|
||||
meta.sounds.getFiles(function (err, sounds) {
|
||||
db.getObject('settings:sounds', function (err, settings) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
sounds = Object.keys(sounds).map(function (name) {
|
||||
return {
|
||||
name: name,
|
||||
};
|
||||
settings = settings || {};
|
||||
|
||||
var types = [
|
||||
'notification',
|
||||
'chat-incoming',
|
||||
'chat-outgoing',
|
||||
];
|
||||
var output = {};
|
||||
|
||||
types.forEach(function (type) {
|
||||
var soundpacks = plugins.soundpacks.map(function (pack) {
|
||||
var sounds = Object.keys(pack.sounds).map(function (soundName) {
|
||||
var value = pack.name + ' | ' + soundName;
|
||||
return {
|
||||
name: soundName,
|
||||
value: value,
|
||||
selected: value === settings[type],
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
name: pack.name,
|
||||
sounds: sounds,
|
||||
};
|
||||
});
|
||||
|
||||
output[type + '-sound'] = soundpacks;
|
||||
});
|
||||
|
||||
res.render('admin/general/sounds', {
|
||||
sounds: sounds,
|
||||
});
|
||||
res.render('admin/general/sounds', output);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ var path = require('path');
|
||||
var async = require('async');
|
||||
var nconf = require('nconf');
|
||||
var winston = require('winston');
|
||||
|
||||
var meta = require('../../meta');
|
||||
var file = require('../../file');
|
||||
var image = require('../../image');
|
||||
var plugins = require('../../plugins');
|
||||
@@ -105,12 +107,7 @@ uploadsController.uploadSound = function (req, res, next) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
var soundsPath = path.join(__dirname, '../../../build/public/sounds');
|
||||
var filePath = path.join(nconf.get('upload_path'), 'sounds', uploadedFile.name);
|
||||
|
||||
file.link(filePath, path.join(soundsPath, path.basename(filePath)));
|
||||
|
||||
fs.unlink(uploadedFile.path, function (err) {
|
||||
meta.sounds.build(function (err) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user