Merge remote-tracking branch 'origin/master' into develop

v1.18.x
Julian Lam 8 years ago
commit b649eb95f8

@ -8,7 +8,7 @@
"clear-error-log": "Limpar Log de Erros", "clear-error-log": "Limpar Log de Erros",
"route": "Rota", "route": "Rota",
"count": "Contagem", "count": "Contagem",
"no-routes-not-found": "Hooray! No 404 errors!", "no-routes-not-found": "Ihuul! Sem erros 404!",
"clear404-confirm": "Você tem certeza que deseja limpar todos os logs de erro 404?", "clear404-confirm": "Você tem certeza que deseja limpar todos os logs de erro 404?",
"clear404-success": "Erros de \"404 Não Encontrada\" apagados" "clear404-success": "Erros de \"404 Não Encontrada\" apagados"
} }

@ -2,9 +2,9 @@
"forum-traffic": "Tráfego do Forum", "forum-traffic": "Tráfego do Forum",
"page-views": "Visualizações de Página", "page-views": "Visualizações de Página",
"unique-visitors": "Visitantes Únicos", "unique-visitors": "Visitantes Únicos",
"users": "Users", "users": "Usuários",
"posts": "Posts", "posts": "Posts",
"topics": "Topics", "topics": "Tópicos",
"page-views-last-month": "Visualizações de página no Último Mês", "page-views-last-month": "Visualizações de página no Último Mês",
"page-views-this-month": "Visualizações de Página Este Mês", "page-views-this-month": "Visualizações de Página Este Mês",
"page-views-last-day": "Visualizações de página nas últimas 24 horas", "page-views-last-day": "Visualizações de página nas últimas 24 horas",
@ -23,11 +23,11 @@
"prerelease-warning": "<p>Esta é uma versão <strong>pre-release</strong> do NodeBB. Bugs inesperados podem ocorrer. <i class=\"fa fa-exclamation-triangle\"></i></p>", "prerelease-warning": "<p>Esta é uma versão <strong>pre-release</strong> do NodeBB. Bugs inesperados podem ocorrer. <i class=\"fa fa-exclamation-triangle\"></i></p>",
"notices": "Avisos", "notices": "Avisos",
"restart-not-required": "Restart not required", "restart-not-required": "Reiniciar não é necessário",
"restart-required": "Restart required", "restart-required": "É necessário reiniciar",
"search-plugin-installed": "Search Plugin installed", "search-plugin-installed": "Plugin de Pesquisa instalado",
"search-plugin-not-installed": "Search Plugin not installed", "search-plugin-not-installed": "Plugin de Pesquisa não instalado",
"search-plugin-tooltip": "Install a search plugin from the plugin page in order to activate search functionality", "search-plugin-tooltip": "Instale um plugin de pesquisa da página de plugins de modo à ativar a funcionalidade de pesquisa",
"control-panel": "Controle do Sistema", "control-panel": "Controle do Sistema",
"reload": "Recarregar", "reload": "Recarregar",

@ -27,5 +27,5 @@
"touch-icon.help": "Tamanho e formato recomendados: 192x192, apenas formato PNG. Se nenhum ícone de touch screen for especificado, o NodeBB usará o seu favicon, ao invés dele.", "touch-icon.help": "Tamanho e formato recomendados: 192x192, apenas formato PNG. Se nenhum ícone de touch screen for especificado, o NodeBB usará o seu favicon, ao invés dele.",
"outgoing-links": "Links Externos", "outgoing-links": "Links Externos",
"outgoing-links.warning-page": "Utilizar Página de Aviso de Links Externos", "outgoing-links.warning-page": "Utilizar Página de Aviso de Links Externos",
"search-default-sort-by": "Search default sort by" "search-default-sort-by": "Padrão de ordenação de pesquisa por"
} }

