                      :type            "radio"
                      :on-change       #(do
                                          (set-visibility "internal" state)
-                                         (save-settings state init-data))
+                                         (save-settings state init-data "share"))
                      :default-checked (= "internal" (get-in @state [:badge-settings :visibility]))}]
        [:i {:class "fa fa-group" }]
        [:label {:for "visibility-internal"}

                     :type            "radio"
                     :on-change       #(do
                                         (set-visibility "private" state)
                                         (save-settings state init-data))
                     :default-checked (= "private" (get-in @state [:badge-settings :visibility]))}]
       [:i {:class "fa fa-lock" }]
       [:label {:for "visibility-private"}

     :handler (fn []
                (init-data state id (:tab-no @state)))}))

(defn update-settings [badge-id state]
  (ajax/GET
    (path-for (str "/obpv1/badge/settings/" badge-id) true)
    {:handler (fn [data]
                (swap! state assoc :badge-settings data (assoc data :new-tag "")))}))


(defn save-settings [state init-data context]
  (let [{:keys [id visibility tags rating evidence_url]} (:badge-settings @state)]
    (ajax/POST
      (path-for (str "/obpv1/badge/save_settings/" id))
