I am not sure what's going on anymore so I'll just commit and reset all the other...
[akkoma] / lib / pleroma / web / twitter_api / views / user_view.ex
index f460ddd80bbec5790f5873b1c8a7147d166feca5..6e489624f4c721a61a45673ad03bda94014527f7 100644 (file)
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.Web.TwitterAPI.UserView do
   use Pleroma.Web, :view
   alias Pleroma.User
@@ -78,12 +82,16 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
       "default_scope" => user.info.default_scope,
       "no_rich_text" => user.info.no_rich_text,
       "fields" => fields,
+
       # Pleroma extension
-      "tags" => user.tags
+      "pleroma" => %{
+        "confirmation_pending" => user_info.confirmation_pending,
+        "tags" => user.tags
+      }
     }
 
     if assigns[:token] do
-      Map.put(data, "token", assigns[:token])
+      Map.put(data, "token", token_string(assigns[:token]))
     else
       data
     end
@@ -108,4 +116,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
 
   defp image_url(%{"url" => [%{"href" => href} | _]}), do: href
   defp image_url(_), do: nil
+
+  defp token_string(%Pleroma.Web.OAuth.Token{token: token_str}), do: token_str
+  defp token_string(token), do: token
 end