filter invalid messages

This commit is contained in:
alsotang 2014-07-04 18:00:48 +08:00
parent 72ef6d4609
commit 30c7a6bd99
2 changed files with 9 additions and 6 deletions

View File

@ -19,6 +19,9 @@ exports.index = function (req, res, next) {
var epfill = new eventproxy();
epfill.fail(next);
epfill.after('message_ready', msgs.length, function (docs) {
docs.filter(function (doc) {
return !doc.is_invalid;
});
ep.emit(idx === 0 ? 'has_read_messages' : 'hasnot_read_messages', docs);
});
msgs.forEach(function (doc) {

View File

@ -5,23 +5,23 @@
<% } %>
<% if(message.type == 'reply'){ %>
<span>
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
回复了你的话题
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
回复了你的话题
<a href="/topic/<%- message.topic._id + (message.reply ? '#' + message.reply._id : '') %>" target='_blank'><%= message.topic.title %></a>
</span>
<% } %>
<% if(message.type == 'reply2'){ %>
<span>
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
在话题
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
在话题
<a href="/topic/<%= message.topic._id + (message.reply ? '#' + message.reply._id : '') %>" target='_blank'><%= message.topic.title %></a>
中回复了你的回复
</span>
<% } %>
<% if(message.type == 'follow'){ %>
<span>
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
关注了你
<a href="/user/<%= message.author.name %>" target='_blank'><%= message.author.name %></a>
关注了你
</span>
<% } %>
<% if (message.type == 'at'){ %>