allow manually unlocking party system

This commit is contained in:
Tyler Renelle
2013-03-15 18:39:39 -04:00
parent 14babdbf24
commit 545e5fc2a4
2 changed files with 12 additions and 4 deletions
+9 -2
View File
@@ -71,8 +71,7 @@ module.exports.partySubscribe = partySubscribe = (page, model, params, next, cb)
module.exports.app = (appExports, model) ->
user = model.at('_user')
user.on 'set', 'flags.partyEnabled', (captures, args) ->
return unless captures == true
unlockPartiesNotification = ->
$('.main-avatar').popover('destroy') #remove previous popovers
html = """
<div class='party-system-popover'>
@@ -89,6 +88,14 @@ module.exports.app = (appExports, model) ->
content: html
$('.main-avatar').popover 'show'
appExports.manuallyUnlockParties = ->
$("#settings-modal").modal("hide")
user.set('flags.partyEnabled', true)
unlockPartiesNotification()
user.on 'set', 'flags.partyEnabled', (captures, args) ->
unlockPartiesNotification() if captures == true
#TODO implement this when we have unsubscribe working properly
model.on 'set', '_user.party.invitation', (after, before) ->
if !before? and after? # they just got invited