mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-31 19:15:58 +01:00
Resolve merge conflicts
This commit is contained in:
@@ -32,7 +32,9 @@ define('pictureCropper', ['translator', 'cropper'], function (translator, croppe
|
|||||||
|
|
||||||
module.handleImageCrop = function (data, callback) {
|
module.handleImageCrop = function (data, callback) {
|
||||||
$('#crop-picture-modal').remove();
|
$('#crop-picture-modal').remove();
|
||||||
templates.parse('modals/crop_picture', { url: data.url }, function (cropperHtml) {
|
templates.parse('modals/crop_picture', {
|
||||||
|
url: data.url,
|
||||||
|
}, function (cropperHtml) {
|
||||||
translator.translate(cropperHtml, function (translated) {
|
translator.translate(cropperHtml, function (translated) {
|
||||||
var cropperModal = $(translated);
|
var cropperModal = $(translated);
|
||||||
cropperModal.modal('show');
|
cropperModal.modal('show');
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ var async = require('async');
|
|||||||
var nconf = require('nconf');
|
var nconf = require('nconf');
|
||||||
var validator = require('validator');
|
var validator = require('validator');
|
||||||
var winston = require('winston');
|
var winston = require('winston');
|
||||||
var mime = require('mime');
|
|
||||||
|
|
||||||
var meta = require('../meta');
|
var meta = require('../meta');
|
||||||
var file = require('../file');
|
var file = require('../file');
|
||||||
@@ -59,7 +58,10 @@ function uploadAsImage(req, uploadedFile, callback) {
|
|||||||
return next(new Error('[[error:no-privileges]]'));
|
return next(new Error('[[error:no-privileges]]'));
|
||||||
}
|
}
|
||||||
if (plugins.hasListeners('filter:uploadImage')) {
|
if (plugins.hasListeners('filter:uploadImage')) {
|
||||||
return plugins.fireHook('filter:uploadImage', { image: uploadedFile, uid: req.uid }, callback);
|
return plugins.fireHook('filter:uploadImage', {
|
||||||
|
image: uploadedFile,
|
||||||
|
uid: req.uid,
|
||||||
|
}, callback);
|
||||||
}
|
}
|
||||||
file.isFileTypeAllowed(uploadedFile.path, next);
|
file.isFileTypeAllowed(uploadedFile.path, next);
|
||||||
},
|
},
|
||||||
@@ -155,7 +157,10 @@ uploadsController.uploadThumb = function (req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plugins.hasListeners('filter:uploadImage')) {
|
if (plugins.hasListeners('filter:uploadImage')) {
|
||||||
return plugins.fireHook('filter:uploadImage', { image: uploadedFile, uid: req.uid }, next);
|
return plugins.fireHook('filter:uploadImage', {
|
||||||
|
image: uploadedFile,
|
||||||
|
uid: req.uid,
|
||||||
|
}, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadFile(req.uid, uploadedFile, next);
|
uploadFile(req.uid, uploadedFile, next);
|
||||||
@@ -166,11 +171,17 @@ uploadsController.uploadThumb = function (req, res, next) {
|
|||||||
|
|
||||||
uploadsController.uploadGroupCover = function (uid, uploadedFile, callback) {
|
uploadsController.uploadGroupCover = function (uid, uploadedFile, callback) {
|
||||||
if (plugins.hasListeners('filter:uploadImage')) {
|
if (plugins.hasListeners('filter:uploadImage')) {
|
||||||
return plugins.fireHook('filter:uploadImage', { image: uploadedFile, uid: uid }, callback);
|
return plugins.fireHook('filter:uploadImage', {
|
||||||
|
image: uploadedFile,
|
||||||
|
uid: uid,
|
||||||
|
}, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugins.hasListeners('filter:uploadFile')) {
|
if (plugins.hasListeners('filter:uploadFile')) {
|
||||||
return plugins.fireHook('filter:uploadFile', { file: uploadedFile, uid: uid }, callback);
|
return plugins.fireHook('filter:uploadFile', {
|
||||||
|
file: uploadedFile,
|
||||||
|
uid: uid,
|
||||||
|
}, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
file.isFileTypeAllowed(uploadedFile.path, function (err) {
|
file.isFileTypeAllowed(uploadedFile.path, function (err) {
|
||||||
@@ -183,7 +194,10 @@ uploadsController.uploadGroupCover = function (uid, uploadedFile, callback) {
|
|||||||
|
|
||||||
function uploadFile(uid, uploadedFile, callback) {
|
function uploadFile(uid, uploadedFile, callback) {
|
||||||
if (plugins.hasListeners('filter:uploadFile')) {
|
if (plugins.hasListeners('filter:uploadFile')) {
|
||||||
return plugins.fireHook('filter:uploadFile', { file: uploadedFile, uid: uid }, callback);
|
return plugins.fireHook('filter:uploadFile', {
|
||||||
|
file: uploadedFile,
|
||||||
|
uid: uid,
|
||||||
|
}, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uploadedFile) {
|
if (!uploadedFile) {
|
||||||
@@ -196,7 +210,7 @@ function uploadFile(uid, uploadedFile, callback) {
|
|||||||
|
|
||||||
if (meta.config.hasOwnProperty('allowedFileExtensions')) {
|
if (meta.config.hasOwnProperty('allowedFileExtensions')) {
|
||||||
var allowed = file.allowedExtensions();
|
var allowed = file.allowedExtensions();
|
||||||
var extension = typeToExtension(uploadedFile.type);
|
var extension = file.typeToExtension(uploadedFile.type);
|
||||||
if (!extension || (allowed.length > 0 && allowed.indexOf(extension) === -1)) {
|
if (!extension || (allowed.length > 0 && allowed.indexOf(extension) === -1)) {
|
||||||
return callback(new Error('[[error:invalid-file-type, ' + allowed.join(', ') + ']]'));
|
return callback(new Error('[[error:invalid-file-type, ' + allowed.join(', ') + ']]'));
|
||||||
}
|
}
|
||||||
@@ -206,7 +220,7 @@ function uploadFile(uid, uploadedFile, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveFileToLocal(uploadedFile, callback) {
|
function saveFileToLocal(uploadedFile, callback) {
|
||||||
var extension = typeToExtension(uploadedFile.type);
|
var extension = file.typeToExtension(uploadedFile.type);
|
||||||
if (!extension) {
|
if (!extension) {
|
||||||
return callback(new Error('[[error:invalid-extension]]'));
|
return callback(new Error('[[error:invalid-extension]]'));
|
||||||
}
|
}
|
||||||
@@ -227,14 +241,6 @@ function saveFileToLocal(uploadedFile, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function typeToExtension(type) {
|
|
||||||
var extension;
|
|
||||||
if (type) {
|
|
||||||
extension = '.' + mime.extension(type);
|
|
||||||
}
|
|
||||||
return extension;
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteTempFiles(files) {
|
function deleteTempFiles(files) {
|
||||||
async.each(files, function (file, next) {
|
async.each(files, function (file, next) {
|
||||||
fs.unlink(file.path, function (err) {
|
fs.unlink(file.path, function (err) {
|
||||||
@@ -246,5 +252,4 @@ function deleteTempFiles(files) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = uploadsController;
|
module.exports = uploadsController;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ var path = require('path');
|
|||||||
var winston = require('winston');
|
var winston = require('winston');
|
||||||
var jimp = require('jimp');
|
var jimp = require('jimp');
|
||||||
var mkdirp = require('mkdirp');
|
var mkdirp = require('mkdirp');
|
||||||
|
var mime = require('mime');
|
||||||
|
|
||||||
var utils = require('../public/src/utils');
|
var utils = require('../public/src/utils');
|
||||||
|
|
||||||
@@ -120,4 +121,12 @@ file.linkDirs = function linkDirs(sourceDir, destDir, callback) {
|
|||||||
fs.symlink(sourceDir, destDir, type, callback);
|
fs.symlink(sourceDir, destDir, type, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
file.typeToExtension = function (type) {
|
||||||
|
var extension;
|
||||||
|
if (type) {
|
||||||
|
extension = '.' + mime.extension(type);
|
||||||
|
}
|
||||||
|
return extension;
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = file;
|
module.exports = file;
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ function setupConfigs() {
|
|||||||
nconf.set('use_port', !!urlObject.port);
|
nconf.set('use_port', !!urlObject.port);
|
||||||
nconf.set('relative_path', relativePath);
|
nconf.set('relative_path', relativePath);
|
||||||
nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
|
nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567);
|
||||||
|
nconf.set('upload_url', '/assets/uploads');
|
||||||
}
|
}
|
||||||
|
|
||||||
function printStartupInfo() {
|
function printStartupInfo() {
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ module.exports = function (User) {
|
|||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
if (plugins.hasListeners('filter:uploadImage')) {
|
if (plugins.hasListeners('filter:uploadImage')) {
|
||||||
return plugins.fireHook('filter:uploadImage', { image: picture, uid: updateUid }, next);
|
return plugins.fireHook('filter:uploadImage', {
|
||||||
|
image: picture,
|
||||||
|
uid: updateUid,
|
||||||
|
}, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename = updateUid + '-profileimg' + (keepAllVersions ? '-' + Date.now() : '') + (convertToPNG ? '.png' : extension);
|
var filename = updateUid + '-profileimg' + (keepAllVersions ? '-' + Date.now() : '') + (convertToPNG ? '.png' : extension);
|
||||||
@@ -77,7 +80,10 @@ module.exports = function (User) {
|
|||||||
},
|
},
|
||||||
function (_image, next) {
|
function (_image, next) {
|
||||||
uploadedImage = _image;
|
uploadedImage = _image;
|
||||||
User.setUserFields(updateUid, { uploadedpicture: uploadedImage.url, picture: uploadedImage.url }, next);
|
User.setUserFields(updateUid, {
|
||||||
|
uploadedpicture: uploadedImage.url,
|
||||||
|
picture: uploadedImage.url,
|
||||||
|
}, next);
|
||||||
},
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
next(null, uploadedImage);
|
next(null, uploadedImage);
|
||||||
@@ -90,10 +96,11 @@ module.exports = function (User) {
|
|||||||
return callback(new Error('[[error:no-plugin]]'));
|
return callback(new Error('[[error:no-plugin]]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
request.head(url, function (err, res) {
|
async.waterfall([
|
||||||
if (err) {
|
function (next) {
|
||||||
return callback(err);
|
request.head(url, next);
|
||||||
}
|
},
|
||||||
|
function (res, body, next) {
|
||||||
var uploadSize = parseInt(meta.config.maximumProfileImageSize, 10) || 256;
|
var uploadSize = parseInt(meta.config.maximumProfileImageSize, 10) || 256;
|
||||||
var size = res.headers['content-length'];
|
var size = res.headers['content-length'];
|
||||||
var type = res.headers['content-type'];
|
var type = res.headers['content-type'];
|
||||||
@@ -107,15 +114,23 @@ module.exports = function (User) {
|
|||||||
return callback(new Error('[[error:file-too-big, ' + uploadSize + ']]'));
|
return callback(new Error('[[error:file-too-big, ' + uploadSize + ']]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var picture = { url: url, name: '' };
|
plugins.fireHook('filter:uploadImage', {
|
||||||
plugins.fireHook('filter:uploadImage', { image: picture, uid: uid }, function (err, image) {
|
uid: uid,
|
||||||
if (err) {
|
image: {
|
||||||
return callback(err);
|
url: url,
|
||||||
}
|
name: '',
|
||||||
User.setUserFields(uid, { uploadedpicture: image.url, picture: image.url });
|
},
|
||||||
callback(null, image);
|
}, next);
|
||||||
});
|
},
|
||||||
|
function (image, next) {
|
||||||
|
User.setUserFields(uid, {
|
||||||
|
uploadedpicture: image.url,
|
||||||
|
picture: image.url,
|
||||||
|
}, function (err) {
|
||||||
|
next(err, image);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
User.updateCoverPosition = function (uid, position, callback) {
|
User.updateCoverPosition = function (uid, position, callback) {
|
||||||
@@ -123,9 +138,11 @@ module.exports = function (User) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
User.updateCoverPicture = function (data, callback) {
|
User.updateCoverPicture = function (data, callback) {
|
||||||
var keepAllVersions = parseInt(meta.config['profile:keepAllUserImages'], 10) === 1;
|
|
||||||
var url;
|
var url;
|
||||||
var md5sum;
|
var image = {
|
||||||
|
name: 'profileCover',
|
||||||
|
uid: data.uid,
|
||||||
|
};
|
||||||
|
|
||||||
if (!data.imageData && data.position) {
|
if (!data.imageData && data.position) {
|
||||||
return User.updateCoverPosition(data.uid, data.position, callback);
|
return User.updateCoverPosition(data.uid, data.position, callback);
|
||||||
@@ -144,87 +161,41 @@ module.exports = function (User) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.file) {
|
if (data.file) {
|
||||||
return next();
|
return setImmediate(next, null, data.file.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
md5sum = crypto.createHash('md5');
|
saveImageDataToTempFile(data.imageData, next);
|
||||||
md5sum.update(data.imageData);
|
|
||||||
md5sum = md5sum.digest('hex');
|
|
||||||
|
|
||||||
data.file = {
|
|
||||||
path: path.join(os.tmpdir(), md5sum),
|
|
||||||
};
|
|
||||||
|
|
||||||
var buffer = new Buffer(data.imageData.slice(data.imageData.indexOf('base64') + 7), 'base64');
|
|
||||||
|
|
||||||
fs.writeFile(data.file.path, buffer, {
|
|
||||||
encoding: 'base64',
|
|
||||||
}, next);
|
|
||||||
},
|
},
|
||||||
function (next) {
|
function (path, next) {
|
||||||
var image = {
|
image.path = path;
|
||||||
name: 'profileCover',
|
|
||||||
path: data.file.path,
|
|
||||||
uid: data.uid,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (plugins.hasListeners('filter:uploadImage')) {
|
uploadProfileOrCover('profilecover', image, data.imageData, next);
|
||||||
return plugins.fireHook('filter:uploadImage', { image: image, uid: data.uid }, next);
|
|
||||||
}
|
|
||||||
|
|
||||||
var filename = data.uid + '-profilecover' + (keepAllVersions ? '-' + Date.now() : '');
|
|
||||||
async.waterfall([
|
|
||||||
function (next) {
|
|
||||||
file.isFileTypeAllowed(data.file.path, next);
|
|
||||||
},
|
|
||||||
function (next) {
|
|
||||||
file.saveFileToLocal(filename, 'profile', image.path, next);
|
|
||||||
},
|
|
||||||
function (upload, next) {
|
|
||||||
next(null, {
|
|
||||||
url: nconf.get('relative_path') + upload.url,
|
|
||||||
name: image.name,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
], next);
|
|
||||||
},
|
},
|
||||||
function (uploadData, next) {
|
function (uploadData, next) {
|
||||||
url = uploadData.url;
|
url = uploadData.url;
|
||||||
User.setUserField(data.uid, 'cover:url', uploadData.url, next);
|
User.setUserField(data.uid, 'cover:url', uploadData.url, next);
|
||||||
},
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
fs.unlink(data.file.path, function (err) {
|
if (data.position) {
|
||||||
if (err) {
|
User.updateCoverPosition(data.uid, data.position, next);
|
||||||
winston.error(err);
|
} else {
|
||||||
|
setImmediate(next);
|
||||||
}
|
}
|
||||||
next();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
], function (err) {
|
], function (err) {
|
||||||
if (err) {
|
deleteFile(image.path);
|
||||||
return fs.unlink(data.file.path, function (unlinkErr) {
|
callback(err, {
|
||||||
if (unlinkErr) {
|
url: url,
|
||||||
winston.error(unlinkErr);
|
|
||||||
}
|
|
||||||
|
|
||||||
callback(err); // send back the original error
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (data.position) {
|
|
||||||
User.updateCoverPosition(data.uid, data.position, function (err) {
|
|
||||||
callback(err, { url: url });
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
callback(err, { url: url });
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
User.uploadCroppedPicture = function (data, callback) {
|
User.uploadCroppedPicture = function (data, callback) {
|
||||||
var keepAllVersions = parseInt(meta.config['profile:keepAllUserImages'], 10) === 1;
|
|
||||||
var url;
|
var url;
|
||||||
var md5sum;
|
var image = {
|
||||||
|
name: 'profileAvatar',
|
||||||
|
uid: data.uid,
|
||||||
|
};
|
||||||
|
|
||||||
if (!data.imageData) {
|
if (!data.imageData) {
|
||||||
return callback(new Error('[[error:invalid-data]]'));
|
return callback(new Error('[[error:invalid-data]]'));
|
||||||
@@ -232,41 +203,69 @@ module.exports = function (User) {
|
|||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
var size = data.file ? data.file.size : data.imageData.length;
|
var size = data.imageData.length;
|
||||||
var uploadSize = parseInt(meta.config.maximumProfileImageSize, 10) || 256;
|
var uploadSize = parseInt(meta.config.maximumProfileImageSize, 10) || 256;
|
||||||
if (size > uploadSize * 1024) {
|
if (size > uploadSize * 1024) {
|
||||||
return next(new Error('[[error:file-too-big, ' + meta.config.maximumProfileImageSize + ']]'));
|
return next(new Error('[[error:file-too-big, ' + meta.config.maximumProfileImageSize + ']]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
md5sum = crypto.createHash('md5');
|
saveImageDataToTempFile(data.imageData, next);
|
||||||
md5sum.update(data.imageData);
|
},
|
||||||
md5sum = md5sum.digest('hex');
|
function (path, next) {
|
||||||
|
image.path = path;
|
||||||
|
|
||||||
data.file = {
|
uploadProfileOrCover('profileavatar', image, data.imageData, next);
|
||||||
path: path.join(os.tmpdir(), md5sum),
|
},
|
||||||
};
|
function (uploadData, next) {
|
||||||
|
url = uploadData.url;
|
||||||
var buffer = new Buffer(data.imageData.slice(data.imageData.indexOf('base64') + 7), 'base64');
|
User.setUserFields(data.uid, {
|
||||||
|
uploadedpicture: url,
|
||||||
fs.writeFile(data.file.path, buffer, {
|
picture: url,
|
||||||
encoding: 'base64',
|
|
||||||
}, next);
|
}, next);
|
||||||
},
|
},
|
||||||
function (next) {
|
], function (err) {
|
||||||
var image = {
|
deleteFile(image.path);
|
||||||
name: 'profileAvatar',
|
callback(err, {
|
||||||
path: data.file.path,
|
url: url,
|
||||||
uid: data.uid,
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (plugins.hasListeners('filter:uploadImage')) {
|
function saveImageDataToTempFile(imageData, callback) {
|
||||||
return plugins.fireHook('filter:uploadImage', { image: image, uid: data.uid }, next);
|
var filename = crypto.createHash('md5').update(imageData).digest('hex');
|
||||||
|
var filepath = path.join(os.tmpdir(), filename);
|
||||||
|
|
||||||
|
var buffer = new Buffer(imageData.slice(imageData.indexOf('base64') + 7), 'base64');
|
||||||
|
|
||||||
|
fs.writeFile(filepath, buffer, {
|
||||||
|
encoding: 'base64',
|
||||||
|
}, function (err) {
|
||||||
|
callback(err, filepath);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename = data.uid + '-profileavatar' + (keepAllVersions ? '-' + Date.now() : '');
|
function uploadProfileOrCover(type, image, imageData, callback) {
|
||||||
|
if (plugins.hasListeners('filter:uploadImage')) {
|
||||||
|
return plugins.fireHook('filter:uploadImage', {
|
||||||
|
image: image,
|
||||||
|
uid: image.uid,
|
||||||
|
}, callback);
|
||||||
|
}
|
||||||
|
var filename = generateProfileImageFilename(image.uid, type, imageData);
|
||||||
|
saveFileToLocal(filename, image, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateProfileImageFilename(uid, type, imageData) {
|
||||||
|
var extension = file.typeToExtension(imageData.slice(5, imageData.indexOf('base64') - 1));
|
||||||
|
var keepAllVersions = parseInt(meta.config['profile:keepAllUserImages'], 10) === 1;
|
||||||
|
var filename = uid + '-' + type + (keepAllVersions ? '-' + Date.now() : '') + (extension || '');
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveFileToLocal(filename, image, callback) {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (next) {
|
function (next) {
|
||||||
file.isFileTypeAllowed(data.file.path, next);
|
file.isFileTypeAllowed(image.path, next);
|
||||||
},
|
},
|
||||||
function (next) {
|
function (next) {
|
||||||
file.saveFileToLocal(filename, 'profile', image.path, next);
|
file.saveFileToLocal(filename, 'profile', image.path, next);
|
||||||
@@ -277,28 +276,18 @@ module.exports = function (User) {
|
|||||||
name: image.name,
|
name: image.name,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
], next);
|
], callback);
|
||||||
},
|
}
|
||||||
function (uploadData, next) {
|
|
||||||
url = uploadData.url;
|
function deleteFile(path) {
|
||||||
User.setUserFields(data.uid, { uploadedpicture: url, picture: url }, next);
|
if (path) {
|
||||||
},
|
fs.unlink(path, function (err) {
|
||||||
function (next) {
|
|
||||||
fs.unlink(data.file.path, function (err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
winston.error(err);
|
winston.error(err);
|
||||||
}
|
}
|
||||||
next();
|
|
||||||
});
|
});
|
||||||
},
|
|
||||||
], function (err) {
|
|
||||||
if (err) {
|
|
||||||
callback(err); // send back the original error
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
callback(err, { url: url });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
User.removeCoverPicture = function (data, callback) {
|
User.removeCoverPicture = function (data, callback) {
|
||||||
db.deleteObjectFields('user:' + data.uid, ['cover:url', 'cover:position'], callback);
|
db.deleteObjectFields('user:' + data.uid, ['cover:url', 'cover:position'], callback);
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
--reporter dot
|
--reporter dot
|
||||||
--timeout 15000
|
--timeout 25000
|
||||||
|
|||||||
27
test/user.js
27
test/user.js
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user