     else
       "Subscribe to receive notifications for updates to this discussion"
 
+  digestText: (category) ->
+    digest = @state["#{ category }Digest"]
+    if digest then "(#{ digest } email)" else ''
+
+  getPreferences: ->
+    talkClient.type('subscription_preferences').get().then (preferences) =>
+      newState = { }
+      for preference in preferences
+        newState.followedDigest = preference.email_digest if preference.category is 'followed_discussions'
+        newState.participatingDigest = preference.email_digest if preference.category is 'participating_discussions'
+      @setState newState
+
   getSubscriptionsFor: (id) ->
     talkClient.type('subscriptions').get
       source_id: id

          {if @state.participating
            <div>
              <button onClick={@toggleParticipating}>{ @buttonLabel() }</button>
              <p className="description">You're receiving notifications from this discussion because you've joined it</p>
            </div>
          else
            <div>
              <button onClick={@toggleFollowed}>{@buttonLabel()}</button>
              <p className="description">{@followedText()}</p>
            </div>
          }
        </div>


  getInitialState: ->
    followed: null
    followedDigest: null
    participating: false
    participatingDigest: null

  componentWillReceiveProps: (nextProps)->
    discussionId = nextProps.discussion?.id
    @getPreferences()
    @getSubscriptionsFor(discussionId) if discussionId and discussionId isnt @props.discussion?.id

  toggleFollowed: (e) ->
