Skip to content

Instantly share code, notes, and snippets.

@bdmac
Created January 2, 2017 22:27
Show Gist options
  • Save bdmac/deb73f1e2138b1360d73802f1af45ab0 to your computer and use it in GitHub Desktop.
Save bdmac/deb73f1e2138b1360d73802f1af45ab0 to your computer and use it in GitHub Desktop.
Online users component
import Ember from 'ember';
const { Component, inject, computed } = Ember;
export default Component.extend({
session: inject.service(),
// Get me all online users except myself
onlineUsers: computed.filter('session.currentBusiness.users.@each.online', function(user) {
return user.get('online') && user.get('id') != this.get('session.currentUser.id');
}),
anyOnline: computed.notEmpty('onlineUsers')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment