Merge remote-tracking branch 'refs/remotes/origin/master' into room-optimize

v1.18.x
barisusakli 9 years ago
commit be6fc72994

@ -49,8 +49,8 @@
"nodebb-plugin-spam-be-gone": "0.4.2",
"nodebb-rewards-essentials": "0.0.5",
"nodebb-theme-lavender": "2.0.13",
"nodebb-theme-persona": "4.0.20",
"nodebb-theme-vanilla": "5.0.5",
"nodebb-theme-persona": "4.0.21",
"nodebb-theme-vanilla": "5.0.6",
"nodebb-widget-essentials": "2.0.3",
"npm": "^2.1.4",
"passport": "^0.3.0",

@ -72,9 +72,11 @@
"posted_ago_by": "posted %1 by %2",
"posted_ago": "posted %1",
"posted_in_ago_by_guest": "posted in %1 %2 by Guest",
"posted_in_ago_by": "posted in %1 %2 by %3",
"posted_in": "posted in %1",
"posted_in_by": "posted in %1 by %2",
"posted_in_ago": "posted in %1 %2",
"posted_in_ago_by": "posted in %1 %2 by %3",
"posted_in_ago_by_guest": "posted in %1 %2 by Guest",
"replied_ago": "replied %1",
"user_posted_ago": "%1 posted %2",

@ -32,6 +32,7 @@
"signature": "Signature",
"birthday": "Birthday",
"chat": "Chat",
"chat_with": "Chat with %1",
"follow": "Follow",
"unfollow": "Unfollow",
"more": "More",

@ -213,7 +213,7 @@ define('admin/extend/plugins', function() {
Plugins.suggest = function(pluginId, callback) {
var nbbVersion = app.config.version.match(/^\d\.\d\.\d/);
$.ajax('https://packages.nodebb.org/api/v1/suggest', {
$.ajax((app.config.registry || 'https://packages.nodebb.org') + '/api/v1/suggest', {
type: 'GET',
data: {
package: pluginId,

@ -20,6 +20,22 @@ define('forum/account/header', [
if (parseInt(yourid, 10) === parseInt(theirid, 10)) {
setupCoverPhoto();
}
components.get('account/follow').on('click', function() {
toggleFollow('follow');
});
components.get('account/unfollow').on('click', function() {
toggleFollow('unfollow');
});
components.get('account/chat').on('click', function() {
app.openChat($('.account-username').html(), theirid);
});
components.get('account/ban').on('click', banAccount);
components.get('account/unban').on('click', unbanAccount);
components.get('account/delete').on('click', deleteAccount);
};
function hidePrivateLinks() {
@ -56,5 +72,65 @@ define('forum/account/header', [
);
}
function toggleFollow(type) {
socket.emit('user.' + type, {
uid: theirid
}, function(err) {
if (err) {
return app.alertError(err.message);
}
$('#follow-btn').toggleClass('hide', type === 'follow');
$('#unfollow-btn').toggleClass('hide', type === 'unfollow');
app.alertSuccess('[[global:alert.' + type + ', ' + $('.account-username').html() + ']]');
});
return false;
}
function banAccount() {
translator.translate('[[user:ban_account_confirm]]', function(translated) {
bootbox.confirm(translated, function(confirm) {
if (!confirm) {
return;
}
socket.emit('admin.user.banUsers', [ajaxify.data.theirid], function(err) {
if (err) {
return app.alertError(err.message);
}
$('#banAccountBtn').toggleClass('hide', true);
$('#banLabel, #unbanAccountBtn').toggleClass('hide', false);
});
});
});
}
function unbanAccount() {
socket.emit('admin.user.unbanUsers', [ajaxify.data.theirid], function(err) {
if (err) {
return app.alertError(err.message);
}
$('#banAccountBtn').toggleClass('hide', false);
$('#banLabel, #unbanAccountBtn').toggleClass('hide', true);
});
}
function deleteAccount() {
translator.translate('[[user:delete_this_account_confirm]]', function(translated) {
bootbox.confirm(translated, function(confirm) {
if (!confirm) {
return;
}
socket.emit('admin.user.deleteUsers', [ajaxify.data.theirid], function(err) {
if (err) {
return app.alertError(err.message);
}
app.alertSuccess('[[user:account-deleted]]');
history.back();
});
});
});
}
return AccountHeader;
});

@ -23,25 +23,8 @@ define('forum/account/profile', [
app.enterRoom('user/' + theirid);
processPage();
updateButtons();
$('#follow-btn').on('click', function() {
return toggleFollow('follow');
});
$('#unfollow-btn').on('click', function() {
return toggleFollow('unfollow');
});
$('#chat-btn').on('click', function() {
app.openChat($('.account-username').html(), theirid);
});
$('#banAccountBtn').on('click', banAccount);
$('#unbanAccountBtn').on('click', unbanAccount);
$('#deleteAccountBtn').on('click', deleteAccount);
socket.removeListener('event:user_status_change', onUserStatusChange);
socket.on('event:user_status_change', onUserStatusChange);
@ -59,21 +42,6 @@ define('forum/account/profile', [
$('#chat-btn').toggleClass('hide', isSelfOrNotLoggedIn);
}
function toggleFollow(type) {
socket.emit('user.' + type, {
uid: theirid
}, function(err) {
if (err) {
return app.alertError(err.message);
}
$('#follow-btn').toggleClass('hide', type === 'follow');
$('#unfollow-btn').toggleClass('hide', type === 'unfollow');
app.alertSuccess('[[global:alert.' + type + ', ' + $('.account-username').html() + ']]');
});
return false;
}
function onUserStatusChange(data) {
if (parseInt(ajaxify.data.theirid, 10) !== parseInt(data.uid, 10)) {
return;
@ -121,50 +89,5 @@ define('forum/account/profile', [
});
}
function banAccount() {
translator.translate('[[user:ban_account_confirm]]', function(translated) {
bootbox.confirm(translated, function(confirm) {
if (!confirm) {
return;
}
socket.emit('admin.user.banUsers', [ajaxify.data.theirid], function(err) {
if (err) {
return app.alertError(err.message);
}
$('#banAccountBtn').toggleClass('hide', true);
$('#banLabel, #unbanAccountBtn').toggleClass('hide', false);
});
});
});
}
function unbanAccount() {
socket.emit('admin.user.unbanUsers', [ajaxify.data.theirid], function(err) {
if (err) {
return app.alertError(err.message);
}
$('#banAccountBtn').toggleClass('hide', false);
$('#banLabel, #unbanAccountBtn').toggleClass('hide', true);
});
}
function deleteAccount() {
translator.translate('[[user:delete_this_account_confirm]]', function(translated) {
bootbox.confirm(translated, function(confirm) {
if (!confirm) {
return;
}
socket.emit('admin.user.deleteUsers', [ajaxify.data.theirid], function(err) {
if (err) {
return app.alertError(err.message);
}
app.alertSuccess('[[user:account-deleted]]');
history.back();
});
});
});
}
return Account;
});

@ -32,6 +32,7 @@ module.exports = function(Meta) {
db.getObject('config', function (err, config) {
config = config || {};
config.version = nconf.get('version');
config.registry = nconf.get('registry');
callback(err, config);
});
};

@ -65,6 +65,7 @@ module.exports = function(Posts) {
for (var i=0; i<posts.length; ++i) {
posts[i].index = utils.isNumber(results.indices[i]) ? parseInt(results.indices[i], 10) + 1 : 1;
posts[i].isMainPost = posts[i].index - 1 === 0;
}
posts = posts.filter(function(post) {

Loading…
Cancel
Save