@ -9,7 +9,7 @@
"allow-topic-thumbnails": "Permitir usuários de enviar miniaturas de tópico", "allow-topic-thumbnails": "Permitir usuários de enviar miniaturas de tópico",
"topic-thumb-size": "Tamanho da Miniatura de Tópico", "topic-thumb-size": "Tamanho da Miniatura de Tópico",
"allowed-file-extensions": "Extensões de Arquivo Permitidas", "allowed-file-extensions": "Extensões de Arquivo Permitidas",
"allowed-file-extensions-help": "Enter comma-separated list of file extensions here (e.g. <code>pdf,xls,doc</code>). An empty list means all extensions are allowed.", "allowed-file-extensions-help": "Digite uma lista separada por vírguls fr extensões de arquivos aqui (ex. <code>pdf,xls,doc</code>). Uma lista vazia significa que todas as extensões são permitidas.",
"profile-avatars": "Avatares de Perfil", "profile-avatars": "Avatares de Perfil",
"allow-profile-image-uploads": "Permitir usuários de enviar imagens de perfil", "allow-profile-image-uploads": "Permitir usuários de enviar imagens de perfil",
"convert-profile-image-png": "Converter imagens de perfil enviadas para PNG", "convert-profile-image-png": "Converter imagens de perfil enviadas para PNG",

@ -19,9 +19,9 @@
"user_flagged_post_in": "<strong>%1</strong> sinalizou um post em <strong>%2</strong>", "user_flagged_post_in": "<strong>%1</strong> sinalizou um post em <strong>%2</strong>",
"user_flagged_post_in_dual": "<strong>%1</strong> e <strong>%2</strong> sinalizaram um post em <strong>%3</strong>", "user_flagged_post_in_dual": "<strong>%1</strong> e <strong>%2</strong> sinalizaram um post em <strong>%3</strong>",
"user_flagged_post_in_multiple": "<strong>%1</strong> e %2 outros sinalizaram um post em <strong>%3</strong>", "user_flagged_post_in_multiple": "<strong>%1</strong> e %2 outros sinalizaram um post em <strong>%3</strong>",
"user_flagged_user": "<strong>%1</strong> flagged a user profile (%2)", "user_flagged_user": "<strong>%1</strong> sinalizou um perfil de usuário (%2)",
"user_flagged_user_dual": "<strong>%1</strong> and <strong>%2</strong> flagged a user profile (%3)", "user_flagged_user_dual": "<strong>%1</strong> e <strong>%2</strong> sinalizaram um perfil de usuário (%3)",
"user_flagged_user_multiple": "<strong>%1</strong> and %2 others flagged a user profile (%3)", "user_flagged_user_multiple": "<strong>%1</strong> e %2 outros sinalizaram um perfil de usuário (%3)",
"user_posted_to": "<strong>%1</strong> postou uma resposta para: <strong>%2</strong>", "user_posted_to": "<strong>%1</strong> postou uma resposta para: <strong>%2</strong>",
"user_posted_to_dual": "<strong>%1</strong> e <strong>%2</strong> postaram respostas para: <strong>%3</strong>", "user_posted_to_dual": "<strong>%1</strong> e <strong>%2</strong> postaram respostas para: <strong>%3</strong>",
"user_posted_to_multiple": "<strong>%1</strong> e %2 outros postaram respostas para: <strong>%3</strong>", "user_posted_to_multiple": "<strong>%1</strong> e %2 outros postaram respostas para: <strong>%3</strong>",

@ -6,7 +6,7 @@
"popular-month": "Tópicos populares deste mês", "popular-month": "Tópicos populares deste mês",
"popular-alltime": "Tópicos populares de todos os tempos", "popular-alltime": "Tópicos populares de todos os tempos",
"recent": "Tópicos Recentes", "recent": "Tópicos Recentes",
"flagged-content": "Flagged Content", "flagged-content": "Conteúdo Sinalizado",
"ip-blacklist": "Lista negra de IPs", "ip-blacklist": "Lista negra de IPs",
"users/online": "Usuários Online", "users/online": "Usuários Online",
"users/latest": "Últimos Usuários", "users/latest": "Últimos Usuários",
@ -27,8 +27,8 @@
"group": "%1 grupo", "group": "%1 grupo",
"chats": "Chats", "chats": "Chats",
"chat": "Conversando com %1", "chat": "Conversando com %1",
"flags": "Flags", "flags": "Sinalizações",
"flag-details": "Flag %1 Details", "flag-details": "Detalhes da Sinalização %1",
"account/edit": "Editando \"%1\"", "account/edit": "Editando \"%1\"",
"account/edit/password": "Editando senha de \"%1\"", "account/edit/password": "Editando senha de \"%1\"",
"account/edit/username": "Editando nome de usuário de \"%1\"", "account/edit/username": "Editando nome de usuário de \"%1\"",

