From a8475313b8e81f1e91ee446599a9b7b78716f30c Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Wed, 7 Aug 2019 01:06:23 -0500 Subject: [PATCH] add ability to post as linked account without switching using `once:i:am`/`once:we:are` bangtag --- app/lib/bangtags.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index c89146035..3934e5bb1 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -491,7 +491,11 @@ class Bangtags end else who = cmd[0] - next if switch_account(who.strip) + if @once + next if post_as(who.strip) + else + next if switch_account(who.strip) + end name = who.downcase.gsub(/\s+/, '').strip description = cmd[1..-1].join(':').strip if description.blank? @@ -1017,6 +1021,12 @@ class Bangtags true end + def post_as(target_acct) + target_acct = Account.find_local(target_acct) + return false unless target_acct&.user.present? && target_acct.user.in?(@user.linked_users) + status.account_id = target_acct.id + end + def html_entities @html_entities ||= HTMLEntities.new end