mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
Merge branch 'master' of github.com:psychobunny/NodeBB
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -12,61 +12,74 @@
|
|||||||
<span id="editLink" class="pull-right"><a href="/users/{username}/edit">edit</a></span>
|
<span id="editLink" class="pull-right"><a href="/users/{username}/edit">edit</a></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="account-picture-block">
|
|
||||||
<img src="{picture}" class="user-profile-picture"/>
|
<div class="row-fluid">
|
||||||
</div>
|
<div class="span3" style="text-align: center; margin-bottom:20px;">
|
||||||
|
<div class="account-picture-block">
|
||||||
|
<img src="{picture}" class="user-profile-picture"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="account-bio-block">
|
<div class="span9">
|
||||||
<span class="account-bio-label">email</span>
|
<div class="inline-block">
|
||||||
<span>{email}</span>
|
<div class="account-bio-block">
|
||||||
<br/>
|
<span class="account-bio-label">email</span>
|
||||||
|
<span>{email}</span>
|
||||||
<span class="account-bio-label">full name</span>
|
<br/>
|
||||||
<span>{fullname}</span>
|
|
||||||
<br/>
|
<span class="account-bio-label">full name</span>
|
||||||
|
<span>{fullname}</span>
|
||||||
<span class="account-bio-label">website</span>
|
<br/>
|
||||||
<span><a href="{website}">{website}</a></span>
|
|
||||||
<br/>
|
<span class="account-bio-label">website</span>
|
||||||
|
<span><a href="{website}">{website}</a></span>
|
||||||
<span class="account-bio-label">location</span>
|
<br/>
|
||||||
<span>{location}</span>
|
|
||||||
<br/>
|
<span class="account-bio-label">location</span>
|
||||||
|
<span>{location}</span>
|
||||||
<span class="account-bio-label">age</span>
|
<br/>
|
||||||
<span>{age}</span>
|
|
||||||
<br/>
|
<span class="account-bio-label">age</span>
|
||||||
|
<span>{age}</span>
|
||||||
<span class="account-bio-label">member for</span>
|
<br/>
|
||||||
<span>{joindate}</span>
|
|
||||||
<br/>
|
<span class="account-bio-label">member for</span>
|
||||||
|
<span>{joindate}</span>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<span class="account-bio-label">reputation</span>
|
<span class="account-bio-label">reputation</span>
|
||||||
<span id='reputation'>{reputation}</span>
|
<span id='reputation'>{reputation}</span>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<span class="account-bio-label">posts</span>
|
<span class="account-bio-label">posts</span>
|
||||||
<span id='postcount'>{postcount}</span>
|
<span id='postcount'>{postcount}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="user-actions" class="container">
|
||||||
|
<a id="add-friend-btn" href="#" class="btn">Add Friend</a>
|
||||||
|
<a id="send-message-btn" href="#" class="btn">Send Message</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- END user -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var yourid = '{yourid}';
|
var yourid = '{yourid}';
|
||||||
var theirid = '{theirid}';
|
var theirid = '{theirid}';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function addCommas(text) {
|
function addCommas(text) {
|
||||||
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var rep = $('#reputation');
|
var rep = $('#reputation');
|
||||||
rep.html(addCommas(rep.html()));
|
rep.html(addCommas(rep.html()));
|
||||||
|
|
||||||
@@ -74,9 +87,32 @@ var theirid = '{theirid}';
|
|||||||
postcount.html(addCommas(postcount.html()));
|
postcount.html(addCommas(postcount.html()));
|
||||||
|
|
||||||
var editLink = $('#editLink');
|
var editLink = $('#editLink');
|
||||||
if( yourid !== theirid)
|
var addFriendBtn = $('#add-friend-btn');
|
||||||
editLink.addClass('hidden');
|
var sendMessageBtn = $('#send-message-btn');
|
||||||
|
|
||||||
|
if( yourid !== theirid) {
|
||||||
|
editLink.hide();
|
||||||
|
addFriendBtn.show();
|
||||||
|
sendMessageBtn.show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addFriendBtn.hide();
|
||||||
|
sendMessageBtn.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
addFriendBtn.on('click', function() {
|
||||||
|
$.post('/users/addfriend', {uid: theirid},
|
||||||
|
function(data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
sendMessageBtn.on('click', function() {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
<div class="span9">
|
<div class="span9">
|
||||||
<div class="inline-block">
|
<div class="inline-block">
|
||||||
<form class='form-horizontal'>
|
<form class='form-horizontal'>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="inputEmail">Email</label>
|
<label class="control-label" for="inputEmail">Email</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input type="text" id="inputEmail" placeholder="Email" value="{email}">
|
<input type="text" id="inputEmail" placeholder="Email" value="{email}">
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<a id="submitBtn" href="" class="btn btn-primary">Save changes</a>
|
<a id="submitBtn" href="" class="btn btn-primary">Save changes</a>
|
||||||
<a href="/users/{username}" class="btn">Cancel</a>
|
<a href="/users/{username}" class="btn">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -136,6 +136,8 @@ var uploadedPicture = '{uploadedpicture}';
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#uploadForm').submit(function() {
|
$('#uploadForm').submit(function() {
|
||||||
status('uploading the file ...');
|
status('uploading the file ...');
|
||||||
|
|
||||||
|
|||||||
@@ -6,40 +6,24 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="category row">
|
<div class="category row">
|
||||||
<div class="span3">
|
|
||||||
<div class="block">
|
|
||||||
<strong>Top posters in {category_name}</strong>
|
|
||||||
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
|
||||||
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
<ul class="topic-container">
|
<ul>
|
||||||
<!-- BEGIN topics -->
|
<!-- BEGIN topics -->
|
||||||
<a href="../../topic/{topics.slug}"><li>
|
<a href="../../topic/{topics.slug}"><li>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12 topic-row img-polaroid">
|
<div class="span12 topic-row img-polaroid">
|
||||||
<div class="top-posters">
|
<div class="latest-post visible-desktop">
|
||||||
<i class="{topics.pin-icon}"></i><i class="{topics.lock-icon}"></i>
|
<div class="pull-right">
|
||||||
<!--<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=50" class="img-polaroid" />
|
<img src="{topics.recent_picture}?s=50" />
|
||||||
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=50" class="img-polaroid" />
|
<p><strong>{topics.recent_author}</strong>: {topics.recent_post}</p>
|
||||||
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=50" class="img-polaroid" />-->
|
|
||||||
<div class="latest-post pull-right">
|
|
||||||
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=50" />
|
|
||||||
<p><strong>psychobunny</strong>: Some post content goes here, the latest posts of course blah blahposts of course blah blahposts of course blah blahposts of course blah blah</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3><span class="badge {topics.badgeclass}">{topics.post_count}</span> {topics.title} <small>24<i class="icon-star"></i><br />Posted {topics.relativeTime} ago by
|
<h3><span class="badge {topics.badgeclass}">{topics.post_count}</span> {topics.title} <small>24<i class="icon-star"></i><br />
|
||||||
<span class="username">{topics.username}</span>.</small></h3>
|
<strong><i class="{topics.pin-icon}"></i><i class="{topics.lock-icon}"></i></strong>
|
||||||
|
Posted {topics.relativeTime} ago by
|
||||||
|
<strong>{topics.username}</strong>.</small></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -47,6 +31,40 @@
|
|||||||
<!-- END topics -->
|
<!-- END topics -->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span3">
|
||||||
|
<div class="sidebar-block img-polaroid">
|
||||||
|
<div class="block-header">
|
||||||
|
Recent Replies
|
||||||
|
</div>
|
||||||
|
<div class="block-content">
|
||||||
|
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sidebar-block img-polaroid">
|
||||||
|
<div class="block-header">
|
||||||
|
Top posters
|
||||||
|
</div>
|
||||||
|
<div class="block-content">
|
||||||
|
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/fd37ce111f863c6665045c2d72d199bf?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/07c9c7170c3ac676c2561e3eeaee063c?s=48" class="img-polaroid" />
|
||||||
|
<img src="http://www.gravatar.com/avatar/91050ce0072697b53380c6a03a1bc12a?s=48" class="img-polaroid" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/active">Active</a>
|
<a href="/active">Active</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/users">Users</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav pull-right" id="right-menu">
|
<ul class="nav pull-right" id="right-menu">
|
||||||
|
|||||||
@@ -222,6 +222,14 @@ marked.setOptions({
|
|||||||
RDB.set('pid:' + pid + ':tid', tid);
|
RDB.set('pid:' + pid + ':tid', tid);
|
||||||
|
|
||||||
RDB.incr('tid:' + tid + ':postcount');
|
RDB.incr('tid:' + tid + ':postcount');
|
||||||
|
|
||||||
|
|
||||||
|
user.getUserFields(uid, ['username','picture'], function(data){
|
||||||
|
RDB.set('tid:' + tid + ':recent:post', content);
|
||||||
|
RDB.set('tid:' + tid + ':recent:author', data.username);
|
||||||
|
RDB.set('tid:' + tid + ':recent:picture', data.picture);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// User Details - move this out later
|
// User Details - move this out later
|
||||||
RDB.lpush('uid:' + uid + ':posts', pid);
|
RDB.lpush('uid:' + uid + ':posts', pid);
|
||||||
|
|||||||
@@ -183,9 +183,35 @@ var user = require('./../user.js'),
|
|||||||
res.send({});
|
res.send({});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post('/users/addfriend', function(req, res){
|
||||||
|
if(!req.user)
|
||||||
|
return res.redirect('/403');
|
||||||
|
|
||||||
|
if(req.user.uid == req.body.uid)
|
||||||
|
return res.redirect('/');
|
||||||
|
|
||||||
|
user.addFriend(req.user.uid, req.body.uid, function(err, data) {
|
||||||
|
if(err)
|
||||||
|
res.send({error:err});
|
||||||
|
else
|
||||||
|
res.send(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/users/:username/friends', function(req, res){
|
||||||
|
|
||||||
|
if(!req.user)
|
||||||
|
return res.redirect('/403');
|
||||||
|
|
||||||
|
user.get_uid_by_username(req.params.username, function(uid) {
|
||||||
|
user.getFriends(uid, function(data) {
|
||||||
|
res.send(JSON.stringify(data, null, 0));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function api_method(req, res) {
|
function api_method(req, res) {
|
||||||
|
console.log("fail "+req.params.section);
|
||||||
var callerUID = req.user?req.user.uid : 0;
|
var callerUID = req.user?req.user.uid : 0;
|
||||||
|
|
||||||
if (!req.params.section && !req.params.username) {
|
if (!req.params.section && !req.params.username) {
|
||||||
@@ -195,6 +221,9 @@ var user = require('./../user.js'),
|
|||||||
res.send(JSON.stringify({users:data}));
|
res.send(JSON.stringify({users:data}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else if(String(req.params.section).toLowerCase() === 'friends') {
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (String(req.params.section).toLowerCase() === 'edit') {
|
else if (String(req.params.section).toLowerCase() === 'edit') {
|
||||||
getUserDataByUserName(req.params.username, callerUID, function(userData) {
|
getUserDataByUserName(req.params.username, callerUID, function(userData) {
|
||||||
@@ -210,6 +239,8 @@ var user = require('./../user.js'),
|
|||||||
|
|
||||||
app.get('/api/users/:username?/:section?', api_method);
|
app.get('/api/users/:username?/:section?', api_method);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getUserDataByUserName(username, callerUID, callback) {
|
function getUserDataByUserName(username, callerUID, callback) {
|
||||||
|
|
||||||
user.get_uid_by_username(username, function(uid) {
|
user.get_uid_by_username(username, function(uid) {
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ var RDB = require('./redis.js'),
|
|||||||
postcount = [],
|
postcount = [],
|
||||||
locked = [],
|
locked = [],
|
||||||
deleted = [],
|
deleted = [],
|
||||||
pinned = [];
|
pinned = [],
|
||||||
|
recent_post = [],
|
||||||
|
recent_author = [],
|
||||||
|
recent_picture = [];
|
||||||
|
|
||||||
for (var i=0, ii=tids.length; i<ii; i++) {
|
for (var i=0, ii=tids.length; i<ii; i++) {
|
||||||
title.push('tid:' + tids[i] + ':title');
|
title.push('tid:' + tids[i] + ':title');
|
||||||
@@ -38,6 +41,9 @@ var RDB = require('./redis.js'),
|
|||||||
locked.push('tid:' + tids[i] + ':locked');
|
locked.push('tid:' + tids[i] + ':locked');
|
||||||
deleted.push('tid:' + tids[i] + ':deleted');
|
deleted.push('tid:' + tids[i] + ':deleted');
|
||||||
pinned.push('tid:' + tids[i] + ':pinned');
|
pinned.push('tid:' + tids[i] + ':pinned');
|
||||||
|
recent_post.push('tid:' + tids[i] + ':recent:post');
|
||||||
|
recent_author.push('tid:' + tids[i] + ':recent:author');
|
||||||
|
recent_picture.push('tid:' + tids[i] + ':recent:picture');
|
||||||
}
|
}
|
||||||
|
|
||||||
var multi = RDB.multi()
|
var multi = RDB.multi()
|
||||||
@@ -53,6 +59,9 @@ var RDB = require('./redis.js'),
|
|||||||
.mget(locked)
|
.mget(locked)
|
||||||
.mget(deleted)
|
.mget(deleted)
|
||||||
.mget(pinned)
|
.mget(pinned)
|
||||||
|
.mget(recent_post)
|
||||||
|
.mget(recent_author)
|
||||||
|
.mget(recent_picture)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +78,9 @@ var RDB = require('./redis.js'),
|
|||||||
locked = replies[6];
|
locked = replies[6];
|
||||||
deleted = replies[7];
|
deleted = replies[7];
|
||||||
pinned = replies[8];
|
pinned = replies[8];
|
||||||
|
recent_post = replies[9];
|
||||||
|
recent_author = replies[10];
|
||||||
|
recent_picture = replies[11];
|
||||||
|
|
||||||
var usernames,
|
var usernames,
|
||||||
has_read;
|
has_read;
|
||||||
@@ -76,6 +88,7 @@ var RDB = require('./redis.js'),
|
|||||||
function generate_topic() {
|
function generate_topic() {
|
||||||
if (!usernames || !has_read) return;
|
if (!usernames || !has_read) return;
|
||||||
|
|
||||||
|
|
||||||
for (var i=0, ii=title.length; i<ii; i++) {
|
for (var i=0, ii=title.length; i<ii; i++) {
|
||||||
topics.push({
|
topics.push({
|
||||||
'title' : title[i],
|
'title' : title[i],
|
||||||
@@ -89,7 +102,10 @@ var RDB = require('./redis.js'),
|
|||||||
'deleted': deleted[i],
|
'deleted': deleted[i],
|
||||||
'pinned': parseInt(pinned[i] || 0), // For sorting purposes
|
'pinned': parseInt(pinned[i] || 0), // For sorting purposes
|
||||||
'pin-icon': pinned[i] === '1' ? 'icon-pushpin' : 'none',
|
'pin-icon': pinned[i] === '1' ? 'icon-pushpin' : 'none',
|
||||||
'badgeclass' : (has_read[i] && current_user !=0) ? '' : 'badge-important'
|
'badgeclass' : (has_read[i] && current_user !=0) ? '' : 'badge-important',
|
||||||
|
'recent_post' : recent_post[i],
|
||||||
|
'recent_author' : recent_author[i],
|
||||||
|
'recent_picture' : recent_picture[i]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
24
src/user.js
24
src/user.js
@@ -102,8 +102,12 @@ var config = require('../config.js'),
|
|||||||
|
|
||||||
RDB.keys('user:*', function(err, userkeys){
|
RDB.keys('user:*', function(err, userkeys){
|
||||||
|
|
||||||
|
var anonUserIndex = userkeys.indexOf("user:0");
|
||||||
|
if(anonUserIndex !== -1) {
|
||||||
|
userkeys.splice(anonUserIndex, 1);
|
||||||
|
}
|
||||||
|
|
||||||
for(var i=0,ii=userkeys.length; i<ii; ++i) {
|
for(var i=0,ii=userkeys.length; i<ii; ++i) {
|
||||||
|
|
||||||
RDB.hgetall(userkeys[i], function(err, userdata) {
|
RDB.hgetall(userkeys[i], function(err, userdata) {
|
||||||
|
|
||||||
if(userdata && userdata.password)
|
if(userdata && userdata.password)
|
||||||
@@ -115,7 +119,6 @@ var config = require('../config.js'),
|
|||||||
callback(data);
|
callback(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,6 +354,23 @@ var config = require('../config.js'),
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
User.addFriend = function(uid, friendid, callback) {
|
||||||
|
RDB.sadd('user:'+uid+':friends', friendid, function(err, data){
|
||||||
|
if(err === null)
|
||||||
|
callback(data);
|
||||||
|
else
|
||||||
|
console.log(err);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
User.getFriends = function(uid, callback) {
|
||||||
|
RDB.smembers('user:'+uid+':friends', function(err, data){
|
||||||
|
if(err === null)
|
||||||
|
callback(data);
|
||||||
|
else
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
User.exists = function(username, callback) {
|
User.exists = function(username, callback) {
|
||||||
User.get_uid_by_username(username, function(exists) {
|
User.get_uid_by_username(username, function(exists) {
|
||||||
|
|||||||
Reference in New Issue
Block a user