From fdeaf3a16e91f5e0efe3f7a6606dbe0cec373557 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 9 Apr 2014 21:44:00 -0400 Subject: [PATCH] user.js error keys --- public/language/en_GB/error.json | 4 +++- src/socket.io/user.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/public/language/en_GB/error.json b/public/language/en_GB/error.json index 9ecc3a4ba1..d0fd0f31e0 100644 --- a/public/language/en_GB/error.json +++ b/public/language/en_GB/error.json @@ -25,5 +25,7 @@ "already-favourited": "You already favourited this post", "already-unfavourited": "You alread unfavourited this post", - "cant-ban-other-admins": "You can't ban other admins!" + "cant-ban-other-admins": "You can't ban other admins!", + + "invalid-image-type": "Invalid image type" } \ No newline at end of file diff --git a/src/socket.io/user.js b/src/socket.io/user.js index 4dee39f4be..ce78fe9976 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -60,7 +60,7 @@ SocketUser.changePassword = function(socket, data, callback) { SocketUser.updateProfile = function(socket, data, callback) { if(!data || !data.uid) { - return callback(new Error('invalid-data')); + return callback(new Error('[[error:invalid-data]]')); } if(socket.uid === parseInt(data.uid, 10)) { @@ -73,7 +73,7 @@ SocketUser.updateProfile = function(socket, data, callback) { } if(!isAdmin) { - return callback(new Error('not allowed!')); + return callback(new Error('[[error:no-privileges]]')); } user.updateProfile(data.uid, data, callback); @@ -82,7 +82,7 @@ SocketUser.updateProfile = function(socket, data, callback) { SocketUser.changePicture = function(socket, data, callback) { if(!data) { - return callback(new Error('invalid-data')); + return callback(new Error('[[error:invalid-data]]')); } var type = data.type; @@ -117,7 +117,7 @@ SocketUser.changePicture = function(socket, data, callback) { } else if (type === 'uploaded') { type = 'uploadedpicture'; } else { - return callback(new Error('invalid-image-type')); + return callback(new Error('[[error:invalid-image-type]]')); } if(socket.uid === parseInt(data.uid, 10)) { @@ -136,7 +136,7 @@ SocketUser.changePicture = function(socket, data, callback) { } if(!isAdmin) { - return callback(new Error('not-allowed')); + return callback(new Error('[[error:no-privileges]]')); } changePicture(data.uid, callback); @@ -170,7 +170,7 @@ SocketUser.saveSettings = function(socket, data, callback) { SocketUser.getOnlineUsers = function(socket, data, callback) { var returnData = {}; if(!data) { - return callback(new Error('invalid-data')); + return callback(new Error('[[error:invalid-data]]')); } function getUserStatus(uid, next) { @@ -202,11 +202,11 @@ SocketUser.getActiveUsers = function(socket, data, callback) { SocketUser.loadMore = function(socket, data, callback) { if(!data || !data.set || parseInt(data.after, 10) < 0) { - return callback(new Error('invalid-data')); + return callback(new Error('[[error:invalid-data]]')); } if (!socket.uid && !!parseInt(meta.config.privateUserInfo, 10)) { - return callback(new Error('not-allowed')); + return callback(new Error('[[error:no-privileges]]')); } var start = data.after,