Skip to content

Commit

Permalink
Preserve stats despite auth
Browse files Browse the repository at this point in the history
  • Loading branch information
danneu committed Jan 15, 2015
1 parent a7b147f commit 6cd05d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 0 additions & 3 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,6 @@ app.use(route.get('/', function*() {

// Get stats
var stats = cache.get('stats');
stats.onlineUsers = stats.onlineUsers.filter(function(user) {
return cancan.can(this.currUser, 'READ_USER_ONLINE_STATUS', user);
}, this);
stats.onlineUsers = stats.onlineUsers.map(pre.presentUser);
if (stats.latestUser)
stats.latestUser = pre.presentUser(stats.latestUser);
Expand Down
16 changes: 9 additions & 7 deletions views/homepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ <h5 class="list-group-item-heading forum-item-title">
<div class="col-xs-12">
<h4>{{ stats.onlineUsers.length }} Users Online (within 15 min)</h4>
{% for user in stats.onlineUsers %}
{% if user.is_ghost %}
<a href="{{ user.url }}" style="color: #000">{{ user.uname }}</a>
{% else %}
<a href="{{ user.url }}" style="color: #999">{{ user.uname }}</a>
{% endif %}
{% if !loop.last %}
,
{% if ctx.can(ctx.currUser, 'READ_USER_ONLINE_STATUS', user) %}
{% if user.is_ghost %}
<a href="{{ user.url }}" style="color: #000">{{ user.uname }}</a>
{% else %}
<a href="{{ user.url }}" style="color: #999">{{ user.uname }}</a>
{% endif %}
{% if !loop.last %}
,
{% endif %}
{% endif %}
{% endfor %}
</div>
Expand Down

0 comments on commit 6cd05d9

Please sign in to comment.