mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 16:30:34 +01:00
more error strings
This commit is contained in:
@@ -6,12 +6,16 @@
|
||||
"invalid-cid": "Invalid Category ID",
|
||||
"invalid-tid": "Invalid Topic ID",
|
||||
"invalid-pid": "Invalid Post ID",
|
||||
"invalid-uid": "Invalid User ID",
|
||||
|
||||
"no-category": "Category doesn't exist",
|
||||
"no-topic": "Topic doesn't exist",
|
||||
"no-post": "Post doesn't exist",
|
||||
"no-group": "Group doesn't exist",
|
||||
"no-privileges": "You don't have enough privileges for this action.",
|
||||
|
||||
"category-disabled": "Category disabled",
|
||||
|
||||
"topic-locked": "Topic Locked",
|
||||
|
||||
"still-uploading" : "Please wait for uploads to complete.",
|
||||
@@ -27,5 +31,9 @@
|
||||
|
||||
"cant-ban-other-admins": "You can't ban other admins!",
|
||||
|
||||
"invalid-image-type": "Invalid image type"
|
||||
"invalid-image-type": "Invalid image type",
|
||||
|
||||
"group-name-too-short": "Group name too short",
|
||||
"group-already-exists": "Group already exists",
|
||||
"group-name-change-not-allowed": "Group name change not allowed"
|
||||
}
|
||||
@@ -64,7 +64,7 @@ var db = require('./database'),
|
||||
Categories.getCategoryById = function(cid, start, end, uid, callback) {
|
||||
Categories.getCategoryData(cid, function(err, category) {
|
||||
if(err || !category) {
|
||||
return callback(err || new Error('category-not-found [' + cid + ']'));
|
||||
return callback(err || new Error('[[error:invalid-cid]]'));
|
||||
}
|
||||
|
||||
if(parseInt(uid, 10)) {
|
||||
@@ -278,7 +278,7 @@ var db = require('./database'),
|
||||
Categories.getCategories = function(cids, uid, callback) {
|
||||
|
||||
if (!Array.isArray(cids) || cids.length === 0) {
|
||||
return callback(new Error('invalid-cids'));
|
||||
return callback(new Error('[[error:invalid-cid]]'));
|
||||
}
|
||||
|
||||
async.parallel({
|
||||
|
||||
@@ -33,7 +33,7 @@ function userNotAllowed(res) {
|
||||
function getUserDataByUserSlug(userslug, callerUID, callback) {
|
||||
user.getUidByUserslug(userslug, function(err, uid) {
|
||||
if(err || !uid) {
|
||||
return callback(err || new Error('invalid-user'));
|
||||
return callback(err || new Error('[[error:invalid-uid]]'));
|
||||
}
|
||||
|
||||
async.parallel({
|
||||
@@ -54,7 +54,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) {
|
||||
}
|
||||
}, function(err, results) {
|
||||
if(err || !results.userData) {
|
||||
return callback(err || new Error('invalid-user'));
|
||||
return callback(err || new Error('[[error:invalid-uid]]'));
|
||||
}
|
||||
|
||||
var userData = results.userData;
|
||||
|
||||
@@ -70,7 +70,7 @@ categoriesController.get = function(req, res, next) {
|
||||
categoryTools.privileges(cid, uid, function(err, categoryPrivileges) {
|
||||
if (!err) {
|
||||
if (!categoryPrivileges.read) {
|
||||
next(new Error('not-enough-privileges'));
|
||||
next(new Error('[[error:no-privileges]]'));
|
||||
} else {
|
||||
next(null, categoryPrivileges);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ categoriesController.get = function(req, res, next) {
|
||||
|
||||
if (categoryData) {
|
||||
if (parseInt(categoryData.disabled, 10) === 1) {
|
||||
return next(new Error('Category disabled'), null);
|
||||
return next(new Error('[[error:category-disabled]]'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ topicsController.get = function(req, res, next) {
|
||||
}
|
||||
|
||||
if (!userPrivileges.read) {
|
||||
return next(new Error('not-enough-privileges'));
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
privileges = userPrivileges;
|
||||
@@ -45,7 +45,7 @@ topicsController.get = function(req, res, next) {
|
||||
topics.getTopicWithPosts(tid, uid, start, end, function (err, topicData) {
|
||||
if (topicData) {
|
||||
if (parseInt(topicData.deleted, 10) === 1 && parseInt(topicData.expose_tools, 10) === 0) {
|
||||
return next(new Error('Topic deleted'));
|
||||
return next(new Error('[[error:no-topic]]'));
|
||||
}
|
||||
topicData.currentPage = page;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
Groups.create = function(name, description, callback) {
|
||||
if (name.length === 0) {
|
||||
return callback(new Error('name-too-short'));
|
||||
return callback(new Error('[[error:group-name-too-short]]'));
|
||||
}
|
||||
|
||||
if (name === 'administrators' || name === 'registered-users') {
|
||||
@@ -145,7 +145,14 @@
|
||||
}
|
||||
|
||||
Groups.exists(name, function (err, exists) {
|
||||
if (!exists) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
return callback(new Error('[[error:group-already-exists]]'));
|
||||
}
|
||||
|
||||
var groupData = {
|
||||
name: name,
|
||||
description: description,
|
||||
@@ -164,9 +171,6 @@
|
||||
});
|
||||
}
|
||||
], callback);
|
||||
} else {
|
||||
callback(new Error('group-exists'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -184,12 +188,12 @@
|
||||
db.setObject('group:' + groupName, values, callback);
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(new Error('name-change-not-allowed'));
|
||||
callback(new Error('[[error:group-name-change-not-allowed]]'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (callback) {
|
||||
callback(new Error('gid-not-found'));
|
||||
callback(new Error('[[error:no-group]]'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user