 (s/def ::response (s/keys :req-un [::bubbles]
                           :opt-un [::attitudes ::attacks ::items]))
 
-(s/fdef process-discussion-step
+(s/fdef process-and-set-items-and-bubbles
         :args (s/cat :response ::response))

         :params        params
         :error-handler error-handler}))
  ([url headers handler] (ajax-get url headers handler nil))
  ([url headers] (ajax-get url headers process-discussion-step))
  ([url] (ajax-get url (token-header))))

(defn ajax-get-and-change-view

  (when (lib/logged-in?)
    {"X-Authentication" (lib/clj->json {:type "user" :nickname (lib/get-nickname) :token (lib/get-token)})}))

(defn process-and-set-items-and-bubbles
  "Receive response and prepare UI with the new items and bubbles for the next
  step in the discussion."
  [response]
  (let [{:keys [bubbles attitudes items attacks]} (lib/process-response response)
        update-items (cond
                       (seq items) items
                       (seq attacks) (vals attacks)
                       (seq attitudes) (vals attitudes)
                       :default [])]
    (om/transact! parser/reconciler `[(discussion/bubbles {:value ~bubbles})
                                      (discussion/items {:value ~update-items})])))

;;;; Handlers
(defn error-handler
