       (dom/div #js {:className "thread"}
         (dom/div #js {:className "close"
                       :onClick (fn [_]
-                                 (dispatch! :close-thread {:thread-id (thread :id)}))} "×")
+                                 (dispatch! :hide-thread {:thread-id (thread :id)}))} "×")
         (apply dom/div #js {:className "messages"}
           (om/build-all message-view (thread :messages)))
         (om/build new-message-view {:thread-id (thread :id) :placeholder "Reply..."})))))

                                         :user-id (get-in @app-state [:session :user-id])
                                         :created-at (js/Date.)}))))

(defmethod dispatch! :close-thread [_ data]
  (transact! [:threads (data :thread-id)] #(assoc % :closed true)))

(defn message-view [message owner]
  (reify

  (reify
    om/IRender
    (render [_]
      (let [remove-keys (fn [ks coll]
                          (apply dissoc coll ks))
            threads (->> (data :messages)
                         vals
                         (sort-by :created-at)
                         (group-by :thread-id)
                         (remove-keys (get-in data [:users (get-in data [:session :user-id]) :hidden-thread-ids]))
                         (map (fn [[id ms]] {:id id
                                             :messages ms})))]
        (dom/div nil
          (apply dom/div nil
            (concat (om/build-all thread-view threads)
