Revert "Merge branch 'streamer-refactoring' into 'develop'"
[akkoma] / lib / pleroma / bbs / handler.ex
index 7749eb3af04eaed804e4545bbefcbaefabfe0293..0a381f5920c954517b3dfdf1a31bf022cb0b4601 100644 (file)
@@ -1,16 +1,16 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.BBS.Handler do
-  @moduledoc """
-  An example implementation of `Sshd.ShellHandler`, implementing a very simple
-  Read-Eval-Loop, that does nothing.
-  """
   use Sshd.ShellHandler
-  alias Pleroma.Web.CommonAPI
-  alias Pleroma.Web.ActivityPub.ActivityPub
   alias Pleroma.Activity
+  alias Pleroma.Web.ActivityPub.ActivityPub
+  alias Pleroma.Web.CommonAPI
 
   def on_shell(username, _pubkey, _ip, _port) do
     :ok = IO.puts("Welcome to #{Pleroma.Config.get([:instance, :name])}!")
-    user = Pleroma.User.get_by_nickname(to_string(username))
+    user = Pleroma.User.get_cached_by_nickname(to_string(username))
     Logger.debug("#{inspect(user)}")
     loop(run_state(user: user))
   end
@@ -91,7 +91,7 @@ defmodule Pleroma.BBS.Handler do
 
     params =
       %{}
-      |> Map.put("type", ["Create", "Announce"])
+      |> Map.put("type", ["Create"])
       |> Map.put("blocking_user", user)
       |> Map.put("muting_user", user)
       |> Map.put("user", user)
@@ -99,8 +99,6 @@ defmodule Pleroma.BBS.Handler do
     activities =
       [user.ap_id | user.following]
       |> ActivityPub.fetch_activities(params)
-      |> ActivityPub.contain_timeline(user)
-      |> Enum.reverse()
 
     Enum.each(activities, fn activity ->
       puts_activity(activity)
@@ -109,8 +107,9 @@ defmodule Pleroma.BBS.Handler do
     state
   end
 
-  def handle_command(_state, command) do
+  def handle_command(state, command) do
     IO.puts("Unknown command '#{command}'")
+    state
   end
 
   defp wait_input(state, input) do