diff --git a/public/css/style.less b/public/css/style.less
index 923a35a1b6..31e75464f2 100644
--- a/public/css/style.less
+++ b/public/css/style.less
@@ -361,4 +361,10 @@ footer.footer {
background: #56BCDA;
color: white;
padding: 30px;
-}
\ No newline at end of file
+}
+
+.users-box{
+ display:inline-block;
+ margin:20px;
+ text-align:center;
+}
diff --git a/public/templates/users.tpl b/public/templates/users.tpl
index d805aca37c..868526a867 100644
--- a/public/templates/users.tpl
+++ b/public/templates/users.tpl
@@ -1,5 +1,19 @@
Users
\ No newline at end of file
diff --git a/src/posts.js b/src/posts.js
index ae74b0ed57..6ab42fb885 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -178,7 +178,7 @@ var RDB = require('./redis.js'),
// User Details - move this out later
RDB.lpush('uid:' + uid + ':posts', pid);
- RDB.db.hincrby(uid, 'postcount', 1);
+ user.incrementUserFieldBy(uid, 'postcount', 1);
if (callback)
callback(pid);
@@ -196,7 +196,7 @@ var RDB = require('./redis.js'),
if (hasFavourited == false) {
RDB.sadd('pid:' + pid + ':users_favourited', uid);
- RDB.db.hincrby(String(uid_of_poster), 'reputation', 1);
+ user.incrementUserFieldBy(uid_of_poster, 'reputation', 1);
RDB.incr('pid:' + pid + ':rep');
@@ -212,8 +212,9 @@ var RDB = require('./redis.js'),
RDB.get('pid:' + pid + ':uid', function(uid_of_poster) {
Posts.hasFavourited(pid, uid, function(hasFavourited) {
if (hasFavourited == true) {
+
RDB.srem('pid:' + pid + ':users_favourited', uid);
- RDB.db.hincrby(String(uid_of_poster), 'reputation', -1);
+ user.incrementUserFieldBy(uid_of_poster, 'reputation', -1);
RDB.decr('pid:' + pid + ':rep');
if (room_id) {
diff --git a/src/user.js b/src/user.js
index d5638a4f9f..823a913ca3 100644
--- a/src/user.js
+++ b/src/user.js
@@ -10,7 +10,7 @@ var config = require('../config.js'),
User.getUserField = function(uid, field, callback) {
- RDB.db.hget(String(uid), field, function(err, data){
+ RDB.db.hget('user:'+uid, field, function(err, data){
if(err === null)
callback(data);
else
@@ -19,7 +19,7 @@ var config = require('../config.js'),
}
User.getUserFields = function(uid, fields, callback) {
- RDB.db.hmget(String(uid), fields, function(err, data){
+ RDB.db.hmget('user:'+uid, fields, function(err, data){
if(err === null) {
var returnData = {};
@@ -57,7 +57,7 @@ var config = require('../config.js'),
User.getUserData = function(uid, callback) {
- RDB.db.hgetall(String(uid), function(err, data){
+ RDB.db.hgetall('user:'+uid, function(err, data){
if(err === null)
{
if(data && data['password'])
@@ -70,12 +70,32 @@ var config = require('../config.js'),
}
User.setUserField = function(uid, field, value) {
- RDB.db.hset(String(uid), field, value);
+ RDB.db.hset('user:'+uid, field, value);
+ }
+
+ User.incrementUserFieldBy = function(uid, field, value) {
+ RDB.db.hincrby('user:'+uid, field, value);
}
User.getUserList = function(callback){
- RDB.db.lrange('user:users', 0, -1, function(err, data) {
- callback(data);
+ var data = [];
+
+ RDB.db.keys('user:*', function(err, userkeys){
+
+ for(var i=0,ii=userkeys.length; itemplates.ready(function(){ajaxify.go("users/' + req.params.uid+'/edit");});' + templates['footer']);
}
else