mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
closes #6529
This commit is contained in:
@@ -75,9 +75,9 @@
|
||||
"nodebb-plugin-spam-be-gone": "0.5.3",
|
||||
"nodebb-rewards-essentials": "0.0.11",
|
||||
"nodebb-theme-lavender": "5.0.4",
|
||||
"nodebb-theme-persona": "9.0.7",
|
||||
"nodebb-theme-slick": "1.2.2",
|
||||
"nodebb-theme-vanilla": "10.0.7",
|
||||
"nodebb-theme-persona": "9.0.8",
|
||||
"nodebb-theme-slick": "1.2.3",
|
||||
"nodebb-theme-vanilla": "10.0.8",
|
||||
"nodebb-widget-essentials": "4.0.4",
|
||||
"nodemailer": "4.6.4",
|
||||
"passport": "^0.4.0",
|
||||
|
||||
@@ -8,5 +8,7 @@
|
||||
"min-rep-flag": "Minimum reputation to flag posts",
|
||||
"min-rep-website": "Minimum reputation to add \"Website\" to user profile",
|
||||
"min-rep-aboutme": "Minimum reputation to add \"About me\" to user profile",
|
||||
"min-rep-signature": "Minimum reputation to add \"Signature\" to user profile"
|
||||
"min-rep-signature": "Minimum reputation to add \"Signature\" to user profile",
|
||||
"min-rep-profile-picture": "Minimum repuration to add \"Profile Picture\" to user profile",
|
||||
"min-rep-cover-picture": "Minimum repuration to add \"Cover Picture\" to user profile"
|
||||
}
|
||||
@@ -152,6 +152,8 @@
|
||||
"not-enough-reputation-min-rep-website": "You do not have enough reputation to add a website",
|
||||
"not-enough-reputation-min-rep-aboutme": "You do not have enough reputation to add an about me",
|
||||
"not-enough-reputation-min-rep-signature": "You do not have enough reputation to add a signature",
|
||||
"not-enough-reputation-min-rep-profile-picture": "You do not have enough reputation to add a profile picture",
|
||||
"not-enough-reputation-min-rep-cover-picture": "You do not have enough reputation to add a cover picture",
|
||||
"already-flagged": "You have already flagged this post",
|
||||
"self-vote": "You cannot vote on your own post",
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ editController.get = function (req, res, callback) {
|
||||
userData.maximumSignatureLength = parseInt(meta.config.maximumSignatureLength, 10) || 255;
|
||||
userData.maximumAboutMeLength = parseInt(meta.config.maximumAboutMeLength, 10) || 1000;
|
||||
userData.maximumProfileImageSize = parseInt(meta.config.maximumProfileImageSize, 10);
|
||||
userData.allowProfilePicture = !userData.isSelf || parseInt(userData.reputation, 10) >= (parseInt(meta.config['min:rep:profile-picture'], 10) || 0);
|
||||
userData.allowCoverPicture = !userData.isSelf || parseInt(userData.reputation, 10) >= (parseInt(meta.config['min:rep:cover-picture'], 10) || 0);
|
||||
userData.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads, 10) === 1;
|
||||
userData.allowMultipleBadges = parseInt(meta.config.allowMultipleBadges, 10) === 1;
|
||||
userData.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;
|
||||
@@ -163,7 +165,9 @@ editController.uploadPicture = function (req, res, next) {
|
||||
if (!isAllowed) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
user.checkMinReputation(req.uid, updateUid, 'min:rep:profile-picture', next);
|
||||
},
|
||||
function (next) {
|
||||
user.uploadCroppedPicture({
|
||||
uid: updateUid,
|
||||
file: userPhoto,
|
||||
@@ -186,15 +190,21 @@ editController.uploadCoverPicture = function (req, res, next) {
|
||||
var params = JSON.parse(req.body.params);
|
||||
var coverPhoto = req.files.files[0];
|
||||
|
||||
user.updateCoverPicture({
|
||||
file: coverPhoto,
|
||||
uid: params.uid,
|
||||
}, function (err, image) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
user.checkMinReputation(req.uid, params.uid, 'min:rep:cover-picture', next);
|
||||
},
|
||||
function (next) {
|
||||
user.updateCoverPicture({
|
||||
file: coverPhoto,
|
||||
uid: params.uid,
|
||||
}, next);
|
||||
},
|
||||
], function (err, image) {
|
||||
file.delete(coverPhoto.path);
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.json([{
|
||||
url: image.url,
|
||||
}]);
|
||||
|
||||
@@ -80,6 +80,7 @@ profileController.get = function (req, res, callback) {
|
||||
userData.nextStart = results.posts.nextStart;
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([{ text: userData.username }]);
|
||||
userData.title = userData.username;
|
||||
userData.allowCoverPicture = !userData.isSelf || parseInt(userData.reputation, 10) >= (parseInt(meta.config['min:rep:cover-picture'], 10) || 0);
|
||||
var pageCount = Math.ceil(userData.postcount / itemsPerPage);
|
||||
userData.pagination = pagination.create(page, pageCount, req.query);
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ module.exports = function (SocketUser) {
|
||||
function (next) {
|
||||
user.isAdminOrGlobalModOrSelf(socket.uid, data.uid, next);
|
||||
},
|
||||
function (next) {
|
||||
user.checkMinReputation(socket.uid, data.uid, 'min:rep:cover-picture', next);
|
||||
},
|
||||
function (next) {
|
||||
user.updateCoverPicture(data, next);
|
||||
},
|
||||
@@ -45,6 +48,9 @@ module.exports = function (SocketUser) {
|
||||
function (next) {
|
||||
user.isAdminOrGlobalModOrSelf(socket.uid, data.uid, next);
|
||||
},
|
||||
function (next) {
|
||||
user.checkMinReputation(socket.uid, data.uid, 'min:rep:profile-picture', next);
|
||||
},
|
||||
function (next) {
|
||||
user.uploadCroppedPicture(data, next);
|
||||
},
|
||||
@@ -204,15 +210,14 @@ module.exports = function (SocketUser) {
|
||||
SocketUser.toggleBlock = function (socket, data, callback) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
user.blocks.can(data.uid, function (err, can) {
|
||||
if (err || !can) {
|
||||
return next(err || new Error('[[error:cannot-block-privileged]]'));
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
user.blocks.can(data.uid, next);
|
||||
},
|
||||
function (can, next) {
|
||||
if (!can) {
|
||||
return next(new Error('[[error:cannot-block-privileged]]'));
|
||||
}
|
||||
user.blocks.is(data.uid, socket.uid, next);
|
||||
},
|
||||
async.apply(user.blocks.is, data.uid, socket.uid),
|
||||
function (is, next) {
|
||||
user.blocks[is ? 'remove' : 'add'](data.uid, socket.uid, next);
|
||||
},
|
||||
|
||||
@@ -144,7 +144,7 @@ module.exports = function (User) {
|
||||
if (!data.website) {
|
||||
return setImmediate(callback);
|
||||
}
|
||||
checkMinReputation(callerUid, data.uid, 'min:rep:website', callback);
|
||||
User.checkMinReputation(callerUid, data.uid, 'min:rep:website', callback);
|
||||
}
|
||||
|
||||
function isAboutMeValid(callerUid, data, callback) {
|
||||
@@ -155,7 +155,7 @@ module.exports = function (User) {
|
||||
return callback(new Error('[[error:about-me-too-long, ' + meta.config.maximumAboutMeLength + ']]'));
|
||||
}
|
||||
|
||||
checkMinReputation(callerUid, data.uid, 'min:rep:aboutme', callback);
|
||||
User.checkMinReputation(callerUid, data.uid, 'min:rep:aboutme', callback);
|
||||
}
|
||||
|
||||
function isSignatureValid(callerUid, data, callback) {
|
||||
@@ -165,10 +165,10 @@ module.exports = function (User) {
|
||||
if (data.signature !== undefined && data.signature.length > meta.config.maximumSignatureLength) {
|
||||
return callback(new Error('[[error:signature-too-long, ' + meta.config.maximumSignatureLength + ']]'));
|
||||
}
|
||||
checkMinReputation(callerUid, data.uid, 'min:rep:signature', callback);
|
||||
User.checkMinReputation(callerUid, data.uid, 'min:rep:signature', callback);
|
||||
}
|
||||
|
||||
function checkMinReputation(callerUid, uid, setting, callback) {
|
||||
User.checkMinReputation = function (callerUid, uid, setting, callback) {
|
||||
var isSelf = parseInt(callerUid, 10) === parseInt(uid, 10);
|
||||
if (!isSelf) {
|
||||
return setImmediate(callback);
|
||||
@@ -184,7 +184,7 @@ module.exports = function (User) {
|
||||
next();
|
||||
},
|
||||
], callback);
|
||||
}
|
||||
};
|
||||
|
||||
function updateEmail(uid, newEmail, callback) {
|
||||
async.waterfall([
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
<strong>[[admin/settings/reputation:min-rep-website]]</strong><br /> <input type="text" class="form-control" placeholder="0" data-field="min:rep:website"><br />
|
||||
<strong>[[admin/settings/reputation:min-rep-aboutme]]</strong><br /> <input type="text" class="form-control" placeholder="0" data-field="min:rep:aboutme"><br />
|
||||
<strong>[[admin/settings/reputation:min-rep-signature]]</strong><br /> <input type="text" class="form-control" placeholder="0" data-field="min:rep:signature"><br />
|
||||
<strong>[[admin/settings/reputation:min-rep-profile-picture]]</strong><br /> <input type="text" class="form-control" placeholder="0" data-field="min:rep:profile-picture"><br />
|
||||
<strong>[[admin/settings/reputation:min-rep-cover-picture]]</strong><br /> <input type="text" class="form-control" placeholder="0" data-field="min:rep:cover-picture"><br />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user