Users = new Meteor.Collection 'users' | |
currentUser = -> | |
Users.findOne Session.get 'user_id' | |
if Meteor.is_client | |
Meteor.startup = -> | |
Meteor.autosubscribe = -> | |
Meteor.subscribe 'users' | |
Template.users_to_interrupt.users = -> | |
usersint = Session.get 'users_to_interrupt' | |
if usersint | |
Users.find { username: { $in: (usersint || []) } } | |
Template.add_user.events | |
'click button.add': -> | |
username = $('#add_username').val() | |
$('#add_username').val('') | |
console.log "got username '#{username}' in add user textfield" | |
array = Session.get('users_to_interrupt') || [] # if we do Session.get here it screws up notifying on Session.set later! must get the value otherwise somehow | |
# array = [] # just adding an empty array and pushing username to it works, and updates "users" reactively | |
array.push(username) | |
Session.set 'users_to_interrupt', array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment