From e6814a332c3b355893d366cf8639ab3c7e30b52b Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Thu, 4 Apr 2019 09:46:27 -0500 Subject: Fix `tootctl accounts cull` (#10460) * List the actual accounts that would have been culled during a dry run. Otherwise, the dry run mode is basically useless. * Prevent unreachable domains from inheriting the previous status code. * Update CHANGELOG.md for #10460. --- lib/mastodon/accounts_cli.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index f02b2149b..41e902e8f 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -219,12 +219,14 @@ module Mastodon def cull skip_threshold = 7.days.ago culled = 0 + dry_run_culled = [] skip_domains = Set.new dry_run = options[:dry_run] ? ' (DRY RUN)' : '' Account.remote.where(protocol: :activitypub).partitioned.find_each do |account| next if account.updated_at >= skip_threshold || (account.last_webfingered_at.present? && account.last_webfingered_at >= skip_threshold) + code = 0 unless skip_domains.include?(account.domain) begin code = Request.new(:head, account.uri).perform(&:code) @@ -236,7 +238,11 @@ module Mastodon end if [404, 410].include?(code) - SuspendAccountService.new.call(account, destroy: true) unless options[:dry_run] + if options[:dry_run] + dry_run_culled << account.acct + else + SuspendAccountService.new.call(account, destroy: true) + end culled += 1 say('+', :green, false) else @@ -252,6 +258,11 @@ module Mastodon say('The following servers were not available during the check:', :yellow) skip_domains.each { |domain| say(' ' + domain) } end + + unless dry_run_culled.empty? + say('The following accounts would have been deleted:', :green) + dry_run_culled.each { |account| say(' ' + account) } + end end option :all, type: :boolean -- cgit From e007c7a99b2ef9903a3aad5ff67902e9fd10b232 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 6 Apr 2019 04:47:05 +0200 Subject: Add `tootctl accounts approve` (#10480) --- lib/mastodon/accounts_cli.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lib') diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index 41e902e8f..9b25a2ef7 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -367,6 +367,37 @@ module Mastodon say("OK, unfollowed target from #{processed} accounts, skipped #{failed}", :green) end + option :number, type: :numeric, aliases: [:n] + option :all, type: :boolean + desc 'approve [USERNAME]', 'Approve pending accounts' + long_desc <<~LONG_DESC + When registrations require review from staff, approve pending accounts, + either all of them with the --all option, or a specific number of them + specified with the --number (-n) option, or only a single specific + account identified by its username. + LONG_DESC + def approve(username = nil) + if options[:all] + User.pending.find_each(&:approve!) + say('OK', :green) + elsif options[:number] + User.pending.limit(options[:number]).each(&:approve!) + say('OK', :green) + elsif username.present? + account = Account.find_local(username) + + if account.nil? + say('No such account', :red) + exit(1) + end + + account.user&.approve! + say('OK', :green) + else + exit(1) + end + end + private def rotate_keys_for_account(account, delay = 0) -- cgit From 6689e572f308933742e0df6f55e2ac81ca178865 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 6 Apr 2019 04:47:16 +0200 Subject: Add `tootctl emoji purge` (#10481) Fix #10441 --- lib/mastodon/emoji_cli.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') diff --git a/lib/mastodon/emoji_cli.rb b/lib/mastodon/emoji_cli.rb index 2262040d4..32827dd45 100644 --- a/lib/mastodon/emoji_cli.rb +++ b/lib/mastodon/emoji_cli.rb @@ -66,6 +66,12 @@ module Mastodon say("Imported #{imported}, skipped #{skipped}, failed to import #{failed}", color(imported, skipped, failed)) end + desc 'purge', 'Remove all custom emoji' + def purge + CustomEmoji.in_batches.destroy_all + say('OK', :green) + end + private def color(green, _yellow, red) -- cgit From 20d301c383c0789ec192a2c86f2df4464c99f457 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 6 Apr 2019 04:47:26 +0200 Subject: Fix missing long description on `tootctl statuses remove` (#10482) --- lib/mastodon/statuses_cli.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mastodon/statuses_cli.rb b/lib/mastodon/statuses_cli.rb index 5881ba260..7f2fbfa85 100644 --- a/lib/mastodon/statuses_cli.rb +++ b/lib/mastodon/statuses_cli.rb @@ -13,7 +13,15 @@ module Mastodon end option :days, type: :numeric, default: 90 - desc 'remove', 'Remove statuses' + desc 'remove', 'Remove unreferenced statuses' + long_desc <<~LONG_DESC + Remove statuses that are not referenced by local user activity, such as + ones that came from relays, or belonging to users that were once followed + by someone locally but no longer are. + + This is a computationally heavy procedure that creates extra database + indicides before commencing, and removes them afterward. + LONG_DESC def remove say('Creating temporary database indices...') -- cgit From 08ba69b53869256098d09dacdced2b3d1c500471 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Mon, 8 Apr 2019 14:46:55 +0900 Subject: Add `tootctl accounts reset-relationships` (#10483) * Add `tootctl accounts reset` * Rename reset to reset-relationships * Improve command description --- lib/mastodon/accounts_cli.rb | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'lib') diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index 9b25a2ef7..9dc84f1b5 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -367,6 +367,73 @@ module Mastodon say("OK, unfollowed target from #{processed} accounts, skipped #{failed}", :green) end + option :follows, type: :boolean, default: false + option :followers, type: :boolean, default: false + desc 'reset-relationships USERNAME', 'Reset all follows and/or followers for a user' + long_desc <<-LONG_DESC + Reset all follows and/or followers for a user specified by USERNAME. + + With the --follows option, the command unfollows everyone that the account follows, + and then re-follows the users that would be followed by a brand new account. + + With the --followers option, the command removes all followers of the account. + LONG_DESC + def reset_relationships(username) + unless options[:follows] || options[:followers] + say('Please specify either --follows or --followers, or both', :red) + exit(1) + end + + account = Account.find_local(username) + + if account.nil? + say('No user with such username', :red) + exit(1) + end + + if options[:follows] + processed = 0 + failed = 0 + + say("Unfollowing #{account.username}'s followees, this might take a while...") + + Account.where(id: ::Follow.where(account: account).select(:target_account_id)).find_each do |target_account| + begin + UnfollowService.new.call(account, target_account) + processed += 1 + say('.', :green, false) + rescue StandardError + failed += 1 + say('.', :red, false) + end + end + + BootstrapTimelineWorker.perform_async(account.id) + + say("OK, unfollowed #{processed} followees, skipped #{failed}", :green) + end + + if options[:followers] + processed = 0 + failed = 0 + + say("Removing #{account.username}'s followers, this might take a while...") + + Account.where(id: ::Follow.where(target_account: account).select(:account_id)).find_each do |target_account| + begin + UnfollowService.new.call(target_account, account) + processed += 1 + say('.', :green, false) + rescue StandardError + failed += 1 + say('.', :red, false) + end + end + + say("OK, removed #{processed} followers, skipped #{failed}", :green) + end + end + option :number, type: :numeric, aliases: [:n] option :all, type: :boolean desc 'approve [USERNAME]', 'Approve pending accounts' -- cgit From c03f926cf373d68922ea3d3324263d38355befd9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 9 Apr 2019 05:04:11 +0200 Subject: Bump version to 2.8.0rc2 (#10501) --- CHANGELOG.md | 11 +++++++++-- lib/mastodon/version.rb | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/CHANGELOG.md b/CHANGELOG.md index 8670c2658..6e163bee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,14 +11,14 @@ All notable changes to this project will be documented in this file. - Add identity proof integration with Keybase ([Gargron](https://github.com/tootsuite/mastodon/pull/10297), [xgess](https://github.com/tootsuite/mastodon/pull/10375), [Gargron](https://github.com/tootsuite/mastodon/pull/10338), [Gargron](https://github.com/tootsuite/mastodon/pull/10350), [Gargron](https://github.com/tootsuite/mastodon/pull/10414)) - Add option to overwrite imported data instead of merging ([Gargron](https://github.com/tootsuite/mastodon/pull/9962)) - Add featured hashtags to profiles ([Gargron](https://github.com/tootsuite/mastodon/pull/9755), [Gargron](https://github.com/tootsuite/mastodon/pull/10167), [Gargron](https://github.com/tootsuite/mastodon/pull/10249), [ThibG](https://github.com/tootsuite/mastodon/pull/10034)) -- Add admission-based registrations mode ([Gargron](https://github.com/tootsuite/mastodon/pull/10250), [ThibG](https://github.com/tootsuite/mastodon/pull/10269), [Gargron](https://github.com/tootsuite/mastodon/pull/10264), [ThibG](https://github.com/tootsuite/mastodon/pull/10321), [Gargron](https://github.com/tootsuite/mastodon/pull/10349)) +- Add admission-based registrations mode ([Gargron](https://github.com/tootsuite/mastodon/pull/10250), [ThibG](https://github.com/tootsuite/mastodon/pull/10269), [Gargron](https://github.com/tootsuite/mastodon/pull/10264), [ThibG](https://github.com/tootsuite/mastodon/pull/10321), [Gargron](https://github.com/tootsuite/mastodon/pull/10349), [Gargron](https://github.com/tootsuite/mastodon/pull/10469)) - Add support for WebP uploads ([acid-chicken](https://github.com/tootsuite/mastodon/pull/9879)) - Add "copy link" item to status action bars in web UI ([Gargron](https://github.com/tootsuite/mastodon/pull/9983)) - Add list title editing in web UI ([ThibG](https://github.com/tootsuite/mastodon/pull/9748)) - Add a "Block & Report" button to the block confirmation dialog in web UI ([ThibG](https://github.com/tootsuite/mastodon/pull/10360)) - Add disappointed elephant when the page crashes in web UI ([Gargron](https://github.com/tootsuite/mastodon/pull/10275)) - Add ability to upload multiple files at once in web UI ([tmm576](https://github.com/tootsuite/mastodon/pull/9856)) -- Add indication that you have been blocked when viewing profiles in web UI ([Gargron](https://github.com/tootsuite/mastodon/pull/10420)) +- Add indication when you are not allowed to follow an account in web UI ([Gargron](https://github.com/tootsuite/mastodon/pull/10420), [Gargron](https://github.com/tootsuite/mastodon/pull/10491)) - Add validations to admin settings to catch common mistakes ([Gargron](https://github.com/tootsuite/mastodon/pull/10348), [ThibG](https://github.com/tootsuite/mastodon/pull/10354)) - Add `type`, `limit`, `offset`, `min_id`, `max_id`, `account_id` to search API ([Gargron](https://github.com/tootsuite/mastodon/pull/10091)) - Add a preferences API so apps can share basic behaviours ([Gargron](https://github.com/tootsuite/mastodon/pull/10109)) @@ -32,6 +32,10 @@ All notable changes to this project will be documented in this file. - Add `DB_SSLMODE` configuration variable ([sascha-sl](https://github.com/tootsuite/mastodon/pull/10210)) - Add click-to-copy UI to invites page ([Gargron](https://github.com/tootsuite/mastodon/pull/10259)) - Add self-replies fetching ([ThibG](https://github.com/tootsuite/mastodon/pull/10106), [ThibG](https://github.com/tootsuite/mastodon/pull/10128), [ThibG](https://github.com/tootsuite/mastodon/pull/10175), [ThibG](https://github.com/tootsuite/mastodon/pull/10201)) +- Add rate limit for media proxy requests ([Gargron](https://github.com/tootsuite/mastodon/pull/10490)) +- Add `tootctl emoji purge` ([Gargron](https://github.com/tootsuite/mastodon/pull/10481)) +- Add `tootctl accounts approve` ([Gargron](https://github.com/tootsuite/mastodon/pull/10480)) +- Add `tootctl accounts reset-relationships` ([noellabo](https://github.com/tootsuite/mastodon/pull/10483)) ### Changed @@ -51,6 +55,9 @@ All notable changes to this project will be documented in this file. - Change web UI to use new Web Share Target API ([gol-cha](https://github.com/tootsuite/mastodon/pull/9963)) - Change ActivityPub reports to have persistent URIs ([ThibG](https://github.com/tootsuite/mastodon/pull/10303)) - Change `tootctl accounts cull --dry-run` to list accounts that would be deleted ([BenLubar](https://github.com/tootsuite/mastodon/pull/10460)) +- Change format of CSV exports of follows and mutes to include extra settings ([ThibG](https://github.com/tootsuite/mastodon/pull/10495), [ThibG](https://github.com/tootsuite/mastodon/pull/10335)) +- Change ActivityPub collections to be cacheable by proxies ([ThibG](https://github.com/tootsuite/mastodon/pull/10467)) +- Change REST API and public profiles to not return follows/followers for users that have blocked you ([Gargron](https://github.com/tootsuite/mastodon/pull/10491)) ### Removed diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index d6114320e..859850d15 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -21,7 +21,7 @@ module Mastodon end def flags - 'rc1' + 'rc2' end def to_a -- cgit From 830c2a9ccbe98e145640e12637ef3da56f41a7b5 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 10 Apr 2019 04:25:09 +0200 Subject: Bump version to 2.8.0rc3 (#10535) --- CHANGELOG.md | 1 + lib/mastodon/version.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e163bee2..120ec7407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ All notable changes to this project will be documented in this file. - Change format of CSV exports of follows and mutes to include extra settings ([ThibG](https://github.com/tootsuite/mastodon/pull/10495), [ThibG](https://github.com/tootsuite/mastodon/pull/10335)) - Change ActivityPub collections to be cacheable by proxies ([ThibG](https://github.com/tootsuite/mastodon/pull/10467)) - Change REST API and public profiles to not return follows/followers for users that have blocked you ([Gargron](https://github.com/tootsuite/mastodon/pull/10491)) +- Change the groupings of menu items in settings navigation ([Gargron](https://github.com/tootsuite/mastodon/pull/10533)) ### Removed diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 859850d15..bc27d06ea 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -21,7 +21,7 @@ module Mastodon end def flags - 'rc2' + 'rc3' end def to_a -- cgit From 6afab2587de40d403e64724f6ae688b180de25d4 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 10 Apr 2019 23:32:08 +0200 Subject: Bump version to 2.8.0 (#10550) --- CHANGELOG.md | 2 +- lib/mastodon/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/CHANGELOG.md b/CHANGELOG.md index 120ec7407..17626e027 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Changelog All notable changes to this project will be documented in this file. -## [Unreleased] +## [2.8.0] - 2019-04-10 ### Added - Add polls ([Gargron](https://github.com/tootsuite/mastodon/pull/10111), [ThibG](https://github.com/tootsuite/mastodon/pull/10155), [Gargron](https://github.com/tootsuite/mastodon/pull/10184), [ThibG](https://github.com/tootsuite/mastodon/pull/10196), [Gargron](https://github.com/tootsuite/mastodon/pull/10248), [ThibG](https://github.com/tootsuite/mastodon/pull/10255), [ThibG](https://github.com/tootsuite/mastodon/pull/10322), [Gargron](https://github.com/tootsuite/mastodon/pull/10138), [Gargron](https://github.com/tootsuite/mastodon/pull/10139), [Gargron](https://github.com/tootsuite/mastodon/pull/10144), [Gargron](https://github.com/tootsuite/mastodon/pull/10145),[Gargron](https://github.com/tootsuite/mastodon/pull/10146), [Gargron](https://github.com/tootsuite/mastodon/pull/10148), [Gargron](https://github.com/tootsuite/mastodon/pull/10151), [ThibG](https://github.com/tootsuite/mastodon/pull/10150), [Gargron](https://github.com/tootsuite/mastodon/pull/10168), [Gargron](https://github.com/tootsuite/mastodon/pull/10165), [Gargron](https://github.com/tootsuite/mastodon/pull/10172), [Gargron](https://github.com/tootsuite/mastodon/pull/10170), [Gargron](https://github.com/tootsuite/mastodon/pull/10171), [Gargron](https://github.com/tootsuite/mastodon/pull/10186), [Gargron](https://github.com/tootsuite/mastodon/pull/10189), [ThibG](https://github.com/tootsuite/mastodon/pull/10200), [rinsuki](https://github.com/tootsuite/mastodon/pull/10203), [Gargron](https://github.com/tootsuite/mastodon/pull/10213), [Gargron](https://github.com/tootsuite/mastodon/pull/10246), [Gargron](https://github.com/tootsuite/mastodon/pull/10265), [Gargron](https://github.com/tootsuite/mastodon/pull/10261), [ThibG](https://github.com/tootsuite/mastodon/pull/10333), [Gargron](https://github.com/tootsuite/mastodon/pull/10352), [ThibG](https://github.com/tootsuite/mastodon/pull/10140), [ThibG](https://github.com/tootsuite/mastodon/pull/10142), [ThibG](https://github.com/tootsuite/mastodon/pull/10141), [ThibG](https://github.com/tootsuite/mastodon/pull/10162), [ThibG](https://github.com/tootsuite/mastodon/pull/10161), [ThibG](https://github.com/tootsuite/mastodon/pull/10158), [ThibG](https://github.com/tootsuite/mastodon/pull/10156), [ThibG](https://github.com/tootsuite/mastodon/pull/10160), [Gargron](https://github.com/tootsuite/mastodon/pull/10185), [Gargron](https://github.com/tootsuite/mastodon/pull/10188), [ThibG](https://github.com/tootsuite/mastodon/pull/10195), [ThibG](https://github.com/tootsuite/mastodon/pull/10208), [Gargron](https://github.com/tootsuite/mastodon/pull/10187), [ThibG](https://github.com/tootsuite/mastodon/pull/10214), [ThibG](https://github.com/tootsuite/mastodon/pull/10209)) diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index bc27d06ea..b53205ee4 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -21,7 +21,7 @@ module Mastodon end def flags - 'rc3' + '' end def to_a -- cgit