mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
Merge remote-tracking branch 'origin'
This commit is contained in:
@@ -723,3 +723,14 @@ body .navbar .nodebb-inline-block {
|
|||||||
max-height:60px;
|
max-height:60px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.username-field {
|
||||||
|
.icon-circle {
|
||||||
|
font-size: 12px;
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
.icon-circle-blank {
|
||||||
|
font-size: 12px;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,8 @@ var ajaxify = {};
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.process_page();
|
||||||
|
|
||||||
jQuery('#content, #footer').fadeIn(200);
|
jQuery('#content, #footer').fadeIn(200);
|
||||||
}, url, template);
|
}, url, template);
|
||||||
|
|
||||||
|
|||||||
@@ -277,6 +277,35 @@ var socket,
|
|||||||
app.current_room = room;
|
app.current_room = room;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
app.process_page = function() {
|
||||||
|
|
||||||
|
function populate_online_users() {
|
||||||
|
var uids = [];
|
||||||
|
|
||||||
|
jQuery('.post-row').each(function() {
|
||||||
|
uids.push(this.getAttribute('data-uid'));
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.emit('api:user.get_online_users', uids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
populate_online_users();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.on('api:user.get_online_users', function(users) {
|
||||||
|
jQuery('.username-field').each(function() {
|
||||||
|
var uid = jQuery(this).parents('li').attr('data-uid');
|
||||||
|
|
||||||
|
if (uid && jQuery.inArray(uid, users) !== -1) {
|
||||||
|
jQuery(this).prepend('<i class="icon-circle"></i>');
|
||||||
|
} else {
|
||||||
|
jQuery(this).prepend('<i class="icon-circle-blank"></i>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
jQuery('document').ready(function() {
|
jQuery('document').ready(function() {
|
||||||
app.enter_room('global');
|
app.enter_room('global');
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,16 @@
|
|||||||
<div id="category_active_users"></div>
|
<div id="category_active_users"></div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="alert alert-warning hide" id="category-no-topics">
|
||||||
|
<strong>There are no topics in this category.</strong><br />
|
||||||
|
Why don't you try posting one?
|
||||||
|
</div>
|
||||||
<div class="category row">
|
<div class="category row">
|
||||||
|
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
<ul id="topics-container">
|
<ul id="topics-container">
|
||||||
<!-- BEGIN topics -->
|
<!-- BEGIN topics -->
|
||||||
<a href="../../topic/{topics.slug}"><li class="{topics.deleted-class}">
|
<a href="../../topic/{topics.slug}"><li class="category-item {topics.deleted-class}">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span1 thread-rating hidden-phone hidden-tablet">
|
<div class="span1 thread-rating hidden-phone hidden-tablet">
|
||||||
<span>
|
<span>
|
||||||
@@ -90,6 +94,11 @@
|
|||||||
'event:new_topic'
|
'event:new_topic'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (jQuery('.category-item').length == 0) {
|
||||||
|
jQuery('.category.row').hide();
|
||||||
|
jQuery('#category-no-topics').show();
|
||||||
|
}
|
||||||
|
|
||||||
socket.on('event:new_topic', function(data) {
|
socket.on('event:new_topic', function(data) {
|
||||||
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }),
|
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }),
|
||||||
topic = document.createElement('div'),
|
topic = document.createElement('div'),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<!-- BEGIN categories -->
|
<!-- BEGIN categories -->
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<a href="category/{categories.slug}">
|
<a href="category/{categories.slug}">
|
||||||
<h4>{categories.name} <span class="badge badge-important">3</span></h4>
|
<h4>{categories.name} <span class="badge {categories.badgeclass}">{categories.topic_count}</span></h4>
|
||||||
<!-- {categories.description} -->
|
<!-- {categories.description} -->
|
||||||
<div class="category-icon {categories.blockclass}">
|
<div class="category-icon {categories.blockclass}">
|
||||||
<i class="{categories.icon} icon-4x"></i>
|
<i class="{categories.icon} icon-4x"></i>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- BEGIN main_posts -->
|
<!-- BEGIN main_posts -->
|
||||||
<li class="row main-post" data-pid="{main_posts.pid}" data-deleted="{main_posts.deleted}">
|
<li class="row post-row main-post" data-pid="{main_posts.pid}" data-uid="{main_posts.uid}" data-deleted="{main_posts.deleted}">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div class="post-block">
|
<div class="post-block">
|
||||||
<a class="main-avatar" href="/users/{main_posts.username}">
|
<a class="main-avatar" href="/users/{main_posts.username}">
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<small>
|
<small>
|
||||||
posted {main_posts.relativeTime} ago by <strong><a href="/users/{main_posts.username}">{main_posts.username}</a></strong>
|
posted {main_posts.relativeTime} ago by <strong><a href="/users/{main_posts.username}" class="username-field">{main_posts.username}</a></strong>
|
||||||
<span class="{main_posts.edited-class}"><i class="icon-edit" title="edited by {main_posts.editor} {main_posts.relativeEditTime} ago"></i></span>
|
<span class="{main_posts.edited-class}"><i class="icon-edit" title="edited by {main_posts.editor} {main_posts.relativeEditTime} ago"></i></span>
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<!-- END main_posts -->
|
<!-- END main_posts -->
|
||||||
|
|
||||||
<!-- BEGIN posts -->
|
<!-- BEGIN posts -->
|
||||||
<li class="row" data-pid="{posts.pid}" data-uid="{posts.uid}" data-deleted="{posts.deleted}">
|
<li class="row post-row" data-pid="{posts.pid}" data-uid="{posts.uid}" data-deleted="{posts.deleted}">
|
||||||
<div class="span1 profile-image-block visible-desktop">
|
<div class="span1 profile-image-block visible-desktop">
|
||||||
<!--<i class="icon-spinner icon-spin icon-2x pull-left"></i>-->
|
<!--<i class="icon-spinner icon-spin icon-2x pull-left"></i>-->
|
||||||
<a href="/users/{posts.username}">
|
<a href="/users/{posts.username}">
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<div id="favs_{posts.pid}_{posts.uid}" class="favourite hidden-phone"><span class="post_rep_{posts.pid}">{posts.post_rep}</span><i class="{posts.fav_star_class}"></i></div>
|
<div id="favs_{posts.pid}_{posts.uid}" class="favourite hidden-phone"><span class="post_rep_{posts.pid}">{posts.post_rep}</span><i class="{posts.fav_star_class}"></i></div>
|
||||||
<div class="post_reply"><i class="icon-reply"></i></div>
|
<div class="post_reply"><i class="icon-reply"></i></div>
|
||||||
</span>
|
</span>
|
||||||
<img class="hidden-desktop" src="{posts.gravatar}?s=10" align="left" /> posted by <strong><a href="/users/{posts.username}">{posts.username}</a></strong> {posts.relativeTime} ago
|
<img class="hidden-desktop" src="{posts.gravatar}?s=10" align="left" /> posted by <strong><a class="username-field" href="/users/{posts.username}">{posts.username}</a></strong> {posts.relativeTime} ago
|
||||||
<span class="{posts.edited-class} hidden-phone">| last edited by <strong><a href="/users/{posts.editor}">{posts.editor}</a></strong> {posts.relativeEditTime} ago</span>
|
<span class="{posts.edited-class} hidden-phone">| last edited by <strong><a href="/users/{posts.editor}">{posts.editor}</a></strong> {posts.relativeEditTime} ago</span>
|
||||||
<span class="{posts.edited-class}"><i class="icon-edit visible-phone" title="edited by {posts.editor} {posts.relativeEditTime} ago"></i></span>
|
<span class="{posts.edited-class}"><i class="icon-edit visible-phone" title="edited by {posts.editor} {posts.relativeEditTime} ago"></i></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -272,6 +272,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('.post-container').delegate('.edit', 'click', function(e) {
|
$('.post-container').delegate('.edit', 'click', function(e) {
|
||||||
var pid = ($(this).attr('id') || $(this.parentNode).attr('id')).split('_')[1];
|
var pid = ($(this).attr('id') || $(this.parentNode).attr('id')).split('_')[1];
|
||||||
app.open_post_window('edit', "{topic_id}", "{topic_name}", pid);
|
app.open_post_window('edit', "{topic_id}", "{topic_name}", pid);
|
||||||
@@ -297,6 +298,7 @@
|
|||||||
'event:topic_moved', 'event:post_edited', 'event:post_deleted', 'event:post_restored',
|
'event:topic_moved', 'event:post_edited', 'event:post_deleted', 'event:post_restored',
|
||||||
'api:posts.favourite'
|
'api:posts.favourite'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
socket.on('api:get_users_in_room', function(users) {
|
socket.on('api:get_users_in_room', function(users) {
|
||||||
var anonymous = users.anonymous,
|
var anonymous = users.anonymous,
|
||||||
usernames = users.usernames,
|
usernames = users.usernames,
|
||||||
@@ -337,6 +339,8 @@
|
|||||||
.fadeIn('slow');
|
.fadeIn('slow');
|
||||||
|
|
||||||
set_up_posts(uniqueid);
|
set_up_posts(uniqueid);
|
||||||
|
|
||||||
|
addCommasToNumbers();
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('event:topic_deleted', function(data) {
|
socket.on('event:topic_deleted', function(data) {
|
||||||
|
|||||||
@@ -56,10 +56,10 @@ var RDB = require('./redis.js'),
|
|||||||
// just a reminder to self that name + slugs are stored into topics data as well.
|
// just a reminder to self that name + slugs are stored into topics data as well.
|
||||||
};
|
};
|
||||||
|
|
||||||
Categories.get = function(callback) {
|
Categories.get = function(callback, current_user) {
|
||||||
RDB.lrange('categories:cid', 0, -1, function(err, cids) {
|
RDB.lrange('categories:cid', 0, -1, function(err, cids) {
|
||||||
RDB.handle(err);
|
RDB.handle(err);
|
||||||
Categories.get_category(cids, callback);
|
Categories.get_category(cids, callback, current_user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,12 +79,29 @@ var RDB = require('./redis.js'),
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Categories.get_category = function(cids, callback) {
|
|
||||||
|
Categories.hasReadCategories = function(cids, uid, callback) {
|
||||||
|
var batch = RDB.multi();
|
||||||
|
|
||||||
|
for (var i=0, ii=cids.length; i<ii; i++) {
|
||||||
|
batch.sismember('cid:' + cids[i] + ':read_by_uid', uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
batch.exec(function(err, hasRead) {
|
||||||
|
callback(hasRead);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Categories.get_category = function(cids, callback, current_user) {
|
||||||
var name = [],
|
var name = [],
|
||||||
description = [],
|
description = [],
|
||||||
icon = [],
|
icon = [],
|
||||||
blockclass = [],
|
blockclass = [],
|
||||||
slug = [];
|
slug = [],
|
||||||
|
topic_count = [],
|
||||||
|
has_read = {};
|
||||||
|
|
||||||
for (var i=0, ii=cids.length; i<ii; i++) {
|
for (var i=0, ii=cids.length; i<ii; i++) {
|
||||||
name.push('cid:' + cids[i] + ':name');
|
name.push('cid:' + cids[i] + ':name');
|
||||||
@@ -92,6 +109,7 @@ var RDB = require('./redis.js'),
|
|||||||
icon.push('cid:' + cids[i] + ':icon');
|
icon.push('cid:' + cids[i] + ':icon');
|
||||||
blockclass.push('cid:' + cids[i] + ':blockclass');
|
blockclass.push('cid:' + cids[i] + ':blockclass');
|
||||||
slug.push('cid:' + cids[i] + ':slug');
|
slug.push('cid:' + cids[i] + ':slug');
|
||||||
|
topic_count.push('cid:' + cids[i] + ':topiccount');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cids.length > 0) {
|
if (cids.length > 0) {
|
||||||
@@ -101,13 +119,17 @@ var RDB = require('./redis.js'),
|
|||||||
.mget(icon)
|
.mget(icon)
|
||||||
.mget(blockclass)
|
.mget(blockclass)
|
||||||
.mget(slug)
|
.mget(slug)
|
||||||
|
.mget(topic_count)
|
||||||
.exec(function(err, replies) {
|
.exec(function(err, replies) {
|
||||||
name = replies[0];
|
name = replies[0];
|
||||||
description = replies[1];
|
description = replies[1];
|
||||||
icon = replies[2];
|
icon = replies[2];
|
||||||
blockclass = replies[3];
|
blockclass = replies[3];
|
||||||
slug = replies[4];
|
slug = replies[4];
|
||||||
|
topic_count = replies[5];
|
||||||
|
|
||||||
|
|
||||||
|
function generateCategories() {
|
||||||
var categories = [];
|
var categories = [];
|
||||||
for (var i=0, ii=cids.length; i<ii; i++) {
|
for (var i=0, ii=cids.length; i<ii; i++) {
|
||||||
categories.push({
|
categories.push({
|
||||||
@@ -116,11 +138,20 @@ var RDB = require('./redis.js'),
|
|||||||
'slug' : slug[i],
|
'slug' : slug[i],
|
||||||
'description' : description[i],
|
'description' : description[i],
|
||||||
'blockclass' : blockclass[i],
|
'blockclass' : blockclass[i],
|
||||||
'icon' : icon[i]
|
'icon' : icon[i],
|
||||||
|
'badgeclass' : (!topic_count[i] || (has_read[i] && current_user !=0)) ? '' : 'badge-important',
|
||||||
|
'topic_count' : topic_count[i] || 0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
callback({'categories': categories});
|
callback({'categories': categories});
|
||||||
|
}
|
||||||
|
|
||||||
|
Categories.hasReadCategories(cids, current_user, function(read_data) {
|
||||||
|
has_read = read_data;
|
||||||
|
generateCategories();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
} else callback({'categories' : []});
|
} else callback({'categories' : []});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ marked.setOptions({
|
|||||||
}
|
}
|
||||||
|
|
||||||
Posts.get_cid_by_pid = function(pid, callback) {
|
Posts.get_cid_by_pid = function(pid, callback) {
|
||||||
Posts.get_tid(pid, function(tid) {
|
Posts.get_tid_by_pid(pid, function(tid) {
|
||||||
if (tid) topics.get_cid_by_tid(tid, function(cid) {
|
if (tid) topics.get_cid_by_tid(tid, function(cid) {
|
||||||
if (cid) callback(cid);
|
if (cid) callback(cid);
|
||||||
else callback(false);
|
else callback(false);
|
||||||
@@ -220,6 +220,9 @@ marked.setOptions({
|
|||||||
RDB.rpush('tid:' + tid + ':posts', pid);
|
RDB.rpush('tid:' + tid + ':posts', pid);
|
||||||
|
|
||||||
RDB.del('tid:' + tid + ':read_by_uid'); // let everybody know there is an unread post
|
RDB.del('tid:' + tid + ':read_by_uid'); // let everybody know there is an unread post
|
||||||
|
Posts.get_cid_by_pid(pid, function(cid) {
|
||||||
|
RDB.del('cid:' + cid + ':read_by_uid');
|
||||||
|
});
|
||||||
|
|
||||||
// Re-add the poster, so he/she does not get an "unread" flag on this topic
|
// Re-add the poster, so he/she does not get an "unread" flag on this topic
|
||||||
topics.markAsRead(tid, uid);
|
topics.markAsRead(tid, uid);
|
||||||
|
|||||||
17
src/redis.js
17
src/redis.js
@@ -3,7 +3,8 @@
|
|||||||
ERROR_LOGS = true,
|
ERROR_LOGS = true,
|
||||||
|
|
||||||
redis = require('redis'),
|
redis = require('redis'),
|
||||||
config = require('../config.js');
|
config = require('../config.js'),
|
||||||
|
utils = require('./utils.js');
|
||||||
|
|
||||||
|
|
||||||
RedisDB.exports = redis.createClient(config.redis.port, config.redis.host, config.redis.options);
|
RedisDB.exports = redis.createClient(config.redis.port, config.redis.host, config.redis.options);
|
||||||
@@ -22,4 +23,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A possibly more efficient way of doing multiple sismember calls
|
||||||
|
*/
|
||||||
|
RedisDB.exports.sismembers = function(key, needles, callback) {
|
||||||
|
var tempkey = key + ':temp:' + utils.generateUUID();
|
||||||
|
RedisDB.exports.sadd(tempkey, needles, function() {
|
||||||
|
RedisDB.exports.sinter(key, tempkey, function(err, data) {
|
||||||
|
RedisDB.exports.del(tempkey);
|
||||||
|
callback(err, data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
}(module));
|
}(module));
|
||||||
@@ -72,9 +72,19 @@ marked.setOptions({
|
|||||||
callback(false);
|
callback(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
active_usernames = replies[1];
|
active_usernames = replies[1];
|
||||||
var topics = [];
|
var topics = [];
|
||||||
|
|
||||||
|
if (tids.length == 0) {
|
||||||
|
callback({
|
||||||
|
'category_name' : category_id ? category_name : 'Recent',
|
||||||
|
'show_topic_button' : category_id ? 'show' : 'hidden',
|
||||||
|
'category_id': category_id || 0,
|
||||||
|
'topics' : []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
title = replies[2];
|
title = replies[2];
|
||||||
uid = replies[3];
|
uid = replies[3];
|
||||||
timestamp = replies[4];
|
timestamp = replies[4];
|
||||||
@@ -252,7 +262,11 @@ marked.setOptions({
|
|||||||
}
|
}
|
||||||
|
|
||||||
Topics.markAsRead = function(tid, uid) {
|
Topics.markAsRead = function(tid, uid) {
|
||||||
|
// there is an issue with this fn. if you read a topic that is previously read you will mark the category as read anyways - there is no check
|
||||||
RDB.sadd('tid:' + tid + ':read_by_uid', uid);
|
RDB.sadd('tid:' + tid + ':read_by_uid', uid);
|
||||||
|
Topics.get_cid_by_tid(tid, function(cid) {
|
||||||
|
RDB.sadd('cid:' + cid + ':read_by_uid', uid);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Topics.hasReadTopics = function(tids, uid, callback) {
|
Topics.hasReadTopics = function(tids, uid, callback) {
|
||||||
@@ -391,6 +405,9 @@ marked.setOptions({
|
|||||||
timeout: 2000
|
timeout: 2000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// let everyone know that there is an unread topic in this category
|
||||||
|
RDB.del('cid:' + category_id + ':read_by_uid');
|
||||||
|
|
||||||
// in future it may be possible to add topics to several categories, so leaving the door open here.
|
// in future it may be possible to add topics to several categories, so leaving the door open here.
|
||||||
RDB.sadd('categories:' + category_id + ':tid', tid);
|
RDB.sadd('categories:' + category_id + ':tid', tid);
|
||||||
RDB.set('tid:' + tid + ':cid', category_id);
|
RDB.set('tid:' + tid + ':cid', category_id);
|
||||||
@@ -399,6 +416,7 @@ marked.setOptions({
|
|||||||
RDB.set('tid:' + tid + ':category_slug', data.categories[0].slug);
|
RDB.set('tid:' + tid + ':category_slug', data.categories[0].slug);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RDB.incr('cid:' + category_id + ':topiccount');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
17
src/user.js
17
src/user.js
@@ -660,7 +660,22 @@ var config = require('../config.js'),
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
User.get_online_users = function(socket, uids) {
|
||||||
|
RDB.sismembers('users:online', uids, function(err, data) {
|
||||||
|
socket.emit('api:user.get_online_users', data);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
User.go_online = function(uid) {
|
||||||
|
RDB.sadd('users:online', uid);
|
||||||
|
};
|
||||||
|
|
||||||
|
User.go_offline = function(uid) {
|
||||||
|
RDB.srem('users:online', uid);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
User.active = {
|
User.active = {
|
||||||
get_record : function(socket) {
|
get_record : function(socket) {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ var express = require('express'),
|
|||||||
case 'home' :
|
case 'home' :
|
||||||
categories.get(function(data) {
|
categories.get(function(data) {
|
||||||
res.send(JSON.stringify(data));
|
res.send(JSON.stringify(data));
|
||||||
});
|
}, (req.user) ? req.user.uid : 0);
|
||||||
break;
|
break;
|
||||||
case 'login' :
|
case 'login' :
|
||||||
var data = {},
|
var data = {},
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}),
|
|||||||
var hs = socket.handshake;
|
var hs = socket.handshake;
|
||||||
|
|
||||||
var uid = users[hs.sessionID];
|
var uid = users[hs.sessionID];
|
||||||
|
user.go_online(uid);
|
||||||
|
|
||||||
|
|
||||||
/*process.on('uncaughtException', function(err) {
|
/*process.on('uncaughtException', function(err) {
|
||||||
@@ -59,6 +60,7 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}),
|
|||||||
socket.emit('event:connect', {status: 1});
|
socket.emit('event:connect', {status: 1});
|
||||||
|
|
||||||
socket.on('disconnect', function() {
|
socket.on('disconnect', function() {
|
||||||
|
user.go_offline(uid);
|
||||||
delete users[hs.sessionID];
|
delete users[hs.sessionID];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -154,6 +156,10 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}),
|
|||||||
user.reset.commit(socket, data.code, data.password);
|
user.reset.commit(socket, data.code, data.password);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('api:user.get_online_users', function(data) {
|
||||||
|
user.get_online_users(socket, data);
|
||||||
|
});
|
||||||
|
|
||||||
socket.on('api:topics.post', function(data) {
|
socket.on('api:topics.post', function(data) {
|
||||||
topics.post(socket, uid, data.title, data.content, data.category_id);
|
topics.post(socket, uid, data.title, data.content, data.category_id);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user