about summary refs log tree commit diff
path: root/app/lib/command_tag
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-28 10:03:00 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:16 -0500
commitaa9d09215480d2376d6425b8518092dd4644f5ae (patch)
treea2b32fca181a33839bc40e524c3edb901201f616 /app/lib/command_tag
parent8ce1fd6edb8e5dc1335cdac6c46711441220dbf7 (diff)
[Privacy] Add support for matching unmatched domains with * glob in per-domain permissions
Diffstat (limited to 'app/lib/command_tag')
-rw-r--r--app/lib/command_tag/commands/account_tools.rb4
-rw-r--r--app/lib/command_tag/commands/status_tools.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/lib/command_tag/commands/account_tools.rb b/app/lib/command_tag/commands/account_tools.rb
index 3d9fb6d4e..dd7fd0229 100644
--- a/app/lib/command_tag/commands/account_tools.rb
+++ b/app/lib/command_tag/commands/account_tools.rb
@@ -24,11 +24,11 @@ module CommandTag::Commands::AccountTools
       if args[2].blank?
         @account.user.settings.default_privacy = args[1]
       elsif args[1] == 'public'
-        domains = args[2..-1].map { |domain| normalize_domain(domain) }.uniq.compact
+        domains = args[2..-1].map { |domain| normalize_domain(domain) unless domain == '*' }.uniq.compact
         @account.domain_permissions.where(domain: domains).destroy_all if domains.present?
       else
         args[2..-1].flat_map(&:split).uniq.each do |domain|
-          domain = normalize_domain(domain)
+          domain = normalize_domain(domain) unless domain == '*'
           @account.domain_permissions.create_or_update(domain: domain, visibility: args[1]) if domain.present?
         end
       end
diff --git a/app/lib/command_tag/commands/status_tools.rb b/app/lib/command_tag/commands/status_tools.rb
index 23bdcbfc3..7eaeddbea 100644
--- a/app/lib/command_tag/commands/status_tools.rb
+++ b/app/lib/command_tag/commands/status_tools.rb
@@ -15,11 +15,11 @@ module CommandTag::Commands::StatusTools
     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) }.uniq.compact
+      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)
+        domain = normalize_domain(domain) unless domain == '*'
         @status.domain_permissions.create_or_update(domain: domain, visibility: args[0]) if domain.present?
       end
     end