about summary refs log tree commit diff
path: root/app/views
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-09 12:37:15 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-09 12:37:53 +0100
commit23ebf60b95984764992c4b356048786ed0ab2953 (patch)
treebfb92ac8a271c73986b89ea8e0b00435634f2a48 /app/views
parent2e71bb031b2dff90a2b0f9854bdcd804c069268a (diff)
Improve initialState loading
Diffstat (limited to 'app/views')
-rw-r--r--app/views/home/index.html.haml18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index 498fae105..b4e935041 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -1,4 +1,22 @@
 - content_for :header_tags do
+  :javascript
+    window.INITIAL_STATE = {
+      "meta": {
+        "access_token": "#{@token}",
+        "locale": "#{I18n.locale}",
+        "me": #{current_account.id}
+      },
+
+      "compose": {
+        "me": #{current_account.id},
+        "private": #{current_account.locked?}
+      },
+
+      "accounts": {
+        #{current_account.id}: #{render(file: 'api/v1/accounts/show', locals: { account: current_user.account }, formats: :json)}
+      }
+    };
+
   = javascript_include_tag 'application'
 
 = react_component 'Mastodon', default_props, class: 'app-holder', prerender: false