fix format
authorMaksim Pechnikov <parallel588@gmail.com>
Thu, 31 Oct 2019 14:36:59 +0000 (17:36 +0300)
committerMaksim Pechnikov <parallel588@gmail.com>
Thu, 31 Oct 2019 14:38:12 +0000 (17:38 +0300)
lib/mix/tasks/pleroma/marker.ex
test/web/mastodon_api/controllers/marker_controller_test.exs

index 1d5be11dea02f7281bc2c46f5c0544056b832b58..bebef0d6a3125098c48ffd471a64471a22645638 100644 (file)
@@ -1,10 +1,10 @@
 defmodule Mix.Tasks.Pleroma.Marker do
   use Mix.Task
   import Mix.Pleroma
-
   import Ecto.Query
-  alias Pleroma.Repo
+
   alias Pleroma.Notification
+  alias Pleroma.Repo
 
   def run(["update_markers"]) do
     start_pleroma()
@@ -15,7 +15,7 @@ defmodule Mix.Tasks.Pleroma.Marker do
         user_id: q.user_id,
         unread_count: fragment("SUM( CASE WHEN seen = false THEN 1 ELSE 0 END )"),
         last_read_id:
-        type(fragment("MAX( CASE WHEN seen = true THEN id ELSE null END )"), :string)
+          type(fragment("MAX( CASE WHEN seen = true THEN id ELSE null END )"), :string)
       },
       group_by: [q.user_id]
     )
@@ -26,8 +26,8 @@ defmodule Mix.Tasks.Pleroma.Marker do
       |> Ecto.Changeset.change()
       |> Pleroma.Repo.insert(
         returning: true,
-      on_conflict: {:replace, [:last_read_id, :unread_count]},
-      conflict_target: [:user_id, :timeline]
+        on_conflict: {:replace, [:last_read_id, :unread_count]},
+        conflict_target: [:user_id, :timeline]
       )
     end)
 
index e0aacccb47c84fdc08106567460430323f4b7ea2..8bcfcb7e1303f3ef205906314a187477e7a8cd7b 100644 (file)
@@ -26,13 +26,13 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
         |> json_response(200)
 
       assert response == %{
-        "notifications" => %{
-          "last_read_id" => "69420",
-          "updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
-          "version" => 0,
-          "pleroma" => %{ "unread_count" => 7 }
-        }
-      }
+               "notifications" => %{
+                 "last_read_id" => "69420",
+                 "updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
+                 "version" => 0,
+                 "pleroma" => %{"unread_count" => 7}
+               }
+             }
     end
 
     test "gets markers with missed scopes", %{conn: conn} do
@@ -72,7 +72,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
                  "last_read_id" => "69420",
                  "updated_at" => _,
                  "version" => 0,
-                 "pleroma" => %{ "unread_count" => 0 }
+                 "pleroma" => %{"unread_count" => 0}
                }
              } = response
     end
@@ -102,7 +102,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
                  "last_read_id" => "69888",
                  "updated_at" => NaiveDateTime.to_iso8601(marker.updated_at),
                  "version" => 0,
-                 "pleroma" => %{ "unread_count" => 0 }
+                 "pleroma" => %{"unread_count" => 0}
                }
              }
     end