mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
added about me field
This commit is contained in:
@@ -83,6 +83,10 @@
|
||||
"field": "maximumSignatureLength",
|
||||
"value": 255
|
||||
},
|
||||
{
|
||||
"field": "maximumAboutMeLength",
|
||||
"value": 1000
|
||||
},
|
||||
{
|
||||
"field": "maximumProfileImageSize",
|
||||
"value": 256
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
"uploads-are-disabled": "Uploads are disabled",
|
||||
|
||||
"signature-too-long" : "Sorry, your signature cannot be longer than %1 characters.",
|
||||
"about-me-too-long" : "Sorry, your about me cannot be longer than %1 characters.",
|
||||
|
||||
"cant-chat-with-yourself": "You can't chat with yourself!",
|
||||
"chat-restricted": "This user has restricted their chat messages. They must follow you before you can chat with them",
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"watched": "Watched",
|
||||
"followers": "Followers",
|
||||
"following": "Following",
|
||||
"aboutme": "About me",
|
||||
"signature": "Signature",
|
||||
"gravatar": "Gravatar",
|
||||
"birthday": "Birthday",
|
||||
|
||||
@@ -31,6 +31,7 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
handleEmailConfirm();
|
||||
handlePasswordChange();
|
||||
updateSignature();
|
||||
updateAboutMe();
|
||||
updateImages();
|
||||
};
|
||||
|
||||
@@ -43,7 +44,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
website: $('#inputWebsite').val(),
|
||||
birthday: $('#inputBirthday').val(),
|
||||
location: $('#inputLocation').val(),
|
||||
signature: $('#inputSignature').val()
|
||||
signature: $('#inputSignature').val(),
|
||||
aboutme: $('#inputAboutMe').val()
|
||||
};
|
||||
|
||||
socket.emit('user.updateProfile', userData, function(err, data) {
|
||||
@@ -337,15 +339,25 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
$('#uploaded-box .fa-check').toggle(currentPicture === uploadedPicture);
|
||||
}
|
||||
|
||||
function getCharsLeft(el, max) {
|
||||
return el.length ? '(' + el.val().length + '/' + max + ')' : '';
|
||||
}
|
||||
|
||||
function updateSignature() {
|
||||
function getSignatureCharsLeft() {
|
||||
return $('#inputSignature').length ? '(' + $('#inputSignature').val().length + '/' + config.maximumSignatureLength + ')' : '';
|
||||
}
|
||||
var el = $('#inputSignature');
|
||||
$('#signatureCharCountLeft').html(getCharsLeft(el, config.maximumSignatureLength));
|
||||
|
||||
$('#signatureCharCountLeft').html(getSignatureCharsLeft());
|
||||
el.on('keyup change', function() {
|
||||
$('#signatureCharCountLeft').html(getCharsLeft(el, config.maximumSignatureLength));
|
||||
});
|
||||
}
|
||||
|
||||
$('#inputSignature').on('keyup change', function(ev) {
|
||||
$('#signatureCharCountLeft').html(getSignatureCharsLeft());
|
||||
function updateAboutMe() {
|
||||
var el = $('#inputAboutMe');
|
||||
$('#aboutMeCharCountLeft').html(getCharsLeft(el, config.maximumAboutMeLength));
|
||||
|
||||
el.on('keyup change', function() {
|
||||
$('#aboutMeCharCountLeft').html(getCharsLeft(el, config.maximumAboutMeLength));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) {
|
||||
userData.fullname = validator.escape(userData.fullname);
|
||||
userData.location = validator.escape(userData.location);
|
||||
userData.signature = validator.escape(userData.signature);
|
||||
userData.aboutme = validator.escape(userData.aboutme || '');
|
||||
|
||||
callback(null, userData);
|
||||
});
|
||||
@@ -154,6 +155,13 @@ accountsController.getAccount = function(req, res, next) {
|
||||
},
|
||||
signature: function(next) {
|
||||
posts.parseSignature(userData, req.uid, next);
|
||||
},
|
||||
aboutme: function(next) {
|
||||
if (userData.aboutme) {
|
||||
plugins.fireHook('filter:parse.raw', userData.aboutme, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
}, function(err, results) {
|
||||
if(err) {
|
||||
@@ -163,7 +171,7 @@ accountsController.getAccount = function(req, res, next) {
|
||||
userData.posts = results.posts.posts.filter(function (p) {
|
||||
return p && parseInt(p.deleted, 10) !== 1;
|
||||
});
|
||||
|
||||
userData.aboutme = results.aboutme;
|
||||
userData.nextStart = results.posts.nextStart;
|
||||
userData.isFollowing = results.isFollowing;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.maximumUsernameLength = meta.config.maximumUsernameLength;
|
||||
config.minimumPasswordLength = meta.config.minimumPasswordLength;
|
||||
config.maximumSignatureLength = meta.config.maximumSignatureLength;
|
||||
config.maximumAboutMeLength = meta.config.maximumAboutMeLength;
|
||||
config.useOutgoingLinksPage = parseInt(meta.config.useOutgoingLinksPage, 10) === 1;
|
||||
config.allowGuestSearching = parseInt(meta.config.allowGuestSearching, 10) === 1;
|
||||
config.allowGuestHandles = parseInt(meta.config.allowGuestHandles, 10) === 1;
|
||||
|
||||
@@ -16,7 +16,7 @@ var async = require('async'),
|
||||
module.exports = function(User) {
|
||||
|
||||
User.updateProfile = function(uid, data, callback) {
|
||||
var fields = ['username', 'email', 'fullname', 'website', 'location', 'birthday', 'signature'];
|
||||
var fields = ['username', 'email', 'fullname', 'website', 'location', 'birthday', 'signature', 'aboutme'];
|
||||
|
||||
plugins.fireHook('filter:user.updateProfile', {uid: uid, data: data, fields: fields}, function(err, data) {
|
||||
if (err) {
|
||||
@@ -26,6 +26,14 @@ module.exports = function(User) {
|
||||
fields = data.fields;
|
||||
data = data.data;
|
||||
|
||||
function isAboutMeValid(next) {
|
||||
if (data.aboutme !== undefined && data.aboutme.length > meta.config.maximumAboutMeLength) {
|
||||
next(new Error('[[error:about-me-too-long, ' + meta.config.maximumAboutMeLength + ']]'));
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
function isSignatureValid(next) {
|
||||
if (data.signature !== undefined && data.signature.length > meta.config.maximumSignatureLength) {
|
||||
next(new Error('[[error:signature-too-long, ' + meta.config.maximumSignatureLength + ']]'));
|
||||
@@ -92,7 +100,7 @@ module.exports = function(User) {
|
||||
});
|
||||
}
|
||||
|
||||
async.series([isSignatureValid, isEmailAvailable, isUsernameAvailable], function(err, results) {
|
||||
async.series([isAboutMeValid, isSignatureValid, isEmailAvailable, isUsernameAvailable], function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
@@ -132,6 +132,10 @@
|
||||
<label>Minimum Password Length</label>
|
||||
<input type="text" class="form-control" value="6" data-field="minimumPasswordLength">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Maximum About Me Length</label>
|
||||
<input type="text" class="form-control" value="500" data-field="maximumAboutMeLength">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Forum Terms of Use <small>(Leave blank to disable)</small></label>
|
||||
<textarea class="form-control" data-field="termsOfUse"></textarea>
|
||||
|
||||
Reference in New Issue
Block a user