diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-07-31 10:58:52 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:45:16 -0500 |
commit | d9339677d6daa33dc020cf3400c3dec210b06f31 (patch) | |
tree | 38de2c33e4f61df299348b89da2e9c8600d78247 /app/lib/command_tag/commands/status_tools.rb | |
parent | 4c47a96f67d303dec7b6047474380050053ac3d7 (diff) |
[Command Tags] Add support for persistent variables
Diffstat (limited to 'app/lib/command_tag/commands/status_tools.rb')
-rw-r--r-- | app/lib/command_tag/commands/status_tools.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/app/lib/command_tag/commands/status_tools.rb b/app/lib/command_tag/commands/status_tools.rb deleted file mode 100644 index d00efe054..000000000 --- a/app/lib/command_tag/commands/status_tools.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true -module CommandTag::Commands::StatusTools - def handle_title_before_save(args) - return unless author_of_status? - - @status.title = args[0] - end - - def handle_visibility_before_save(args) - return unless author_of_status? && args[0].present? - - args[0] = read_visibility_from(args[0]) - return if args[0].blank? - - if args[1].blank? - @status.visibility = args[0].to_sym - elsif args[0] == @status.visibility.to_s - domains = args[1..-1].map { |domain| normalize_domain(domain) unless domain == '*' }.uniq.compact - @status.domain_permissions.where(domain: domains).destroy_all if domains.present? - else - args[1..-1].flat_map(&:split).uniq.each do |domain| - domain = normalize_domain(domain) unless domain == '*' - @status.domain_permissions.create_or_update(domain: domain, visibility: args[0]) if domain.present? - end - end - end - - alias handle_v_before_save handle_visibility_before_save - alias handle_p_before_save handle_visibility_before_save - alias handle_privacy_before_save handle_visibility_before_save -end |