mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-05 23:57:29 +02:00
Merge remote-tracking branch 'origin'
This commit is contained in:
@@ -3,13 +3,14 @@
|
||||
**NodeBB** is a robust Node.js driven forum built on a redis database. It is powered by web sockets, and is compatible down to IE8.
|
||||
|
||||
* [NodeBB Homepage](http://www.nodebb.org/ "NodeBB")
|
||||
* [Demo & Meta Discussion](http://try.nodebb.org)
|
||||
* [Join us on IRC](https://kiwiirc.com/client/irc.freenode.net/nodebb) - #nodebb on Freenode
|
||||
* [Follow on Twitter](http://www.twitter.com/NodeBB/ "NodeBB Twitter")
|
||||
* [Like us on Facebook](http://www.facebook.com/NodeBB/ "NodeBB Facebook")
|
||||
* [Join us on IRC](https://kiwiirc.com/client/irc.freenode.net/nodebb) - #nodebb on Freenode
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
## How can I follow along/contribute?
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "nodebb",
|
||||
"license": "GPLv3 or later",
|
||||
"description": "NodeBB Forum",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.7",
|
||||
"homepage": "http://www.nodebb.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -42,7 +42,7 @@
|
||||
"validator": "~1.5.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"hiredis" : "~0.1.15"
|
||||
"hiredis": "~0.1.15"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/designcreateplay/NodeBB/issues"
|
||||
|
||||
@@ -18,33 +18,10 @@
|
||||
}
|
||||
|
||||
function updateUserButtons() {
|
||||
|
||||
jQuery('.admin-btn').each(function(index, element) {
|
||||
var adminBtn = $(element);
|
||||
var uid = getUID(adminBtn);
|
||||
|
||||
if (isUserAdmin(adminBtn))
|
||||
adminBtn.addClass('btn-success');
|
||||
else
|
||||
adminBtn.removeClass('btn-success');
|
||||
|
||||
if (uid === yourid)
|
||||
adminBtn.addClass('disabled');
|
||||
});
|
||||
|
||||
jQuery('.delete-btn').each(function(index, element) {
|
||||
var deleteBtn = $(element);
|
||||
|
||||
if (isUserAdmin(deleteBtn))
|
||||
deleteBtn.addClass('disabled');
|
||||
else
|
||||
deleteBtn.show();
|
||||
});
|
||||
|
||||
jQuery('.ban-btn').each(function(index, element) {
|
||||
var banBtn = $(element);
|
||||
|
||||
if (isUserAdmin(banBtn))
|
||||
var uid = getUID(banBtn);
|
||||
if (isUserAdmin(banBtn) || uid === yourid)
|
||||
banBtn.addClass('disabled');
|
||||
else if (isUserBanned(banBtn))
|
||||
banBtn.addClass('btn-warning');
|
||||
@@ -58,31 +35,6 @@
|
||||
|
||||
updateUserButtons();
|
||||
|
||||
$('#users-container').on('click', '.admin-btn', function() {
|
||||
var adminBtn = $(this);
|
||||
var isAdmin = isUserAdmin(adminBtn);
|
||||
var parent = adminBtn.parents('.users-box');
|
||||
var uid = getUID(adminBtn);
|
||||
|
||||
if (isAdmin && uid != yourid) {
|
||||
socket.emit('api:admin.user.removeAdmin', uid);
|
||||
adminBtn.removeClass('btn-success');
|
||||
parent.find('.delete-btn').removeClass('disabled');
|
||||
parent.attr('data-admin', 0);
|
||||
} else if (uid != yourid) {
|
||||
bootbox.confirm('Do you really want to make "' + parent.attr('data-username') + '" an admin?', function(confirm) {
|
||||
if (confirm) {
|
||||
socket.emit('api:admin.user.makeAdmin', uid);
|
||||
adminBtn.addClass('btn-success');
|
||||
parent.find('.delete-btn').addClass('disabled');
|
||||
parent.attr('data-admin', 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#users-container').on('click', '.ban-btn', function() {
|
||||
var banBtn = $(this);
|
||||
var isAdmin = isUserAdmin(banBtn);
|
||||
|
||||
@@ -124,47 +124,40 @@
|
||||
|
||||
var template_data = null;
|
||||
|
||||
(function () {
|
||||
var timestamp = new Date().getTime(); //debug
|
||||
var timestamp = new Date().getTime(); //debug
|
||||
|
||||
if (!templates[tpl_url]) {
|
||||
jQuery.get(RELATIVE_PATH + '/templates/' + tpl_url + '.tpl?v=' + timestamp, function (html) {
|
||||
var template = function () {
|
||||
this.toString = function () {
|
||||
return this.html;
|
||||
};
|
||||
}
|
||||
|
||||
template.prototype.parse = parse;
|
||||
template.prototype.html = String(html);
|
||||
template.prototype.blocks = {};
|
||||
|
||||
templates[tpl_url] = new template;
|
||||
|
||||
parse_template();
|
||||
});
|
||||
} else {
|
||||
parse_template();
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
(function () {
|
||||
jQuery.get(RELATIVE_PATH + '/api/' + api_url, function (data) {
|
||||
|
||||
if (!data) {
|
||||
ajaxify.go('404');
|
||||
return;
|
||||
if (!templates[tpl_url]) {
|
||||
jQuery.get(RELATIVE_PATH + '/templates/' + tpl_url + '.tpl?v=' + timestamp, function (html) {
|
||||
var template = function () {
|
||||
this.toString = function () {
|
||||
return this.html;
|
||||
};
|
||||
}
|
||||
|
||||
template_data = data;
|
||||
parse_template();
|
||||
}).fail(function (data) {
|
||||
template_data = {};
|
||||
template.prototype.parse = parse;
|
||||
template.prototype.html = String(html);
|
||||
template.prototype.blocks = {};
|
||||
|
||||
templates[tpl_url] = new template;
|
||||
|
||||
parse_template();
|
||||
});
|
||||
}());
|
||||
} else {
|
||||
parse_template();
|
||||
}
|
||||
|
||||
jQuery.get(RELATIVE_PATH + '/api/' + api_url, function (data) {
|
||||
|
||||
if (!data) {
|
||||
ajaxify.go('404');
|
||||
return;
|
||||
}
|
||||
|
||||
template_data = data;
|
||||
parse_template();
|
||||
}).fail(function (data) {
|
||||
app.alertError("Can't load template data!");
|
||||
});
|
||||
|
||||
function parse_template() {
|
||||
if (!templates[tpl_url] || !template_data) return;
|
||||
|
||||
@@ -90,8 +90,7 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="group-details-save">Save</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,6 +58,9 @@
|
||||
<li>
|
||||
<a href="/admin/settings"><i class="icon-cogs"></i> Settings</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" id="reconnect"></a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav pull-right" id="right-menu">
|
||||
<li><a href="/users" id="user_label"></a></li>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<span id="user-notfound-notify" class="label label-danger hide">User not found!</span><br/>
|
||||
</div>
|
||||
|
||||
<ul id="users-container" class="users">
|
||||
<ul id="users-container" class="users admin">
|
||||
<!-- BEGIN users -->
|
||||
<div class="users-box" data-uid="{users.uid}" data-admin="{users.administrator}" data-username="{users.username}" data-banned="{users.banned}">
|
||||
<a href="/user/{users.userslug}">
|
||||
@@ -31,12 +31,6 @@
|
||||
<span id='postcount'>{users.postcount}</span>
|
||||
<i class='icon-pencil'></i>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" class="btn btn-default admin-btn">Admin</a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" class="btn delete-btn btn-danger">Delete</a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" class="btn btn-default ban-btn">Ban</a>
|
||||
</div>
|
||||
|
||||
@@ -22,4 +22,32 @@
|
||||
margin:5px;
|
||||
}
|
||||
}
|
||||
|
||||
&.admin {
|
||||
#users-container {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.users-box{
|
||||
display: inline-block;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
height: auto;
|
||||
max-width: 125px;
|
||||
|
||||
img {
|
||||
width:80px;
|
||||
height:80px;
|
||||
}
|
||||
|
||||
a {
|
||||
margin:5px;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ var fs = require('fs'),
|
||||
} else {
|
||||
// Otherwise, this hook contains no methods
|
||||
var returnVal = (Array.isArray(args) ? args[0] : args);
|
||||
if (callback) callback(err, returnVal);
|
||||
if (callback) callback(null, returnVal);
|
||||
}
|
||||
},
|
||||
isActive: function(id, callback) {
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
var redis = require('redis'),
|
||||
utils = require('./../public/src/utils.js'),
|
||||
winston = require('winston'),
|
||||
nconf = require('nconf');
|
||||
nconf = require('nconf'),
|
||||
redis_socket_or_host = nconf.get('redis:host');
|
||||
|
||||
var redis_socket_or_host = nconf.get('redis:host')
|
||||
if(redis_socket_or_host.indexOf('/')>=0) {
|
||||
if (redis_socket_or_host && redis_socket_or_host.indexOf('/')>=0) {
|
||||
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
||||
RedisDB.exports = redis.createClient(nconf.get('redis:host'))
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Else, connect over tcp/ip */
|
||||
RedisDB.exports = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'));
|
||||
}
|
||||
|
||||
12
src/user.js
12
src/user.js
@@ -319,10 +319,13 @@ var utils = require('./../public/src/utils.js'),
|
||||
|
||||
function iterator(uid, callback) {
|
||||
User.getUserData(uid, function(err, userData) {
|
||||
if (userData) {
|
||||
data.push(userData);
|
||||
}
|
||||
callback(null);
|
||||
User.isAdministrator(uid, function(isAdmin) {
|
||||
if (userData) {
|
||||
userData.administrator = isAdmin?"1":"0";
|
||||
data.push(userData);
|
||||
}
|
||||
callback(null);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -330,6 +333,7 @@ var utils = require('./../public/src/utils.js'),
|
||||
callback(err, data);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
User.createGravatarURLFromEmail = function(email) {
|
||||
|
||||
@@ -23,7 +23,8 @@ var express = require('express'),
|
||||
feed = require('./feed'),
|
||||
plugins = require('./plugins'),
|
||||
nconf = require('nconf'),
|
||||
winston = require('winston');
|
||||
winston = require('winston'),
|
||||
validator = require('validator');
|
||||
|
||||
(function (app) {
|
||||
var templates = null,
|
||||
@@ -321,6 +322,9 @@ var express = require('express'),
|
||||
metaTags: [{
|
||||
name: "title",
|
||||
content: topicData.topic_name
|
||||
}, {
|
||||
name: "description",
|
||||
content: validator.sanitize(topicData.main_posts[0].content.substr(0, 255)).escape().replace('\n', '')
|
||||
}, {
|
||||
property: 'og:title',
|
||||
content: topicData.topic_name + ' | ' + (meta.config.title || 'NodeBB')
|
||||
|
||||
Reference in New Issue
Block a user