logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: fffd9059d67fb719c38dc014de1fa750dd5be8b4
parent a4659d993d1493406e9df4a26ada35cba50511c0
Author: duponin <pwet@dupon.in>
Date:   Sun, 22 May 2022 02:39:38 +0200

BBS: add post favourite feature

Diffstat:

Mlib/pleroma/bbs/handler.ex14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git 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