aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorduponin <pwet@dupon.in>2022-05-22 02:39:38 +0200
committerduponin <pwet@dupon.in>2022-05-22 02:39:56 +0200
commitfffd9059d67fb719c38dc014de1fa750dd5be8b4 (patch)
tree5c6f0ec6c2e867359ec0bcfaf1048c3bc0538b38
parenta4659d993d1493406e9df4a26ada35cba50511c0 (diff)
downloadpleroma-fffd9059d67fb719c38dc014de1fa750dd5be8b4.tar.gz
BBS: add post favourite feature
-rw-r--r--lib/pleroma/bbs/handler.ex14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/pleroma/bbs/handler.ex b/lib/pleroma/bbs/handler.ex
index a8f2fd37b..631307f02 100644
--- a/lib/pleroma/bbs/handler.ex
+++ b/lib/pleroma/bbs/handler.ex
@@ -93,6 +93,7 @@ defmodule Pleroma.BBS.Handler do
IO.puts("t <id> - Show a thread from the given id")
IO.puts("n - Show notifications")
IO.puts("n read - Mark all notifactions as read")
+ IO.puts("f <id> - Favourites the post with the given id")
IO.puts("quit - Quit")
state
@@ -167,6 +168,19 @@ defmodule Pleroma.BBS.Handler do
state
end
+ def handle_command(%{user: user} = state, "f " <> id) do
+ id = String.trim(id)
+
+ with %Activity{} = activity <- Activity.get_by_id(id),
+ {:ok, _activity} <- CommonAPI.favorite(user, activity) do
+ IO.puts("Favourited!")
+ else
+ _e -> IO.puts("Could not Favourite...")
+ end
+
+ state
+ end
+
def handle_command(state, "home") do
user = state.user