Skip to content

Instantly share code, notes, and snippets.

View kenbier's full-sized avatar

Kenneth Bier kenbier

  • Apple, Inc.
  • New York, New York
View GitHub Profile
(om/transact! reconciler `[(support-request/new ~support-request)])
@kenbier
kenbier / app.cljs
Last active December 21, 2016 00:50
(defonce app (atom nil))
(defn on-app-started [{:keys [networking initial-state] :as app}]
(let [reconciler (:reconciler app)]
(when st/airbrake-client
(.addFilter st/airbrake-client
(fn [notice]
(let [comment (some->> notice
.-errors
first
(defn with-auth-token
"Token wrapper for calls to report-center production server. Gets the
token from the url params"
[request]
(assoc-in request
[:headers "Authorization"]
(str "Bearer " (core/get-url-param "token"))))
(defn start-untangled-support-viewer
"Create and display a new untangled support viewer on the given app root, with VCR controls to browse through the given history. The support HTML file must include
(defmethod api-read :support-request
[env k {:keys [id] :as params}]
(let [{:keys [current/user blob-store]} env]
{:value (kv/fetch blob-store
(java.util.UUID/fromString id))}))
(defmethod api-mutate 'support-request/new
[{:keys [blob-store twarc-scheduler
database current/user] :as env}
q
{:keys [history comment support-id] :as params}]
{:action (fn []
(let [{:keys [db/id user/email]} user
connection (db/get-connection database)
session {:history history
:comment comment}]
(defmethod m/mutate 'support-request/new
[{:keys [ast state]} k {:keys [comment support-id]}]
{:remote (assoc ast :params {:comment comment
:support-id support-id
:history (uc/history @app/app)})})