diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-10-05 15:23:57 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-10-05 15:23:57 +0200 |
commit | 00fcdebed758f031b486ec239fd425fc54a180b3 (patch) | |
tree | 1211e136ba3e886ee8daaa5200babffc42375dd1 /lib | |
parent | a9e8f98a9d32c57956d41009bd09a1f33310676e (diff) | |
parent | 028ad4124cf1fdb28f5cf11bd7080e7a63f2f99e (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: db/migrate/20170716191202_add_hide_notifications_to_mute.rb spec/controllers/application_controller_spec.rb Took our version, upstream changes were only minor style linting.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cli.rb | 4 | ||||
-rw-r--r-- | lib/mastodon/settings_cli.rb | 26 | ||||
-rw-r--r-- | lib/tasks/mastodon.rake | 25 |
3 files changed, 30 insertions, 25 deletions
diff --git a/lib/cli.rb b/lib/cli.rb index 14a91c2db..208df660f 100644 --- a/lib/cli.rb +++ b/lib/cli.rb @@ -5,6 +5,7 @@ require_relative 'mastodon/media_cli' require_relative 'mastodon/emoji_cli' require_relative 'mastodon/accounts_cli' require_relative 'mastodon/feeds_cli' +require_relative 'mastodon/settings_cli' module Mastodon class CLI < Thor @@ -19,5 +20,8 @@ module Mastodon desc 'feeds SUBCOMMAND ...ARGS', 'Manage feeds' subcommand 'feeds', Mastodon::FeedsCLI + + desc 'settings SUBCOMMAND ...ARGS', 'Manage dynamic settings' + subcommand 'settings', Mastodon::SettingsCLI end end diff --git a/lib/mastodon/settings_cli.rb b/lib/mastodon/settings_cli.rb new file mode 100644 index 000000000..87c321013 --- /dev/null +++ b/lib/mastodon/settings_cli.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require_relative '../../config/boot' +require_relative '../../config/environment' +require_relative 'cli_helper' + +module Mastodon + class RegistrationsCLI < Thor + desc 'open', 'Open registrations' + def open + Setting.open_registrations = true + say('OK', :green) + end + + desc 'close', 'Close registrations' + def close + Setting.open_registrations = false + say('OK', :green) + end + end + + class SettingsCLI < Thor + desc 'registrations SUBCOMMAND ...ARGS', 'Manage state of registrations' + subcommand 'registrations', RegistrationsCLI + end +end diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index ec8800819..ee9657b0e 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'optparse' -require 'colorize' require 'tty-command' require 'tty-prompt' @@ -390,25 +388,6 @@ namespace :mastodon do end end - namespace :push do - desc 'Unsubscribes from PuSH updates of feeds nobody follows locally' - task clear: :environment do - Pubsubhubbub::UnsubscribeWorker.push_bulk(Account.remote.without_followers.where.not(subscription_expires_at: nil).pluck(:id)) - end - end - - namespace :settings do - desc 'Open registrations on this instance' - task open_registrations: :environment do - Setting.open_registrations = true - end - - desc 'Close registrations on this instance' - task close_registrations: :environment do - Setting.open_registrations = false - end - end - namespace :webpush do desc 'Generate VAPID key' task generate_vapid_key: :environment do @@ -427,7 +406,3 @@ def disable_log_stdout! HttpLog.configuration.logger = dev_null Paperclip.options[:log] = false end - -def prepare_for_options! - 2.times { ARGV.shift } -end |