diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-08-07 01:06:23 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-08-07 01:08:34 -0500 |
commit | a8475313b8e81f1e91ee446599a9b7b78716f30c (patch) | |
tree | 1fc56b242b9bbb304aa934a13be80f9364859d55 /app | |
parent | d9a8c50f9279a40c42ed9a8d3f4c8f11313046e2 (diff) |
add ability to post as linked account without switching using `once:i:am`/`once:we:are` bangtag
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/bangtags.rb | 12 |
1 files changed, 11 insertions, 1 deletions
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 |