 $(document).on 'click focus keypress', (e) ->
   # originalEvent is defined only for native events, but we are triggering
   # click manually as well, so originalEvent is not always defined
-  Session.set 'newsletterActive', false unless e.originalEvent?.newsletterDialogBoxEvent
-  Session.set 'inviteDialogActive', false unless e.originalEvent?.inviteDialogBoxEvent
+  (Session.set variable, false for variable in ['newsletterActive', 'inviteDialogActive']) unless e.originalEvent?.dialogBoxEvent
 
   return # Make sure CoffeeScript does not return anything
 

    e.preventDefault()
    Session.set 'newsletterActive', true
    Session.set 'newsletterError', null
    $(template.findAll '#newsletter-dialog-email').val(Meteor.user()?.emails?[0]?.address or '')

    Meteor.setTimeout =>
      $(template.findAll '#newsletter-dialog-email').focus()

    return # Make sure CoffeeScript does not return anything

  'click .newsletter, focus .newsletter, keypress .newsletter': (e, template) ->
    e.dialogBoxEvent = true
    return # Make sure CoffeeScript does not return anything

Template.newsletter.displayed = ->