@ -12,7 +12,7 @@
"reply-count": "Contagem de Respostas", "reply-count": "Contagem de Respostas",
"at-least": "No mínimo", "at-least": "No mínimo",
"at-most": "No máximo", "at-most": "No máximo",
"relevance": "Relevance", "relevance": "Relevância",
"post-time": "Data da postagem", "post-time": "Data da postagem",
"newer-than": "Mais novo que", "newer-than": "Mais novo que",
"older-than": "Mais antigo que", "older-than": "Mais antigo que",

@ -13,8 +13,8 @@
"notify_me": "Seja notificado de novas respostas nesse tópico", "notify_me": "Seja notificado de novas respostas nesse tópico",
"quote": "Citar", "quote": "Citar",
"reply": "Responder", "reply": "Responder",
"replies_to_this_post": "%1 Replies", "replies_to_this_post": "%1 Respostas",
"last_reply_time": "Last reply", "last_reply_time": "Última resposta",
"reply-as-topic": "Responder como tópico", "reply-as-topic": "Responder como tópico",
"guest-login-reply": "Entre para responder", "guest-login-reply": "Entre para responder",
"edit": "Editar", "edit": "Editar",

@ -33,7 +33,7 @@
"chat": "Chat", "chat": "Chat",
"chat_with": "Continuar a conversa com %1", "chat_with": "Continuar a conversa com %1",
"new_chat_with": "Iniciar uma nova conversa com %1", "new_chat_with": "Iniciar uma nova conversa com %1",
"flag-profile": "Flag Profile", "flag-profile": "Perfil da Sinalização",
"follow": "Seguir", "follow": "Seguir",
"unfollow": "Deixar de Seguir", "unfollow": "Deixar de Seguir",
"more": "Mais", "more": "Mais",
@ -65,8 +65,8 @@
"remove_uploaded_picture": "Remover Foto Enviada", "remove_uploaded_picture": "Remover Foto Enviada",
"upload_cover_picture": "Fazer upload de imagem de capa ", "upload_cover_picture": "Fazer upload de imagem de capa ",
"remove_cover_picture_confirm": "Tem certeza que deseja remover a imagem de capa?", "remove_cover_picture_confirm": "Tem certeza que deseja remover a imagem de capa?",
"crop_picture": "Crop picture", "crop_picture": "Cortar imagem",
"upload_cropped_picture": "Crop and upload", "upload_cropped_picture": "Cortar e enviar",
"settings": "Configurações", "settings": "Configurações",
"show_email": "Mostrar Meu Email", "show_email": "Mostrar Meu Email",
"show_fullname": "Mostrar Meu Nome Completo", "show_fullname": "Mostrar Meu Nome Completo",

