HackerExperience / Helix

GNU Affero General Public License v3.0
53 stars 10 forks source link

Changes required for emails #368

Closed PedroHLC closed 6 years ago

PedroHLC commented 6 years ago
diff --git a/lib/server/public/index.ex b/lib/server/public/index.ex
index 7357637f..e7bef92e 100644
--- a/lib/server/public/index.ex
+++ b/lib/server/public/index.ex
@@ -234,7 +234,8 @@ defmodule Helix.Server.Public.Index do
     index = %{
       password: server.password,
       name: server.hostname,
-      hardware: HardwareIndex.index(server, :local)
+      hardware: HardwareIndex.index(server, :local),
+      type: server.type
     }

     Map.merge(server_common(server, entity_id), index)
@@ -249,7 +250,8 @@ defmodule Helix.Server.Public.Index do
     partial =
       %{
         password: server.password,
-        name: server.name
+        name: server.name,
+        server_type: to_string(server.type)
       }

     Map.merge(partial, render_server_common(server))
diff --git a/lib/story/public/index.ex b/lib/story/public/index.ex
index fb9cdb5c..fe037091 100644
--- a/lib/story/public/index.ex
+++ b/lib/story/public/index.ex
@@ -69,7 +69,8 @@ defmodule Helix.Story.Public.Index do
       Enum.map(index.email, fn entry ->
         %{
           contact_id: to_string(entry.contact_id),
-          messages: render_messages(entry.messages)
+          messages: render_messages(entry.messages),
+          replies: [] # TODO
         }
       end)

@@ -99,6 +100,7 @@ defmodule Helix.Story.Public.Index do
     }                                                                                       
   end                                                                                       

+  alias HELL.ClientUtils                                                                    
   @spec render_message(message) ::                                                          
     rendered_message                                                                        
   def render_message(message) do                                                            
@@ -106,7 +108,7 @@ defmodule Helix.Story.Public.Index do                                    
       id: message.id,                                                                       
       meta: message.meta,                                                                   
       sender: to_string(message.sender),                                                    
-      timestamp: to_string(message.timestamp)                                               
+      timestamp: ClientUtils.to_timestamp(message.timestamp)                                
     }                                                                                       
   end                                                                                       
 end