Added copying mentions from reply status

This commit is contained in:
localhost_frssoft 2022-04-17 03:06:20 +03:00
parent 1e47b96cb5
commit 09922423bf
2 changed files with 16 additions and 2 deletions

View File

@ -9,6 +9,7 @@
"statuses_separator": "\n==========",
"reversed_statuses": false,
"quoting_reply": true,
"copy_mentions": true,
"public_list_instances": [
"outerheaven.club",
"stereophonic.space",

View File

@ -14,6 +14,7 @@ boost_symbol=$(jj -i config.json boost_symbol)
statuses_separator=$(jj -i config.json statuses_separator)
reversed_statuses=$(jj -i config.json reversed_statuses)
quoting_reply=$(jj -i config.json quoting_reply)
copy_mentions=$(jj -i config.json copy_mentions)
#[AUTH SECTION]
mkdir -m 711 -p .app_sessions
@ -477,9 +478,13 @@ reply_mode()
{
echo 'Input id'
read status_id
reply_status=$(status_api_one $status_id)
if [ "$quoting_reply" = 'true' ]; then
status_api_one $status_id | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md
echo "$reply_status" | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md
fi
if [ "$copy_mentions" = 'true' ]; then
mentions_reply=$(echo "$reply_status" | jj -l 'mentions.#.acct' | delq | legacy_addr_preprocess | tr '\n' ',' | sed 's/,$//g')
fi
write_status_menu $status_id
}
@ -550,6 +555,7 @@ write_api_status()
--data-urlencode "visibility=$status_visibility" \
--data-urlencode "in_reply_to_id=$replyto" \
--data-urlencode "media_ids[]=$media" \
--data-urlencode "to[]=$mentions_reply" \
--output /dev/null
echo $http_code
else
@ -558,6 +564,7 @@ write_api_status()
--data-urlencode "content_type=$content_type" \
--data-urlencode "visibility=$status_visibility" \
--data-urlencode "in_reply_to_id=$replyto" \
--data-urlencode "to[]=$mentions_reply" \
--output /dev/null
echo $http_code
fi
@ -592,6 +599,9 @@ write_status_menu()
echo "Chars: $(cat tmp_status.md | wc -m)"
echo "Visiblity: $status_visibility"
echo "Content type: $content_type"
if [ -n "$mentions_reply" ]; then
echo "Mentions: $mentions_reply"
fi
if [ -n "$replyto" ]; then
echo "Reply to: $replyto"
fi
@ -613,7 +623,10 @@ write_status_menu()
"Visiblity")
status_visibility=$(echo 'public\nunlisted\nlocal\nprivate\ndirect\nlist' | fzy)
;;
"Reset") echo > tmp_status.md ;;
"Reset")
echo > tmp_status.md
mentions_reply=
;;
"Back") sub_menu_lvl=$(expr $level - 1) ;;
"Main menu") sub_menu_lvl=0 ;;
esac