@ -97,7 +97,8 @@ define('forum/topic/images', [
Images.wrapImagesInLinks = function (posts) { Images.wrapImagesInLinks = function (posts) {
posts.find('[component="post/content"] img:not(.emoji)').each(function () { posts.find('[component="post/content"] img:not(.emoji)').each(function () {
var $this = $(this); var $this = $(this);
var src = $this.attr('src'); var src = $this.attr('src') || '';
var alt = $this.attr('alt') || '';
var suffixRegex = /-resized(\.[\w]+)?$/; var suffixRegex = /-resized(\.[\w]+)?$/;
if (src === 'about:blank') { if (src === 'about:blank') {
@ -107,9 +108,14 @@ define('forum/topic/images', [
if (utils.isRelativeUrl(src) && suffixRegex.test(src)) { if (utils.isRelativeUrl(src) && suffixRegex.test(src)) {
src = src.replace(suffixRegex, '$1'); src = src.replace(suffixRegex, '$1');
} }
var srcExt = src.split('.').slice(1).pop();
var altFilename = alt.split('/').pop();
var altExt = altFilename.split('.').slice(1).pop();
if (!$this.parent().is('a')) { if (!$this.parent().is('a')) {
$this.wrap('<a href="' + src + '" target="_blank">'); $this.wrap('<a href="' + src + '" '
+ (!srcExt && altExt ? ' download="' + altFilename + '" ' : '')
+ ' target="_blank" >');
} }
}); });
}; };

@ -73,9 +73,9 @@ apiController.getConfig = function (req, res, next) {
config.cookies = { config.cookies = {
enabled: parseInt(meta.config.cookieConsentEnabled, 10) === 1, enabled: parseInt(meta.config.cookieConsentEnabled, 10) === 1,
message: translator.escape(meta.config.cookieConsentMessage || '[[global:cookies.message]]').replace(/\\/g, '\\\\'), message: translator.escape(validator.escape(meta.config.cookieConsentMessage) || '[[global:cookies.message]]').replace(/\\/g, '\\\\'),
dismiss: translator.escape(meta.config.cookieConsentDismiss || '[[global:cookies.accept]]').replace(/\\/g, '\\\\'), dismiss: translator.escape(validator.escape(meta.config.cookieConsentDismiss) || '[[global:cookies.accept]]').replace(/\\/g, '\\\\'),
link: translator.escape(meta.config.cookieConsentLink || '[[global:cookies.learn_more]]').replace(/\\/g, '\\\\'), link: translator.escape(validator.escape(meta.config.cookieConsentLink) || '[[global:cookies.learn_more]]').replace(/\\/g, '\\\\'),
}; };
async.waterfall([ async.waterfall([

@ -46,7 +46,7 @@ module.exports = function (User) {
async.parallel({ async.parallel({
renamedUsername: function (next) { renamedUsername: function (next) {
renameUsername(userData, next); User.uniqueUsername(userData, next);
}, },
userData: function (next) { userData: function (next) {
plugins.fireHook('filter:user.create', { user: userData, data: data }, next); plugins.fireHook('filter:user.create', { user: userData, data: data }, next);
@ -200,28 +200,28 @@ module.exports = function (User) {
callback(); callback();
}; };
function renameUsername(userData, callback) { User.uniqueUsername = function (userData, callback) {
meta.userOrGroupExists(userData.userslug, function (err, exists) { meta.userOrGroupExists(userData.userslug, function (err, exists) {
if (err || !exists) { if (err || !exists) {
return callback(err); return callback(err);
} }
var newUsername = ''; var num = 0;
async.forever(function (next) {
newUsername = userData.username + (Math.floor(Math.random() * 255) + 1); function go() {
User.existsBySlug(newUsername, function (err, exists) { var username = userData.username + ' ' + num.toString(32);
if (err) { var userslug = utils.slugify(username);
return callback(err); meta.userOrGroupExists(userslug, function (err, exists) {
} if (err || !exists) {
if (!exists) { return callback(err, username);
next(newUsername);
} else {
next();
} }
num += 1;
go();
}); });
}, function (username) { }
callback(null, username);
}); go();
}); });
} };
}; };

@ -70,6 +70,38 @@ describe('User', function () {
}); });
}); });
describe('.uniqueUsername()', function () {
it('should deal with collisions', function (done) {
var users = [];
for (var i = 0; i < 10; i += 1) {
users.push({
username: 'Jane Doe',
password: 'abcdefghi',
email: 'jane.doe' + i + '@example.com',
});
}
async.series([
function (next) {
async.eachSeries(users, function (user, next) {
User.create(user, next);
}, next);
},
function (next) {
User.uniqueUsername({
username: 'Jane Doe',
userslug: 'jane-doe',
}, function (err, username) {
assert.ifError(err);
assert.strictEqual(username, 'Jane Doe 9');
done();
});
},
], done);
});
});
describe('.isModerator()', function () { describe('.isModerator()', function () {
it('should return false', function (done) { it('should return false', function (done) {
User.isModerator(testUid, testCid, function (err, isModerator) { User.isModerator(testUid, testCid, function (err, isModerator) {

Loading…
Cancel
Save