mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-09 07:31:51 +02:00
Merge remote-tracking branch 'origin/master' into flagging-refactor
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"name": "nodebb",
|
||||
"license": "GPL-3.0",
|
||||
"description": "NodeBB Forum",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"homepage": "http://www.nodebb.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -88,3 +88,30 @@ div.categories {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.category {
|
||||
.privilege-table {
|
||||
tr > th:first-child {
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
.privilege-table-header {
|
||||
background: white;
|
||||
|
||||
th {
|
||||
text-align: center;
|
||||
border-top: 0;
|
||||
text-transform: uppercase;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.arrowed:after {
|
||||
border-bottom: 1px dashed #ccc;
|
||||
content: "";
|
||||
width: 100%;
|
||||
display: block;
|
||||
padding-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var async = require('async'),
|
||||
var async = require('async');
|
||||
|
||||
var user = require('../user');
|
||||
var db = require('./../database');
|
||||
|
||||
user = require('../user'),
|
||||
db = require('./../database'),
|
||||
groups = module.parent.exports;
|
||||
|
||||
module.exports = function (Groups) {
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = function (Groups) {
|
||||
async.apply(db.getObjectValues, 'groupslug:groupname'),
|
||||
function (groupNames, next) {
|
||||
// Ephemeral groups and the registered-users groups are searchable
|
||||
groupNames = groups.getEphemeralGroups().concat(groupNames).concat('registered-users');
|
||||
groupNames = Groups.getEphemeralGroups().concat(groupNames).concat('registered-users');
|
||||
groupNames = groupNames.filter(function (name) {
|
||||
return name.toLowerCase().indexOf(query) !== -1 && name !== 'administrators' && !Groups.isPrivilegeGroup(name);
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ SocketUser.deleteAccount = function (socket, data, callback) {
|
||||
user.deleteAccount(socket.uid, next);
|
||||
},
|
||||
function (next) {
|
||||
socket.broadcast.emit('event:user_status_change', {uid: socket.uid, status: 'offline'});
|
||||
require('./index').server.sockets.emit('event:user_status_change', {uid: socket.uid, status: 'offline'});
|
||||
|
||||
events.log({
|
||||
type: 'user-delete',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var async = require('async'),
|
||||
plugins = require('../plugins'),
|
||||
db = require('../database');
|
||||
var async = require('async');
|
||||
var plugins = require('../plugins');
|
||||
var db = require('../database');
|
||||
|
||||
module.exports = function (User) {
|
||||
|
||||
@@ -73,25 +73,22 @@ module.exports = function (User) {
|
||||
if (!parseInt(uid, 10)) {
|
||||
return callback(null, []);
|
||||
}
|
||||
|
||||
db.getSortedSetRevRange(type + ':' + uid, start, stop, function (err, uids) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
db.getSortedSetRevRange(type + ':' + uid, start, stop, next);
|
||||
},
|
||||
function (uids, next) {
|
||||
plugins.fireHook('filter:user.' + type, {
|
||||
uids: uids,
|
||||
uid: uid,
|
||||
start: start,
|
||||
stop: stop
|
||||
}, next);
|
||||
},
|
||||
function (data, next) {
|
||||
User.getUsers(data.uids, uid, next);
|
||||
}
|
||||
|
||||
plugins.fireHook('filter:user.' + type, {
|
||||
uids: uids,
|
||||
uid: uid,
|
||||
start: start,
|
||||
stop: stop
|
||||
}, function (err, data) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
User.getUsers(data.uids, uid, callback);
|
||||
});
|
||||
});
|
||||
], callback);
|
||||
}
|
||||
|
||||
User.isFollowing = function (uid, theirid, callback) {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<table class="table table-striped table-hover privilege-table">
|
||||
<table class="table table-striped privilege-table">
|
||||
<tr class="privilege-table-header">
|
||||
<th colspan="2"></th>
|
||||
<th class="arrowed" colspan="3">Viewing Privileges</th>
|
||||
<th class="arrowed" colspan="7">Posting Privileges</th>
|
||||
<th class="arrowed" colspan="2">Moderation Privileges</th>
|
||||
</tr><tr><!-- zebrastripe reset --></tr>
|
||||
<tr>
|
||||
<th colspan="2">User</th>
|
||||
<!-- BEGIN privileges.labels.users -->
|
||||
@@ -34,7 +40,13 @@
|
||||
<!-- ENDIF privileges.users.length -->
|
||||
</table>
|
||||
|
||||
<table class="table table-striped table-hover privilege-table">
|
||||
<table class="table table-striped privilege-table">
|
||||
<tr class="privilege-table-header">
|
||||
<th colspan="2"></th>
|
||||
<th class="arrowed" colspan="3">Viewing Privileges</th>
|
||||
<th class="arrowed" colspan="7">Posting Privileges</th>
|
||||
<th class="arrowed" colspan="2">Moderation Privileges</th>
|
||||
</tr><tr><!-- zebrastripe reset --></tr>
|
||||
<tr>
|
||||
<th colspan="2">Group</th>
|
||||
<!-- BEGIN privileges.labels.groups -->
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="timeagoCutoff">Date cut-off (in days)</label>
|
||||
<input type="number" class="form-control" id="timeagoCutoff" data-field="timeagoCutoff" value="30" />
|
||||
<input type="number" class="form-control" id="timeagoCutoff" data-field="timeagoCutoff" />
|
||||
<p class="help-block">
|
||||
Dates & times will be shown in a relative manner (e.g. "3 hours ago" / "5 days ago"), and localised into various
|
||||
languages. After a certain point, this text can be switched to display the localised date itself
|
||||
|
||||
@@ -785,7 +785,48 @@ describe('Controllers', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('account follow page', function () {
|
||||
var socketUser = require('../src/socket.io/user');
|
||||
var uid;
|
||||
before(function (done) {
|
||||
user.create({username: 'follower'}, function (err, _uid) {
|
||||
assert.ifError(err);
|
||||
uid = _uid;
|
||||
socketUser.follow({uid: uid}, {uid: fooUid}, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('should get followers page', function (done) {
|
||||
request(nconf.get('url') + '/api/user/foo/followers', {json: true}, function (err, res, body) {
|
||||
assert.ifError(err);
|
||||
assert.equal(res.statusCode, 200);
|
||||
assert.equal(body.users[0].username, 'follower');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should get following page', function (done) {
|
||||
request(nconf.get('url') + '/api/user/follower/following', {json: true}, function (err, res, body) {
|
||||
assert.ifError(err);
|
||||
assert.equal(res.statusCode, 200);
|
||||
assert.equal(body.users[0].username, 'foo');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return empty after unfollow', function (done ) {
|
||||
socketUser.unfollow({uid: uid}, {uid: fooUid}, function (err) {
|
||||
assert.ifError(err);
|
||||
request(nconf.get('url') + '/api/user/foo/followers', {json: true}, function (err, res, body) {
|
||||
assert.ifError(err);
|
||||
assert.equal(res.statusCode, 200);
|
||||
assert.equal(body.users.length, 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
|
||||
48
test/user.js
48
test/user.js
@@ -610,7 +610,55 @@ describe('User', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('socket methods', function () {
|
||||
var socketUser = require('../src/socket.io/user');
|
||||
|
||||
it('should fail with invalid data', function (done) {
|
||||
socketUser.exists({uid: testUid}, null, function (err) {
|
||||
assert.equal(err.message, '[[error:invalid-data]]');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return true if user/group exists', function (done) {
|
||||
socketUser.exists({uid: testUid}, {username: 'registered-users'}, function (err, exists) {
|
||||
assert.ifError(err);
|
||||
assert(exists);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return true if user/group exists', function (done) {
|
||||
socketUser.exists({uid: testUid}, {username: 'John Smith'}, function (err, exists) {
|
||||
assert.ifError(err);
|
||||
assert(exists);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return false if user/group does not exists', function (done) {
|
||||
socketUser.exists({uid: testUid}, {username: 'doesnot exist'}, function (err, exists) {
|
||||
assert.ifError(err);
|
||||
assert(!exists);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should delete user', function (done) {
|
||||
User.create({username: 'tobedeleted'}, function (err, _uid) {
|
||||
assert.ifError(err);
|
||||
socketUser.deleteAccount({uid: _uid}, {}, function (err) {
|
||||
assert.ifError(err);
|
||||
socketUser.exists({uid: testUid}, {username: 'doesnot exist'}, function (err, exists) {
|
||||
assert.ifError(err);
|
||||
assert(!exists);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user