From 21a1a8ee887f82cb36b3d21011a0235e7bfc8e45 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 13 Jan 2023 10:46:52 +0100 Subject: [PATCH 01/90] Fix crash when marking statuses as sensitive while some statuses are deleted (#22134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Do not offer to mark statuses as sensitive if there is no undeleted status with media attachments * Fix crash when marking statuses as sensitive while some statuses are deleted Fixes #21910 * Fix multiple strikes being created for a single report when selecting “Mark as sensitive” * Add tests --- app/models/admin/status_batch_action.rb | 16 +++---- app/views/admin/reports/_actions.html.haml | 2 +- .../admin/reports/actions_controller_spec.rb | 42 +++++++++++++++++++ 3 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 spec/controllers/admin/reports/actions_controller_spec.rb diff --git a/app/models/admin/status_batch_action.rb b/app/models/admin/status_batch_action.rb index 0f019b854d..39cd7d0eb8 100644 --- a/app/models/admin/status_batch_action.rb +++ b/app/models/admin/status_batch_action.rb @@ -73,7 +73,7 @@ class Admin::StatusBatchAction # Can't use a transaction here because UpdateStatusService queues # Sidekiq jobs statuses.includes(:media_attachments, :preview_cards).find_each do |status| - next unless status.with_media? || status.with_preview_card? + next if status.discarded? || !(status.with_media? || status.with_preview_card?) authorize([:admin, status], :update?) @@ -89,15 +89,15 @@ class Admin::StatusBatchAction report.resolve!(current_account) log_action(:resolve, report) end - - @warning = target_account.strikes.create!( - action: :mark_statuses_as_sensitive, - account: current_account, - report: report, - status_ids: status_ids - ) end + @warning = target_account.strikes.create!( + action: :mark_statuses_as_sensitive, + account: current_account, + report: report, + status_ids: status_ids + ) + UserMailer.warning(target_account.user, @warning).deliver_later! if warnable? end diff --git a/app/views/admin/reports/_actions.html.haml b/app/views/admin/reports/_actions.html.haml index 404d53a773..486eb486c7 100644 --- a/app/views/admin/reports/_actions.html.haml +++ b/app/views/admin/reports/_actions.html.haml @@ -5,7 +5,7 @@ = link_to t('admin.reports.mark_as_resolved'), resolve_admin_report_path(@report), method: :post, class: 'button' .report-actions__item__description = t('admin.reports.actions.resolve_description_html') - - if @statuses.any? { |status| status.with_media? || status.with_preview_card? } + - if @statuses.any? { |status| (status.with_media? || status.with_preview_card?) && !status.discarded? } .report-actions__item .report-actions__item__button = button_tag t('admin.reports.mark_as_sensitive'), name: :mark_as_sensitive, class: 'button' diff --git a/spec/controllers/admin/reports/actions_controller_spec.rb b/spec/controllers/admin/reports/actions_controller_spec.rb new file mode 100644 index 0000000000..6609798dc0 --- /dev/null +++ b/spec/controllers/admin/reports/actions_controller_spec.rb @@ -0,0 +1,42 @@ +require 'rails_helper' + +describe Admin::Reports::ActionsController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:account) { Fabricate(:account) } + let!(:status) { Fabricate(:status, account: account) } + let(:media_attached_status) { Fabricate(:status, account: account) } + let!(:media_attachment) { Fabricate(:media_attachment, account: account, status: media_attached_status) } + let(:media_attached_deleted_status) { Fabricate(:status, account: account, deleted_at: 1.day.ago) } + let!(:media_attachment2) { Fabricate(:media_attachment, account: account, status: media_attached_deleted_status) } + let(:last_media_attached_status) { Fabricate(:status, account: account) } + let!(:last_media_attachment) { Fabricate(:media_attachment, account: account, status: last_media_attached_status) } + let!(:last_status) { Fabricate(:status, account: account) } + + before do + sign_in user, scope: :user + end + + describe 'POST #create' do + let(:report) { Fabricate(:report, status_ids: status_ids, account: user.account, target_account: account) } + let(:status_ids) { [media_attached_status.id, media_attached_deleted_status.id] } + + before do + post :create, params: { report_id: report.id, action => '' } + end + + context 'when action is mark_as_sensitive' do + + let(:action) { 'mark_as_sensitive' } + + it 'resolves the report' do + expect(report.reload.action_taken_at).to_not be_nil + end + + it 'marks the non-deleted as sensitive' do + expect(media_attached_status.reload.sensitive).to eq true + end + end + end +end From f79c200f7ee5c381751ee615cd8ac12b59800919 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 13 Jan 2023 11:03:14 +0100 Subject: [PATCH 02/90] Change wording of admin report handling actions (#18388) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change admin report handling UI to display appropriate text for remote reports Change from “Decide which action to take to resolve this report. If you take a punitive action against the reported account, an e-mail notification will be sent to them, except when the Spam category is selected.” to “Decide which action to take to resolve this report. This will only affect how your server communicates with this remote account and handle its content.” * Reword admin actions descriptions to make clear which admin actions close reports --- app/views/admin/reports/show.html.haml | 2 +- config/locales/en.yml | 5 +++-- config/locales/simple_form.en.yml | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index 5a45b9b781..a286aaec33 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -181,7 +181,7 @@ - if @report.unresolved? %hr.spacer/ - %p#actions= t 'admin.reports.actions_description_html' + %p#actions= t(@report.target_account.local? ? 'admin.reports.actions_description_html' : 'admin.reports.actions_description_remote_html') = render partial: 'admin/reports/actions' diff --git a/config/locales/en.yml b/config/locales/en.yml index 075ce2136f..2a8fe24631 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -575,9 +575,10 @@ en: mark_as_sensitive_description_html: The media in the reported posts will be marked as sensitive and a strike will be recorded to help you escalate on future infractions by the same account. other_description_html: See more options for controlling the account's behaviour and customize communication to the reported account. resolve_description_html: No action will be taken against the reported account, no strike recorded, and the report will be closed. - silence_description_html: The profile will be visible only to those who already follow it or manually look it up, severely limiting its reach. Can always be reverted. - suspend_description_html: The profile and all its contents will become inaccessible until it is eventually deleted. Interacting with the account will be impossible. Reversible within 30 days. + silence_description_html: The account will be visible only to those who already follow it or manually look it up, severely limiting its reach. Can always be reverted. Closes all reports against this account. + suspend_description_html: The account and all its contents will be inaccessible and eventually deleted, and interacting with it will be impossible. Reversible within 30 days. Closes all reports against this account. actions_description_html: Decide which action to take to resolve this report. If you take a punitive action against the reported account, an e-mail notification will be sent to them, except when the Spam category is selected. + actions_description_remote_html: Decide which action to take to resolve this report. This will only affect how your server communicates with this remote account and handle its content. add_to_report: Add more to report are_you_sure: Are you sure? assign_to_self: Assign to me diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 6edf7b4e9e..43b9654f1f 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -18,8 +18,8 @@ en: disable: Prevent the user from using their account, but do not delete or hide their contents. none: Use this to send a warning to the user, without triggering any other action. sensitive: Force all this user's media attachments to be flagged as sensitive. - silence: Prevent the user from being able to post with public visibility, hide their posts and notifications from people not following them. - suspend: Prevent any interaction from or to this account and delete its contents. Revertible within 30 days. + silence: Prevent the user from being able to post with public visibility, hide their posts and notifications from people not following them. Closes all reports against this account. + suspend: Prevent any interaction from or to this account and delete its contents. Revertible within 30 days. Closes all reports against this account. warning_preset_id: Optional. You can still add custom text to end of the preset announcement: all_day: When checked, only the dates of the time range will be displayed From 332a411fadf961f52706db1e358d92d92ed8bf49 Mon Sep 17 00:00:00 2001 From: nametoolong Date: Fri, 13 Jan 2023 22:12:26 +0800 Subject: [PATCH 03/90] Remove title from mailer layout (#23078) --- app/views/layouts/mailer.html.haml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index f26de8d999..d816f1b8c0 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -4,8 +4,6 @@ %meta{ 'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8' }/ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, shrink-to-fit=no' } - %title/ - = stylesheet_pack_tag 'mailer' %body{ dir: locale_direction } %table.email-table{ cellspacing: 0, cellpadding: 0 } From ff70e5019910c309f8ab38d729c4eb5819512698 Mon Sep 17 00:00:00 2001 From: David Freedman Date: Fri, 13 Jan 2023 15:40:06 +0000 Subject: [PATCH 04/90] Don't crash on unobtainable avatars (#22462) --- app/models/concerns/omniauthable.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/omniauthable.rb b/app/models/concerns/omniauthable.rb index a90d5d888a..feac0a1f5e 100644 --- a/app/models/concerns/omniauthable.rb +++ b/app/models/concerns/omniauthable.rb @@ -55,7 +55,14 @@ module Omniauthable user = User.new(user_params_from_auth(email, auth)) - user.account.avatar_remote_url = auth.info.image if /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/.match?(auth.info.image) + begin + if /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/.match?(auth.info.image) + user.account.avatar_remote_url = auth.info.image + end + rescue Mastodon::UnexpectedResponseError + user.account.avatar_remote_url = nil + end + user.skip_confirmation! if email_is_verified user.save! user From f33e22ae4c32d6a01b2e706bb0b55f961689f03f Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 13 Jan 2023 16:40:21 +0100 Subject: [PATCH 05/90] Allow changing hide_collections setting with the api (#22790) * Allow changing hide_collections setting with the api This is currently only possible with app/controllers/settings/profiles_controller.rb and is the only difference in the allowed parameter between the two controllers * Fix the lint issue * Use normal indent --- .../api/v1/accounts/credentials_controller.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/accounts/credentials_controller.rb b/app/controllers/api/v1/accounts/credentials_controller.rb index 64b5cb747c..94b707771f 100644 --- a/app/controllers/api/v1/accounts/credentials_controller.rb +++ b/app/controllers/api/v1/accounts/credentials_controller.rb @@ -21,7 +21,17 @@ class Api::V1::Accounts::CredentialsController < Api::BaseController private def account_params - params.permit(:display_name, :note, :avatar, :header, :locked, :bot, :discoverable, fields_attributes: [:name, :value]) + params.permit( + :display_name, + :note, + :avatar, + :header, + :locked, + :bot, + :discoverable, + :hide_collections, + fields_attributes: [:name, :value] + ) end def user_settings_params From d35fe3d5e3a45629634edde4c3d2726262c4f57e Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Fri, 13 Jan 2023 07:43:17 -0800 Subject: [PATCH 06/90] Add peers API endpoint toggle to Server Settings (#22810) * Add peers endpoint toggle to Server Settings This places the toggle under "Discovery" and expands the hint text to explain further what the endpoint is used for. Added a "Recommended" tag since it was recommended in v3 before it was removed. Fixes https://github.com/mastodon/mastodon/issues/22222 * i18n normalize step --- app/views/admin/settings/discovery/show.html.haml | 5 +++++ config/locales/en.yml | 1 + config/locales/simple_form.en.yml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml index f60d1c7662..17c9e93dd7 100644 --- a/app/views/admin/settings/discovery/show.html.haml +++ b/app/views/admin/settings/discovery/show.html.haml @@ -29,6 +29,11 @@ .fields-group = f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html') + %h4= t('admin.settings.discovery.publish_discovered_servers') + + .fields-group + = f.input :peers_api_enabled, as: :boolean, wrapper: :with_label, recommended: :recommended + %h4= t('admin.settings.discovery.follow_recommendations') .fields-group diff --git a/config/locales/en.yml b/config/locales/en.yml index 2a8fe24631..e5c7c0ea37 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -714,6 +714,7 @@ en: preamble: Surfacing interesting content is instrumental in onboarding new users who may not know anyone Mastodon. Control how various discovery features work on your server. profile_directory: Profile directory public_timelines: Public timelines + publish_discovered_servers: Publish discovered servers title: Discovery trends: Trends domain_blocks: diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 43b9654f1f..e9f4d37461 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -81,6 +81,7 @@ en: custom_css: You can apply custom styles on the web version of Mastodon. mascot: Overrides the illustration in the advanced web interface. media_cache_retention_period: Downloaded media files will be deleted after the specified number of days when set to a positive value, and re-downloaded on demand. + peers_api_enabled: A list of domain names this server has encountered in the fediverse. No data is included here about whether you federate with a given server, just that your server knows about it. This is used by services that collect statistics on federation in a general sense. profile_directory: The profile directory lists all users who have opted-in to be discoverable. require_invite_text: When sign-ups require manual approval, make the “Why do you want to join?” text input mandatory rather than optional site_contact_email: How people can reach you for legal or support inquiries. @@ -236,6 +237,7 @@ en: custom_css: Custom CSS mascot: Custom mascot (legacy) media_cache_retention_period: Media cache retention period + peers_api_enabled: Publish list of discovered servers in the API profile_directory: Enable profile directory registrations_mode: Who can sign-up require_invite_text: Require a reason to join From 745bdb11a0d81cc4aff3fe3bba5eecdb8671a632 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 13 Jan 2023 17:00:23 +0100 Subject: [PATCH 07/90] Add `tootctl accounts migrate` (#22330) * Add tootctl accounts replay-migration Fixes #22281 * Change `tootctl accounts replay-migration` to `tootctl accounts migrate` --- lib/mastodon/accounts_cli.rb | 73 ++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index 0dd8521313..693c9547c6 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -553,6 +553,79 @@ module Mastodon end end + option :force, type: :boolean + option :replay, type: :boolean + option :target + desc 'migrate USERNAME', 'Migrate a local user to another account' + long_desc <<~LONG_DESC + With --replay, replay the last migration of the specified account, in + case some remote server may not have properly processed the associated + `Move` activity. + + With --target, specify another account to migrate to. + + With --force, perform the migration even if the selected account + redirects to a different account that the one specified. + LONG_DESC + def migrate(username) + if options[:replay].present? && options[:target].present? + say('Use --replay or --target, not both', :red) + exit(1) + end + + if options[:replay].blank? && options[:target].blank? + say('Use either --replay or --target', :red) + exit(1) + end + + account = Account.find_local(username) + + if account.nil? + say("No such account: #{username}", :red) + exit(1) + end + + migration = nil + + if options[:replay] + migration = account.migrations.last + if migration.nil? + say('The specified account has not performed any migration', :red) + exit(1) + end + + unless options[:force] || migration.target_acount_id == account.moved_to_account_id + say('The specified account is not redirecting to its last migration target. Use --force if you want to replay the migration anyway', :red) + exit(1) + end + end + + if options[:target] + target_account = ResolveAccountService.new.call(options[:target]) + + if target_account.nil? + say("The specified target account could not be found: #{options[:target]}", :red) + exit(1) + end + + unless options[:force] || account.moved_to_account_id.nil? || account.moved_to_account_id == target_account.id + say('The specified account is redirecting to a different target account. Use --force if you want to change the migration target', :red) + exit(1) + end + + begin + migration = account.migrations.create!(acct: target_account.acct) + rescue ActiveRecord::RecordInvalid => e + say("Error: #{e.message}", :red) + exit(1) + end + end + + MoveService.new.call(migration) + + say("OK, migrated #{account.acct} to #{migration.target_account.acct}", :green) + end + private def rotate_keys_for_account(account, delay = 0) From 507e1d22f580b23d47d8dc0cb47f6f0b3170fc56 Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Fri, 13 Jan 2023 08:14:39 -0800 Subject: [PATCH 08/90] Allow admins to toggle public statistics API (#22833) * Allow admins to toggle public statistics API * Normalize i18n Co-authored-by: Claire --- app/views/admin/settings/discovery/show.html.haml | 5 +++++ config/locales/en.yml | 1 + config/locales/simple_form.en.yml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml index 17c9e93dd7..59188833bd 100644 --- a/app/views/admin/settings/discovery/show.html.haml +++ b/app/views/admin/settings/discovery/show.html.haml @@ -29,6 +29,11 @@ .fields-group = f.input :noindex, as: :boolean, wrapper: :with_label, label: t('admin.settings.default_noindex.title'), hint: t('admin.settings.default_noindex.desc_html') + %h4= t('admin.settings.discovery.publish_statistics') + + .fields-group + = f.input :activity_api_enabled, as: :boolean, wrapper: :with_label, recommended: :recommended + %h4= t('admin.settings.discovery.publish_discovered_servers') .fields-group diff --git a/config/locales/en.yml b/config/locales/en.yml index e5c7c0ea37..4f04430ee4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -715,6 +715,7 @@ en: profile_directory: Profile directory public_timelines: Public timelines publish_discovered_servers: Publish discovered servers + publish_statistics: Publish statistics title: Discovery trends: Trends domain_blocks: diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index e9f4d37461..f66e12c4c1 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -74,6 +74,7 @@ en: hide: Completely hide the filtered content, behaving as if it did not exist warn: Hide the filtered content behind a warning mentioning the filter's title form_admin_settings: + activity_api_enabled: Counts of locally published posts, active users, and new registrations in weekly buckets backups_retention_period: Keep generated user archives for the specified number of days. bootstrap_timeline_accounts: These accounts will be pinned to the top of new users' follow recommendations. closed_registrations_message: Displayed when sign-ups are closed @@ -230,6 +231,7 @@ en: hide: Hide completely warn: Hide with a warning form_admin_settings: + activity_api_enabled: Publish aggregate statistics about user activity in the API backups_retention_period: User archive retention period bootstrap_timeline_accounts: Always recommend these accounts to new users closed_registrations_message: Custom message when sign-ups are not available From 0e8f8a1a1c225272596b3256e3adb0a20a0dc483 Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Sat, 14 Jan 2023 06:34:16 +0900 Subject: [PATCH 09/90] Implement tootctl accounts prune (#18397) * Implement tootctl accounts prune * Optimise query Co-authored-by: Claire --- lib/mastodon/accounts_cli.rb | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/mastodon/accounts_cli.rb b/lib/mastodon/accounts_cli.rb index 693c9547c6..34afbc699d 100644 --- a/lib/mastodon/accounts_cli.rb +++ b/lib/mastodon/accounts_cli.rb @@ -553,6 +553,43 @@ module Mastodon end end + option :concurrency, type: :numeric, default: 5, aliases: [:c] + option :dry_run, type: :boolean + desc 'prune', 'Prune remote accounts that never interacted with local users' + long_desc <<-LONG_DESC + Prune remote account that + - follows no local accounts + - is not followed by any local accounts + - has no statuses on local + - has not been mentioned + - has not been favourited local posts + - not muted/blocked by us + LONG_DESC + def prune + dry_run = options[:dry_run] ? ' (dry run)' : '' + + query = Account.remote.where.not(actor_type: %i(Application Service)) + query = query.where('NOT EXISTS (SELECT 1 FROM mentions WHERE account_id = accounts.id)') + query = query.where('NOT EXISTS (SELECT 1 FROM favourites WHERE account_id = accounts.id)') + query = query.where('NOT EXISTS (SELECT 1 FROM statuses WHERE account_id = accounts.id)') + query = query.where('NOT EXISTS (SELECT 1 FROM follows WHERE account_id = accounts.id OR target_account_id = accounts.id)') + query = query.where('NOT EXISTS (SELECT 1 FROM blocks WHERE account_id = accounts.id OR target_account_id = accounts.id)') + query = query.where('NOT EXISTS (SELECT 1 FROM mutes WHERE target_account_id = accounts.id)') + query = query.where('NOT EXISTS (SELECT 1 FROM reports WHERE target_account_id = accounts.id)') + query = query.where('NOT EXISTS (SELECT 1 FROM follow_requests WHERE account_id = accounts.id OR target_account_id = accounts.id)') + + _, deleted = parallelize_with_progress(query) do |account| + next if account.bot? || account.group? + next if account.suspended? + next if account.silenced? + + account.destroy unless options[:dry_run] + 1 + end + + say("OK, pruned #{deleted} accounts#{dry_run}", :green) + end + option :force, type: :boolean option :replay, type: :boolean option :target From d66dfc7b3c1b62a0d5276387ea8745da598afacc Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Sat, 14 Jan 2023 22:00:23 +0900 Subject: [PATCH 10/90] Change confirm prompt for relationships management (#19411) * Change confirm prompt for relationships management * Add Korean translations * Apply suggestions from code review Co-authored-by: TobyWilkes Co-authored-by: TobyWilkes --- app/views/relationships/show.html.haml | 6 +++--- config/locales/en.yml | 3 +++ config/locales/ko.yml | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/views/relationships/show.html.haml b/app/views/relationships/show.html.haml index c82e639e0e..2899cd5140 100644 --- a/app/views/relationships/show.html.haml +++ b/app/views/relationships/show.html.haml @@ -42,11 +42,11 @@ %label.batch-table__toolbar__select.batch-checkbox-all = check_box_tag :batch_checkbox_all, nil, false .batch-table__toolbar__actions - = f.button safe_join([fa_icon('user-plus'), t('relationships.follow_selected_followers')]), name: :follow, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } if followed_by_relationship? && !mutual_relationship? + = f.button safe_join([fa_icon('user-plus'), t('relationships.follow_selected_followers')]), name: :follow, class: 'table-action-link', type: :submit, data: { confirm: t('relationships.confirm_follow_selected_followers') } if followed_by_relationship? && !mutual_relationship? - = f.button safe_join([fa_icon('user-times'), t('relationships.remove_selected_follows')]), name: :unfollow, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } unless followed_by_relationship? + = f.button safe_join([fa_icon('user-times'), t('relationships.remove_selected_follows')]), name: :unfollow, class: 'table-action-link', type: :submit, data: { confirm: t('relationships.confirm_remove_selected_follows') } unless followed_by_relationship? - = f.button safe_join([fa_icon('trash'), t('relationships.remove_selected_followers')]), name: :remove_from_followers, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } unless following_relationship? + = f.button safe_join([fa_icon('trash'), t('relationships.remove_selected_followers')]), name: :remove_from_followers, class: 'table-action-link', type: :submit, data: { confirm: t('relationships.confirm_remove_selected_followers') } unless following_relationship? = f.button safe_join([fa_icon('trash'), t('relationships.remove_selected_domains')]), name: :block_domains, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') } if followed_by_relationship? .batch-table__body diff --git a/config/locales/en.yml b/config/locales/en.yml index 4f04430ee4..763110c770 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1371,6 +1371,9 @@ en: unrecognized_emoji: is not a recognized emoji relationships: activity: Account activity + confirm_follow_selected_followers: Are you sure you want to follow selected followers? + confirm_remove_selected_followers: Are you sure you want to remove selected followers? + confirm_remove_selected_follows: Are you sure you want to remove selected follows? dormant: Dormant follow_selected_followers: Follow selected followers followers: Followers diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 48d3d4599d..a320723bf2 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1343,6 +1343,9 @@ ko: unrecognized_emoji: 인식 되지 않은 에모지입니다 relationships: activity: 계정 활동 + confirm_follow_selected_followers: 정말로 선택된 팔로워들을 팔로우 하시겠습니까? + confirm_remove_selected_followers: 정말로 선택된 팔로워들을 삭제하시겠습니까? + confirm_remove_selected_follows: 정말로 선택된 팔로우를 끊으시겠습니까? dormant: 휴면 follow_selected_followers: 선택한 팔로워들을 팔로우 followers: 팔로워 From 1554e0e66a5b38fc9e0ba812d832334e912671f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:52:11 +0100 Subject: [PATCH 11/90] Bump punycode from 2.1.1 to 2.2.0 (#23126) Bumps [punycode](https://github.com/bestiejs/punycode.js) from 2.1.1 to 2.2.0. - [Release notes](https://github.com/bestiejs/punycode.js/releases) - [Commits](https://github.com/bestiejs/punycode.js/compare/v2.1.1...v2.2.0) --- updated-dependencies: - dependency-name: punycode dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 93ed7ea87f..1a2b5a57fd 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "postcss-loader": "^3.0.0", "promise.prototype.finally": "^3.1.4", "prop-types": "^15.8.1", - "punycode": "^2.1.0", + "punycode": "^2.2.0", "react": "^16.14.0", "react-dom": "^16.14.0", "react-helmet": "^6.1.0", diff --git a/yarn.lock b/yarn.lock index 6e56f51d14..9ba19af2a2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8748,10 +8748,10 @@ punycode@1.4.1, punycode@^1.2.4: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +punycode@^2.1.0, punycode@^2.1.1, punycode@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.2.0.tgz#2092cc57cd2582c38e4e7e8bb869dc8d3148bc74" + integrity sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw== q@^1.1.2: version "1.5.1" From cfb9450d20ee60bd5964aa182c1cc50c95de1cbf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:52:35 +0100 Subject: [PATCH 12/90] Bump glob from 8.0.3 to 8.1.0 (#23125) Bumps [glob](https://github.com/isaacs/node-glob) from 8.0.3 to 8.1.0. - [Release notes](https://github.com/isaacs/node-glob/releases) - [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md) - [Commits](https://github.com/isaacs/node-glob/compare/v8.0.3...v8.1.0) --- updated-dependencies: - dependency-name: glob dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1a2b5a57fd..8f18aa6b26 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "file-loader": "^6.2.0", "font-awesome": "^4.7.0", "fuzzysort": "^1.9.0", - "glob": "^8.0.3", + "glob": "^8.1.0", "history": "^4.10.1", "http-link-header": "^1.1.0", "immutable": "^4.2.2", diff --git a/yarn.lock b/yarn.lock index 9ba19af2a2..76023c2665 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5235,10 +5235,10 @@ glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" - integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== +glob@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" From 6a9c74a7af006bdbd680d0478445577d0ff08b28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:52:50 +0100 Subject: [PATCH 13/90] Bump prettier from 2.8.2 to 2.8.3 (#23123) Bumps [prettier](https://github.com/prettier/prettier) from 2.8.2 to 2.8.3. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.2...2.8.3) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8f18aa6b26..b39e6e6106 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "jest": "^29.3.1", "jest-environment-jsdom": "^29.3.1", "postcss-scss": "^4.0.6", - "prettier": "^2.8.2", + "prettier": "^2.8.3", "raf": "^3.4.1", "react-intl-translations-manager": "^5.0.3", "react-test-renderer": "^16.14.0", diff --git a/yarn.lock b/yarn.lock index 76023c2665..961d645a0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8593,10 +8593,10 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@^2.8.2: - version "2.8.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.2.tgz#c4ea1b5b454d7c4b59966db2e06ed7eec5dfd160" - integrity sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw== +prettier@^2.8.3: + version "2.8.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.3.tgz#ab697b1d3dd46fb4626fbe2f543afe0cc98d8632" + integrity sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw== pretty-bytes@^5.3.0, pretty-bytes@^5.4.1: version "5.6.0" From 0512780e0d7d0c4e86cbe62260cf6d256e6d448b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:53:12 +0100 Subject: [PATCH 14/90] Bump rimraf from 3.0.2 to 4.0.7 (#23118) Bumps [rimraf](https://github.com/isaacs/rimraf) from 3.0.2 to 4.0.7. - [Release notes](https://github.com/isaacs/rimraf/releases) - [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md) - [Commits](https://github.com/isaacs/rimraf/compare/v3.0.2...v4.0.7) --- updated-dependencies: - dependency-name: rimraf dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b39e6e6106..a4add69424 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "regenerator-runtime": "^0.13.11", "requestidlecallback": "^0.3.0", "reselect": "^4.1.7", - "rimraf": "^3.0.2", + "rimraf": "^4.0.7", "sass": "^1.57.1", "sass-loader": "^10.2.0", "stacktrace-js": "^2.0.2", diff --git a/yarn.lock b/yarn.lock index 961d645a0f..60ec141bf6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9460,6 +9460,11 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +rimraf@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-4.0.7.tgz#f438c7d6a2d5e5cca1d81e3904a48ac7b053a542" + integrity sha512-CUEDDrZvc0swDgVdXGiv3FcYYQMpJxjvSGt85Amj6yU+MCVWurrLCeLiJDdJPHCzNJnwuebBEdcO//eP11Xa7w== + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" From d047e93f47e168ab5d70de8789c4d85c7eebe655 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:54:19 +0100 Subject: [PATCH 15/90] Bump nokogiri from 1.13.10 to 1.14.0 (#23128) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.10 to 1.14.0. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.10...v1.14.0) --- updated-dependencies: - dependency-name: nokogiri dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 3a18d13313..dc51ba3810 100644 --- a/Gemfile +++ b/Gemfile @@ -60,7 +60,7 @@ gem 'idn-ruby', require: 'idn' gem 'kaminari', '~> 1.2' gem 'link_header', '~> 0.0' gem 'mime-types', '~> 3.4.1', require: 'mime/types/columnar' -gem 'nokogiri', '~> 1.13' +gem 'nokogiri', '~> 1.14' gem 'nsa', '~> 0.2' gem 'oj', '~> 3.13' gem 'ox', '~> 2.14' diff --git a/Gemfile.lock b/Gemfile.lock index b41c993666..721fc7460b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -401,7 +401,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2022.0105) mini_mime (1.1.2) - mini_portile2 (2.8.0) + mini_portile2 (2.8.1) minitest (5.17.0) msgpack (1.6.0) multi_json (1.15.0) @@ -415,7 +415,7 @@ GEM net-protocol net-ssh (7.0.1) nio4r (2.5.8) - nokogiri (1.13.10) + nokogiri (1.14.0) mini_portile2 (~> 2.8.0) racc (~> 1.4) nsa (0.2.8) @@ -486,7 +486,7 @@ GEM pundit (2.3.0) activesupport (>= 3.0.0) raabro (1.4.0) - racc (1.6.1) + racc (1.6.2) rack (2.2.5) rack-attack (6.6.1) rack (>= 1.0, < 3) @@ -808,7 +808,7 @@ DEPENDENCIES memory_profiler mime-types (~> 3.4.1) net-ldap (~> 0.17) - nokogiri (~> 1.13) + nokogiri (~> 1.14) nsa (~> 0.2) oj (~> 3.13) omniauth (~> 1.9) From 23fcf7869ee86e0d6b6bb81bfd1f1339b6192a49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:13:31 +0100 Subject: [PATCH 16/90] Bump rubocop from 1.42.0 to 1.43.0 (#23119) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.42.0 to 1.43.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.42.0...v1.43.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 721fc7460b..57a1f9b094 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -453,7 +453,7 @@ GEM orm_adapter (0.5.0) ox (2.14.12) parallel (1.22.1) - parser (3.1.3.0) + parser (3.2.0.0) ast (~> 2.4.1) parslet (2.0.0) pastel (0.8.0) @@ -584,16 +584,16 @@ GEM rspec-support (3.11.1) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.42.0) + rubocop (1.43.0) json (~> 2.3) parallel (~> 1.10) - parser (>= 3.1.2.1) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) + unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.24.1) parser (>= 3.1.1.0) rubocop-performance (1.15.2) @@ -702,7 +702,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.8.2) - unicode-display_width (2.3.0) + unicode-display_width (2.4.2) uniform_notifier (1.16.0) validate_email (0.1.6) activemodel (>= 3.0) From 8276274bf68c19b01b7d79358dd559251ccf393e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:14:12 +0100 Subject: [PATCH 17/90] Bump rubocop-rspec from 2.16.0 to 2.18.0 (#23122) Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.16.0 to 2.18.0. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.16.0...v2.18.0) --- updated-dependencies: - dependency-name: rubocop-rspec dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 57a1f9b094..321c1836bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -596,6 +596,8 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.24.1) parser (>= 3.1.1.0) + rubocop-capybara (2.17.0) + rubocop (~> 1.41) rubocop-performance (1.15.2) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) @@ -603,8 +605,9 @@ GEM activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.16.0) + rubocop-rspec (2.18.0) rubocop (~> 1.33) + rubocop-capybara ruby-progressbar (1.11.0) ruby-saml (1.13.0) nokogiri (>= 1.10.5) From c6cda209d586d9f65217edba182c42f84461f3e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:31:39 +0100 Subject: [PATCH 18/90] Bump rack from 2.2.5 to 2.2.6.2 (#23142) Bumps [rack](https://github.com/rack/rack) from 2.2.5 to 2.2.6.2. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.5...v2.2.6.2) --- updated-dependencies: - dependency-name: rack dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index dc51ba3810..6a72fec549 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem 'puma', '~> 5.6' gem 'rails', '~> 6.1.7' gem 'sprockets', '~> 3.7.2' gem 'thor', '~> 1.2' -gem 'rack', '~> 2.2.5' +gem 'rack', '~> 2.2.6' gem 'hamlit-rails', '~> 0.2' gem 'pg', '~> 1.4' diff --git a/Gemfile.lock b/Gemfile.lock index 321c1836bc..efb768d344 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -487,7 +487,7 @@ GEM activesupport (>= 3.0.0) raabro (1.4.0) racc (1.6.2) - rack (2.2.5) + rack (2.2.6.2) rack-attack (6.6.1) rack (>= 1.0, < 3) rack-cors (1.1.1) @@ -831,7 +831,7 @@ DEPENDENCIES public_suffix (~> 5.0) puma (~> 5.6) pundit (~> 2.3) - rack (~> 2.2.5) + rack (~> 2.2.6) rack-attack (~> 6.6) rack-cors (~> 1.1) rack-test (~> 2.0) From 9b32ca583e028ecd435f517d7996efa578a48d46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:31:55 +0100 Subject: [PATCH 19/90] Bump ox from 2.14.12 to 2.14.13 (#23143) Bumps [ox](https://github.com/ohler55/ox) from 2.14.12 to 2.14.13. - [Release notes](https://github.com/ohler55/ox/releases) - [Changelog](https://github.com/ohler55/ox/blob/develop/CHANGELOG.md) - [Commits](https://github.com/ohler55/ox/compare/v2.14.12...v2.14.13) --- updated-dependencies: - dependency-name: ox dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index efb768d344..cb9a752d25 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -451,7 +451,7 @@ GEM openssl-signature_algorithm (1.2.1) openssl (> 2.0, < 3.1) orm_adapter (0.5.0) - ox (2.14.12) + ox (2.14.13) parallel (1.22.1) parser (3.2.0.0) ast (~> 2.4.1) From 302fcb9788b63bf50fa8e3452626402ccbd8522a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:40:21 +0100 Subject: [PATCH 20/90] Bump rails from 6.1.7 to 6.1.7.1 (#23144) Bumps [rails](https://github.com/rails/rails) from 6.1.7 to 6.1.7.1. - [Release notes](https://github.com/rails/rails/releases) - [Commits](https://github.com/rails/rails/compare/v6.1.7...v6.1.7.1) --- updated-dependencies: - dependency-name: rails dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 121 +++++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 56 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cb9a752d25..d700e58c53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,40 +10,40 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7) - actionpack (= 6.1.7) - activesupport (= 6.1.7) + actioncable (6.1.7.1) + actionpack (= 6.1.7.1) + activesupport (= 6.1.7.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7) - actionpack (= 6.1.7) - activejob (= 6.1.7) - activerecord (= 6.1.7) - activestorage (= 6.1.7) - activesupport (= 6.1.7) + actionmailbox (6.1.7.1) + actionpack (= 6.1.7.1) + activejob (= 6.1.7.1) + activerecord (= 6.1.7.1) + activestorage (= 6.1.7.1) + activesupport (= 6.1.7.1) mail (>= 2.7.1) - actionmailer (6.1.7) - actionpack (= 6.1.7) - actionview (= 6.1.7) - activejob (= 6.1.7) - activesupport (= 6.1.7) + actionmailer (6.1.7.1) + actionpack (= 6.1.7.1) + actionview (= 6.1.7.1) + activejob (= 6.1.7.1) + activesupport (= 6.1.7.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.7) - actionview (= 6.1.7) - activesupport (= 6.1.7) + actionpack (6.1.7.1) + actionview (= 6.1.7.1) + activesupport (= 6.1.7.1) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7) - actionpack (= 6.1.7) - activerecord (= 6.1.7) - activestorage (= 6.1.7) - activesupport (= 6.1.7) + actiontext (6.1.7.1) + actionpack (= 6.1.7.1) + activerecord (= 6.1.7.1) + activestorage (= 6.1.7.1) + activesupport (= 6.1.7.1) nokogiri (>= 1.8.5) - actionview (6.1.7) - activesupport (= 6.1.7) + actionview (6.1.7.1) + activesupport (= 6.1.7.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -54,22 +54,22 @@ GEM case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) active_record_query_trace (1.8) - activejob (6.1.7) - activesupport (= 6.1.7) + activejob (6.1.7.1) + activesupport (= 6.1.7.1) globalid (>= 0.3.6) - activemodel (6.1.7) - activesupport (= 6.1.7) - activerecord (6.1.7) - activemodel (= 6.1.7) - activesupport (= 6.1.7) - activestorage (6.1.7) - actionpack (= 6.1.7) - activejob (= 6.1.7) - activerecord (= 6.1.7) - activesupport (= 6.1.7) + activemodel (6.1.7.1) + activesupport (= 6.1.7.1) + activerecord (6.1.7.1) + activemodel (= 6.1.7.1) + activesupport (= 6.1.7.1) + activestorage (6.1.7.1) + actionpack (= 6.1.7.1) + activejob (= 6.1.7.1) + activerecord (= 6.1.7.1) + activesupport (= 6.1.7.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7) + activesupport (6.1.7.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -184,6 +184,7 @@ GEM crass (1.0.6) css_parser (1.12.0) addressable + date (3.3.3) debug_inspector (1.0.0) devise (4.8.1) bcrypt (~> 3.0) @@ -223,7 +224,7 @@ GEM faraday (~> 1) multi_json encryptor (3.0.0) - erubi (1.11.0) + erubi (1.12.0) et-orbi (1.2.7) tzinfo excon (0.95.0) @@ -282,7 +283,7 @@ GEM addressable (~> 2.7) omniauth (>= 1.9, < 3) openid_connect (~> 1.2) - globalid (1.0.0) + globalid (1.0.1) activesupport (>= 5.0) hamlit (2.13.0) temple (>= 0.8.2) @@ -387,8 +388,11 @@ GEM loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.0.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp makara (0.5.1) activerecord (>= 5.2.0) marcel (1.0.2) @@ -406,7 +410,12 @@ GEM msgpack (1.6.0) multi_json (1.15.0) multipart-post (2.1.1) + net-imap (0.3.4) + date + net-protocol net-ldap (0.17.1) + net-pop (0.1.2) + net-protocol net-protocol (0.1.3) timeout net-scp (4.0.0.rc1) @@ -502,20 +511,20 @@ GEM rack rack-test (2.0.2) rack (>= 1.3) - rails (6.1.7) - actioncable (= 6.1.7) - actionmailbox (= 6.1.7) - actionmailer (= 6.1.7) - actionpack (= 6.1.7) - actiontext (= 6.1.7) - actionview (= 6.1.7) - activejob (= 6.1.7) - activemodel (= 6.1.7) - activerecord (= 6.1.7) - activestorage (= 6.1.7) - activesupport (= 6.1.7) + rails (6.1.7.1) + actioncable (= 6.1.7.1) + actionmailbox (= 6.1.7.1) + actionmailer (= 6.1.7.1) + actionpack (= 6.1.7.1) + actiontext (= 6.1.7.1) + actionview (= 6.1.7.1) + activejob (= 6.1.7.1) + activemodel (= 6.1.7.1) + activerecord (= 6.1.7.1) + activestorage (= 6.1.7.1) + activesupport (= 6.1.7.1) bundler (>= 1.15.0) - railties (= 6.1.7) + railties (= 6.1.7.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -531,9 +540,9 @@ GEM railties (>= 6.0.0, < 7) rails-settings-cached (0.6.6) rails (>= 4.2.0) - railties (6.1.7) - actionpack (= 6.1.7) - activesupport (= 6.1.7) + railties (6.1.7.1) + actionpack (= 6.1.7.1) + activesupport (= 6.1.7.1) method_source rake (>= 12.2) thor (~> 1.0) From 472fd4307f9c963aba57e537e3ca3a8f94dfa139 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 15:50:50 +0100 Subject: [PATCH 21/90] New Crowdin updates (#2069) * New translations en.yml (Portuguese, Brazilian) [ci skip] * New translations en.yml (Chinese Traditional, Hong Kong) [ci skip] * New translations en.yml (Serbian (Latin)) [ci skip] * New translations en.yml (Kurmanji (Kurdish)) [ci skip] * New translations en.yml (Sorani (Kurdish)) [ci skip] * New translations simple_form.en.yml (Portuguese, Brazilian) [ci skip] * New translations simple_form.en.yml (Chinese Traditional, Hong Kong) [ci skip] * New translations simple_form.en.yml (Serbian (Latin)) [ci skip] * New translations simple_form.en.yml (Kurmanji (Kurdish)) [ci skip] * New translations simple_form.en.yml (Sorani (Kurdish)) [ci skip] * New translations en.yml (French) [ci skip] * New translations en.yml (French, Quebec) [ci skip] * Fix pt-BR key --- config/locales-glitch/ckb.yml | 2 +- config/locales-glitch/fr-QC.yml | 2 +- config/locales-glitch/fr.yml | 2 +- config/locales-glitch/ku.yml | 2 +- config/locales-glitch/simple_form.ckb.yml | 2 +- config/locales-glitch/simple_form.ku.yml | 2 +- config/locales-glitch/simple_form.sr-Latn.yml | 2 +- config/locales-glitch/simple_form.zh-HK.yml | 2 +- config/locales-glitch/sr-Latn.yml | 2 +- config/locales-glitch/zh-HK.yml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/locales-glitch/ckb.yml b/config/locales-glitch/ckb.yml index cc251e86ae..77d538af77 100644 --- a/config/locales-glitch/ckb.yml +++ b/config/locales-glitch/ckb.yml @@ -1 +1 @@ -ckb-IR: +ckb: diff --git a/config/locales-glitch/fr-QC.yml b/config/locales-glitch/fr-QC.yml index 6fa399b659..0cba194f54 100644 --- a/config/locales-glitch/fr-QC.yml +++ b/config/locales-glitch/fr-QC.yml @@ -34,7 +34,7 @@ fr-QC: glitch_guide_link_text: Et c'est pareil avec glitch-soc ! auth: captcha_confirmation: - hint_html: Plus qu'une étape ! Pour vérifier votre compte sur ce serveur, vous devez résoudre un CAPTCHA. Vous pouvez contacter l'administrateur·ice du serveur si vous avez des questions ou besoin d'assistance dans la vérification de votre compte. title: Vérification de l'utilisateur generic: use_this: Utiliser ceci diff --git a/config/locales-glitch/fr.yml b/config/locales-glitch/fr.yml index 44e032e661..15c3f8ce52 100644 --- a/config/locales-glitch/fr.yml +++ b/config/locales-glitch/fr.yml @@ -34,7 +34,7 @@ fr: glitch_guide_link_text: Et c'est pareil avec glitch-soc ! auth: captcha_confirmation: - hint_html: Plus qu'une étape ! Pour vérifier votre compte sur ce serveur, vous devez résoudre un CAPTCHA. Vous pouvez contacter l'administrateur·ice du serveur si vous avez des questions ou besoin d'assistance dans la vérification de votre compte. title: Vérification de l'utilisateur generic: use_this: Utiliser ceci diff --git a/config/locales-glitch/ku.yml b/config/locales-glitch/ku.yml index aa87618e43..b36f7c9883 100644 --- a/config/locales-glitch/ku.yml +++ b/config/locales-glitch/ku.yml @@ -1 +1 @@ -kmr-TR: +ku: diff --git a/config/locales-glitch/simple_form.ckb.yml b/config/locales-glitch/simple_form.ckb.yml index cc251e86ae..77d538af77 100644 --- a/config/locales-glitch/simple_form.ckb.yml +++ b/config/locales-glitch/simple_form.ckb.yml @@ -1 +1 @@ -ckb-IR: +ckb: diff --git a/config/locales-glitch/simple_form.ku.yml b/config/locales-glitch/simple_form.ku.yml index aa87618e43..b36f7c9883 100644 --- a/config/locales-glitch/simple_form.ku.yml +++ b/config/locales-glitch/simple_form.ku.yml @@ -1 +1 @@ -kmr-TR: +ku: diff --git a/config/locales-glitch/simple_form.sr-Latn.yml b/config/locales-glitch/simple_form.sr-Latn.yml index 9e26af8191..c482b5e449 100644 --- a/config/locales-glitch/simple_form.sr-Latn.yml +++ b/config/locales-glitch/simple_form.sr-Latn.yml @@ -1 +1 @@ -sr: +sr-Latn: diff --git a/config/locales-glitch/simple_form.zh-HK.yml b/config/locales-glitch/simple_form.zh-HK.yml index 35a3adbaf3..8e51e56487 100644 --- a/config/locales-glitch/simple_form.zh-HK.yml +++ b/config/locales-glitch/simple_form.zh-HK.yml @@ -1 +1 @@ -zh: +zh-HK: diff --git a/config/locales-glitch/sr-Latn.yml b/config/locales-glitch/sr-Latn.yml index 9e26af8191..c482b5e449 100644 --- a/config/locales-glitch/sr-Latn.yml +++ b/config/locales-glitch/sr-Latn.yml @@ -1 +1 @@ -sr: +sr-Latn: diff --git a/config/locales-glitch/zh-HK.yml b/config/locales-glitch/zh-HK.yml index 35a3adbaf3..8e51e56487 100644 --- a/config/locales-glitch/zh-HK.yml +++ b/config/locales-glitch/zh-HK.yml @@ -1 +1 @@ -zh: +zh-HK: From fcc4c9b34a6ab771c9cef6673e817866773e12d0 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:20:52 +0100 Subject: [PATCH 22/90] Change domain block CSV parsing to be more robust and handle more lists (#21470) * Change domain block CSV parsing to be more robust and handle more lists * Add some tests * Improve domain block import validation and reporting --- .../admin/export_domain_allows_controller.rb | 4 +- .../admin/export_domain_blocks_controller.rb | 24 +++++++---- .../admin_export_controller_concern.rb | 10 ----- app/models/admin/import.rb | 43 ++++++++++++++++--- config/locales/en.yml | 1 + .../export_domain_blocks_controller_spec.rb | 34 ++++++++++++--- spec/fixtures/files/domain_blocks.csv | 6 +-- spec/fixtures/files/domain_blocks_list.txt | 3 ++ 8 files changed, 88 insertions(+), 37 deletions(-) create mode 100644 spec/fixtures/files/domain_blocks_list.txt diff --git a/app/controllers/admin/export_domain_allows_controller.rb b/app/controllers/admin/export_domain_allows_controller.rb index 57fb12c620..adfc39da21 100644 --- a/app/controllers/admin/export_domain_allows_controller.rb +++ b/app/controllers/admin/export_domain_allows_controller.rb @@ -23,9 +23,7 @@ module Admin @import = Admin::Import.new(import_params) return render :new unless @import.validate - parse_import_data!(export_headers) - - @data.take(Admin::Import::ROWS_PROCESSING_LIMIT).each do |row| + @import.csv_rows.each do |row| domain = row['#domain'].strip next if DomainAllow.allowed?(domain) diff --git a/app/controllers/admin/export_domain_blocks_controller.rb b/app/controllers/admin/export_domain_blocks_controller.rb index fb0cd05d29..816422d4ff 100644 --- a/app/controllers/admin/export_domain_blocks_controller.rb +++ b/app/controllers/admin/export_domain_blocks_controller.rb @@ -23,24 +23,30 @@ module Admin @import = Admin::Import.new(import_params) return render :new unless @import.validate - parse_import_data!(export_headers) - @global_private_comment = I18n.t('admin.export_domain_blocks.import.private_comment_template', source: @import.data_file_name, date: I18n.l(Time.now.utc)) @form = Form::DomainBlockBatch.new - @domain_blocks = @data.take(Admin::Import::ROWS_PROCESSING_LIMIT).filter_map do |row| + @domain_blocks = @import.csv_rows.filter_map do |row| domain = row['#domain'].strip next if DomainBlock.rule_for(domain).present? domain_block = DomainBlock.new(domain: domain, - severity: row['#severity'].strip, - reject_media: row['#reject_media'].strip, - reject_reports: row['#reject_reports'].strip, + severity: row.fetch('#severity', :suspend), + reject_media: row.fetch('#reject_media', false), + reject_reports: row.fetch('#reject_reports', false), private_comment: @global_private_comment, - public_comment: row['#public_comment']&.strip, - obfuscate: row['#obfuscate'].strip) + public_comment: row['#public_comment'], + obfuscate: row.fetch('#obfuscate', false)) + + if domain_block.invalid? + flash.now[:alert] = I18n.t('admin.export_domain_blocks.invalid_domain_block', error: domain_block.errors.full_messages.join(', ')) + next + end - domain_block if domain_block.valid? + domain_block + rescue ArgumentError => e + flash.now[:alert] = I18n.t('admin.export_domain_blocks.invalid_domain_block', error: e.message) + next end @warning_domains = Instance.where(domain: @domain_blocks.map(&:domain)).where('EXISTS (SELECT 1 FROM follows JOIN accounts ON follows.account_id = accounts.id OR follows.target_account_id = accounts.id WHERE accounts.domain = instances.domain)').pluck(:domain) diff --git a/app/controllers/concerns/admin_export_controller_concern.rb b/app/controllers/concerns/admin_export_controller_concern.rb index b40c76557f..4ac48a04b7 100644 --- a/app/controllers/concerns/admin_export_controller_concern.rb +++ b/app/controllers/concerns/admin_export_controller_concern.rb @@ -26,14 +26,4 @@ module AdminExportControllerConcern def import_params params.require(:admin_import).permit(:data) end - - def import_data_path - params[:admin_import][:data].path - end - - def parse_import_data!(default_headers) - data = CSV.read(import_data_path, headers: true, encoding: 'UTF-8') - data = CSV.read(import_data_path, headers: default_headers, encoding: 'UTF-8') unless data.headers&.first&.strip&.include?(default_headers[0]) - @data = data.reject(&:blank?) - end end diff --git a/app/models/admin/import.rb b/app/models/admin/import.rb index 79c0722d53..fecde4878b 100644 --- a/app/models/admin/import.rb +++ b/app/models/admin/import.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'csv' + # A non-activerecord helper class for csv upload class Admin::Import include ActiveModel::Model @@ -15,17 +17,46 @@ class Admin::Import data.original_filename end + def csv_rows + csv_data.rewind + + csv_data.take(ROWS_PROCESSING_LIMIT + 1) + end + private - def validate_data - return if data.blank? + def csv_data + return @csv_data if defined?(@csv_data) + + csv_converter = lambda do |field, field_info| + case field_info.header + when '#domain', '#public_comment' + field&.strip + when '#severity' + field&.strip&.to_sym + when '#reject_media', '#reject_reports', '#obfuscate' + ActiveModel::Type::Boolean.new.cast(field) + else + field + end + end + + @csv_data = CSV.open(data.path, encoding: 'UTF-8', skip_blanks: true, headers: true, converters: csv_converter) + @csv_data.take(1) # Ensure the headers are read + @csv_data = CSV.open(data.path, encoding: 'UTF-8', skip_blanks: true, headers: ['#domain'], converters: csv_converter) unless @csv_data.headers&.first == '#domain' + @csv_data + end - csv_data = CSV.read(data.path, encoding: 'UTF-8') + def csv_row_count + return @csv_row_count if defined?(@csv_row_count) - row_count = csv_data.size - row_count -= 1 if csv_data.first&.first == '#domain' + csv_data.rewind + @csv_row_count = csv_data.take(ROWS_PROCESSING_LIMIT + 2).count + end - errors.add(:data, I18n.t('imports.errors.over_rows_processing_limit', count: ROWS_PROCESSING_LIMIT)) if row_count > ROWS_PROCESSING_LIMIT + def validate_data + return if data.nil? + errors.add(:data, I18n.t('imports.errors.over_rows_processing_limit', count: ROWS_PROCESSING_LIMIT)) if csv_row_count > ROWS_PROCESSING_LIMIT rescue CSV::MalformedCSVError => e errors.add(:data, I18n.t('imports.errors.invalid_csv_file', error: e.message)) end diff --git a/config/locales/en.yml b/config/locales/en.yml index 763110c770..4143aab045 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -441,6 +441,7 @@ en: private_comment_description_html: 'To help you track where imported blocks come from, imported blocks will be created with the following private comment: %{comment}' private_comment_template: Imported from %{source} on %{date} title: Import domain blocks + invalid_domain_block: 'One or more domain blocks were skipped because of the following error(s): %{error}' new: title: Import domain blocks no_file: No file selected diff --git a/spec/controllers/admin/export_domain_blocks_controller_spec.rb b/spec/controllers/admin/export_domain_blocks_controller_spec.rb index 8697e0c215..2766102c89 100644 --- a/spec/controllers/admin/export_domain_blocks_controller_spec.rb +++ b/spec/controllers/admin/export_domain_blocks_controller_spec.rb @@ -9,9 +9,9 @@ RSpec.describe Admin::ExportDomainBlocksController, type: :controller do describe 'GET #export' do it 'renders instances' do - Fabricate(:domain_block, domain: 'bad.domain', severity: 'silence', public_comment: 'bad') - Fabricate(:domain_block, domain: 'worse.domain', severity: 'suspend', reject_media: true, reject_reports: true, public_comment: 'worse', obfuscate: true) - Fabricate(:domain_block, domain: 'reject.media', severity: 'noop', reject_media: true, public_comment: 'reject media') + Fabricate(:domain_block, domain: 'bad.domain', severity: 'silence', public_comment: 'bad server') + Fabricate(:domain_block, domain: 'worse.domain', severity: 'suspend', reject_media: true, reject_reports: true, public_comment: 'worse server', obfuscate: true) + Fabricate(:domain_block, domain: 'reject.media', severity: 'noop', reject_media: true, public_comment: 'reject media and test unicode characters ♥') Fabricate(:domain_block, domain: 'no.op', severity: 'noop', public_comment: 'noop') get :export, params: { format: :csv } @@ -21,10 +21,32 @@ RSpec.describe Admin::ExportDomainBlocksController, type: :controller do end describe 'POST #import' do - it 'blocks imported domains' do - post :import, params: { admin_import: { data: fixture_file_upload('domain_blocks.csv') } } + context 'with complete domain blocks CSV' do + before do + post :import, params: { admin_import: { data: fixture_file_upload('domain_blocks.csv') } } + end - expect(assigns(:domain_blocks).map(&:domain)).to match_array ['bad.domain', 'worse.domain', 'reject.media'] + it 'renders page with expected domain blocks' do + expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to match_array [['bad.domain', :silence], ['worse.domain', :suspend], ['reject.media', :noop]] + end + + it 'returns http success' do + expect(response).to have_http_status(200) + end + end + + context 'with a list of only domains' do + before do + post :import, params: { admin_import: { data: fixture_file_upload('domain_blocks_list.txt') } } + end + + it 'renders page with expected domain blocks' do + expect(assigns(:domain_blocks).map { |block| [block.domain, block.severity.to_sym] }).to match_array [['bad.domain', :suspend], ['worse.domain', :suspend], ['reject.media', :suspend]] + end + + it 'returns http success' do + expect(response).to have_http_status(200) + end end end diff --git a/spec/fixtures/files/domain_blocks.csv b/spec/fixtures/files/domain_blocks.csv index 28ffb91751..9dbfb4eaf7 100644 --- a/spec/fixtures/files/domain_blocks.csv +++ b/spec/fixtures/files/domain_blocks.csv @@ -1,4 +1,4 @@ #domain,#severity,#reject_media,#reject_reports,#public_comment,#obfuscate -bad.domain,silence,false,false,bad,false -worse.domain,suspend,true,true,worse,true -reject.media,noop,true,false,reject media,false +bad.domain,silence,false,false,bad server,false +worse.domain,suspend,true,true,worse server,true +reject.media,noop,true,false,reject media and test unicode characters ♥,false diff --git a/spec/fixtures/files/domain_blocks_list.txt b/spec/fixtures/files/domain_blocks_list.txt new file mode 100644 index 0000000000..7b6b242533 --- /dev/null +++ b/spec/fixtures/files/domain_blocks_list.txt @@ -0,0 +1,3 @@ +bad.domain +worse.domain +reject.media From 41517a484506796f09610b79c59f91723e2fd662 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:21:48 +0100 Subject: [PATCH 23/90] Fix spurious admin dashboard warning when using ElasticSearch 7.x (#23064) Some 7.x ElasticSearch versions support some 6.x nodes, thus the version check is inadequate. I am not sure there is a good way to check if a server implements all the 7.x APIs, so check server version and minimum wire version instead. --- app/lib/admin/system_check/elasticsearch_check.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/lib/admin/system_check/elasticsearch_check.rb b/app/lib/admin/system_check/elasticsearch_check.rb index 7f922978f5..5b4c12399b 100644 --- a/app/lib/admin/system_check/elasticsearch_check.rb +++ b/app/lib/admin/system_check/elasticsearch_check.rb @@ -30,19 +30,24 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck def running_version @running_version ||= begin - Chewy.client.info['version']['minimum_wire_compatibility_version'] || - Chewy.client.info['version']['number'] + Chewy.client.info['version']['number'] rescue Faraday::ConnectionFailed nil end end + def compatible_wire_version + Chewy.client.info['version']['minimum_wire_compatibility_version'] + end + def required_version '7.x' end def compatible_version? return false if running_version.nil? - Gem::Version.new(running_version) >= Gem::Version.new(required_version) + + Gem::Version.new(running_version) >= Gem::Version.new(required_version) || + Gem::Version.new(compatible_wire_version) >= Gem::Version.new(required_version) end end From d4f590d6bba173bb0861e9babc7830bdc57d55d6 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:23:39 +0100 Subject: [PATCH 24/90] Fix scheduled_at input not using datetime-local when editing announcements (#21896) --- app/views/admin/announcements/edit.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/announcements/edit.html.haml b/app/views/admin/announcements/edit.html.haml index 66c8d31a79..c6c47586a0 100644 --- a/app/views/admin/announcements/edit.html.haml +++ b/app/views/admin/announcements/edit.html.haml @@ -19,7 +19,7 @@ - unless @announcement.published? .fields-group - = f.input :scheduled_at, include_blank: true, wrapper: :with_block_label + = f.input :scheduled_at, include_blank: true, wrapper: :with_block_label, html5: true, input_html: { pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}(:[0-9]{2}){1,2}', placeholder: Time.now.strftime('%FT%R') } .actions = f.button :button, t('generic.save_changes'), type: :submit From 0405be69d265b81a41be9c253e4b50aa6c8e1ee9 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:25:31 +0100 Subject: [PATCH 25/90] Fix REST API serializer for Account not including `moved` when the moved account has itself moved (#22483) Instead of cutting immediately, cut after one recursion. --- app/serializers/rest/account_serializer.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index e521dacaaa..6582b5bcf6 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -16,6 +16,16 @@ class REST::AccountSerializer < ActiveModel::Serializer attribute :silenced, key: :limited, if: :silenced? attribute :noindex, if: :local? + class AccountDecorator < SimpleDelegator + def self.model_name + Account.model_name + end + + def moved? + false + end + end + class FieldSerializer < ActiveModel::Serializer include FormattingHelper @@ -85,7 +95,7 @@ class REST::AccountSerializer < ActiveModel::Serializer end def moved_to_account - object.suspended? ? nil : object.moved_to_account + object.suspended? ? nil : AccountDecorator.new(object.moved_to_account) end def emojis @@ -111,6 +121,6 @@ class REST::AccountSerializer < ActiveModel::Serializer delegate :suspended?, :silenced?, :local?, to: :object def moved_and_not_nested? - object.moved? && object.moved_to_account.moved_to_account_id.nil? + object.moved? end end From b034dc42be2250f9b754fb88c9163b62d41f78f5 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:28:18 +0100 Subject: [PATCH 26/90] Fix /api/v1/admin/trends/tags using wrong serializer (#18943) * Fix /api/v1/admin/trends/tags using wrong serializer Fix regression from #18641 * Only use `REST::Admin::TagSerializer` when the user can `manage_taxonomies` * Fix admin trending hashtag component to not link if `id` is unknown --- app/controllers/api/v1/admin/trends/tags_controller.rb | 8 ++++++++ app/javascript/mastodon/components/admin/Trends.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/admin/trends/tags_controller.rb b/app/controllers/api/v1/admin/trends/tags_controller.rb index f3c0c4b6b4..e77df30216 100644 --- a/app/controllers/api/v1/admin/trends/tags_controller.rb +++ b/app/controllers/api/v1/admin/trends/tags_controller.rb @@ -3,6 +3,14 @@ class Api::V1::Admin::Trends::TagsController < Api::V1::Trends::TagsController before_action -> { authorize_if_got_token! :'admin:read' } + def index + if current_user&.can?(:manage_taxonomies) + render json: @tags, each_serializer: REST::Admin::TagSerializer + else + super + end + end + private def enabled? diff --git a/app/javascript/mastodon/components/admin/Trends.js b/app/javascript/mastodon/components/admin/Trends.js index 9530c2a5be..d01b8437ed 100644 --- a/app/javascript/mastodon/components/admin/Trends.js +++ b/app/javascript/mastodon/components/admin/Trends.js @@ -50,7 +50,7 @@ export default class Trends extends React.PureComponent { day.uses)} From 1b2ef60cec381e69384c208589c3dcf0ca2661db Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Thu, 19 Jan 2023 00:29:07 +0900 Subject: [PATCH 27/90] Make visible change for new post notification setting icon (#22541) --- app/javascript/mastodon/features/account/components/header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js index 2481e4783e..f6004d1c4b 100644 --- a/app/javascript/mastodon/features/account/components/header.js +++ b/app/javascript/mastodon/features/account/components/header.js @@ -193,7 +193,7 @@ class Header extends ImmutablePureComponent { } if (account.getIn(['relationship', 'requested']) || account.getIn(['relationship', 'following'])) { - bellBtn = ; + bellBtn = ; } if (me !== account.get('id')) { From 7e6ffa085f97dc4688e2655fe2447743ab807e44 Mon Sep 17 00:00:00 2001 From: Peter Simonsson Date: Wed, 18 Jan 2023 15:30:46 +0000 Subject: [PATCH 28/90] Add checkmark symbol to checkbox (#22795) --- app/javascript/styles/mastodon/components.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index ff368faaaa..6a2fe4c0b8 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -423,7 +423,7 @@ body > [data-popper-placement] { &.active { border-color: $highlight-text-color; - background: $highlight-text-color; + background: $highlight-text-color url("data:image/svg+xml;utf8,") center center no-repeat; } } } From 9b3e22c40d5a24ddfa0df42d8fe6e96a273e8afd Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:32:23 +0100 Subject: [PATCH 29/90] Change account moderation notes to make links clickable (#22553) * Change account moderation notes to make links clickable Fixes #22539 * Fix styling of account moderation note links --- app/javascript/styles/mastodon/admin.scss | 9 +++++++++ app/views/admin/report_notes/_report_note.html.haml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/styles/mastodon/admin.scss index 9c06e7a255..674fafbe95 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/styles/mastodon/admin.scss @@ -1572,6 +1572,15 @@ a.sparkline { margin-bottom: 0; } } + + a { + color: $highlight-text-color; + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } } &__actions { diff --git a/app/views/admin/report_notes/_report_note.html.haml b/app/views/admin/report_notes/_report_note.html.haml index 54c252ee89..64628989a6 100644 --- a/app/views/admin/report_notes/_report_note.html.haml +++ b/app/views/admin/report_notes/_report_note.html.haml @@ -8,7 +8,7 @@ = l report_note.created_at.to_date .report-notes__item__content - = simple_format(h(report_note.content)) + = linkify(report_note.content) - if can?(:destroy, report_note) .report-notes__item__actions From d1387579b904542245646fc12eca99c97feccc63 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:33:03 +0100 Subject: [PATCH 30/90] Fix situations in which instance actor can be set to a Mastodon-incompatible name (#22307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Validate internal actor * Use “internal.actor” by default for the server actor username * Fix instance actor username on the fly if it includes ':' * Change actor name from internal.actor to mastodon.internal --- app/models/account.rb | 4 ++-- app/models/concerns/account_finder_concern.rb | 6 ++++-- db/seeds/02_instance_actor.rb | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index b27fc748f9..262285a09e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -84,8 +84,8 @@ class Account < ApplicationRecord validates :username, presence: true validates_with UniqueUsernameValidator, if: -> { will_save_change_to_username? } - # Remote user validations - validates :username, format: { with: USERNAME_ONLY_RE }, if: -> { !local? && will_save_change_to_username? } + # Remote user validations, also applies to internal actors + validates :username, format: { with: USERNAME_ONLY_RE }, if: -> { (!local? || actor_type == 'Application') && will_save_change_to_username? } # Local user validations validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' } diff --git a/app/models/concerns/account_finder_concern.rb b/app/models/concerns/account_finder_concern.rb index e8b804934a..37c3b88959 100644 --- a/app/models/concerns/account_finder_concern.rb +++ b/app/models/concerns/account_finder_concern.rb @@ -13,9 +13,11 @@ module AccountFinderConcern end def representative - Account.find(-99).tap(&:ensure_keys!) + actor = Account.find(-99).tap(&:ensure_keys!) + actor.update!(username: 'mastodon.internal') if actor.username.include?(':') + actor rescue ActiveRecord::RecordNotFound - Account.create!(id: -99, actor_type: 'Application', locked: true, username: Rails.configuration.x.local_domain) + Account.create!(id: -99, actor_type: 'Application', locked: true, username: 'mastodon.internal') end def find_local(username) diff --git a/db/seeds/02_instance_actor.rb b/db/seeds/02_instance_actor.rb index 39186b2734..f9aa372f1c 100644 --- a/db/seeds/02_instance_actor.rb +++ b/db/seeds/02_instance_actor.rb @@ -1 +1 @@ -Account.create_with(actor_type: 'Application', locked: true, username: ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain).find_or_create_by(id: -99) +Account.create_with(actor_type: 'Application', locked: true, username: 'mastodon.internal').find_or_create_by(id: -99) From 4b92e59f4fea4486ee6e5af7421e7945d5f7f998 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 18 Jan 2023 16:33:55 +0100 Subject: [PATCH 31/90] Add support for editing media description and focus point of already-posted statuses (#20878) * Add backend support for editing media attachments of existing posts * Allow editing media attachments of already-posted toots * Add tests --- app/controllers/api/v1/statuses_controller.rb | 7 +++ app/javascript/mastodon/actions/compose.js | 46 ++++++++++++++++--- .../features/compose/components/upload.js | 4 +- .../ui/components/focal_point_modal.js | 2 +- app/javascript/mastodon/reducers/compose.js | 2 +- app/services/update_status_service.rb | 11 ++++- spec/services/update_status_service_spec.rb | 22 +++++++++ 7 files changed, 83 insertions(+), 11 deletions(-) diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 6290a1746a..9a8c0c1619 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -79,6 +79,7 @@ class Api::V1::StatusesController < Api::BaseController current_account.id, text: status_params[:status], media_ids: status_params[:media_ids], + media_attributes: status_params[:media_attributes], sensitive: status_params[:sensitive], language: status_params[:language], spoiler_text: status_params[:spoiler_text], @@ -128,6 +129,12 @@ class Api::V1::StatusesController < Api::BaseController :language, :scheduled_at, media_ids: [], + media_attributes: [ + :id, + :thumbnail, + :description, + :focus, + ], poll: [ :multiple, :hide_totals, diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 531a5eb2b0..72e5929358 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -160,6 +160,18 @@ export function submitCompose(routerHistory) { dispatch(submitComposeRequest()); + // If we're editing a post with media attachments, those have not + // necessarily been changed on the server. Do it now in the same + // API call. + let media_attributes; + if (statusId !== null) { + media_attributes = media.map(item => ({ + id: item.get('id'), + description: item.get('description'), + focus: item.get('focus'), + })); + } + api(getState).request({ url: statusId === null ? '/api/v1/statuses' : `/api/v1/statuses/${statusId}`, method: statusId === null ? 'post' : 'put', @@ -167,6 +179,7 @@ export function submitCompose(routerHistory) { status, in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null), media_ids: media.map(item => item.get('id')), + media_attributes, sensitive: getState().getIn(['compose', 'sensitive']), spoiler_text: getState().getIn(['compose', 'spoiler']) ? getState().getIn(['compose', 'spoiler_text'], '') : '', visibility: getState().getIn(['compose', 'privacy']), @@ -375,11 +388,31 @@ export function changeUploadCompose(id, params) { return (dispatch, getState) => { dispatch(changeUploadComposeRequest()); - api(getState).put(`/api/v1/media/${id}`, params).then(response => { - dispatch(changeUploadComposeSuccess(response.data)); - }).catch(error => { - dispatch(changeUploadComposeFail(id, error)); - }); + let media = getState().getIn(['compose', 'media_attachments']).find((item) => item.get('id') === id); + + // Editing already-attached media is deferred to editing the post itself. + // For simplicity's sake, fake an API reply. + if (media && !media.get('unattached')) { + let { description, focus } = params; + const data = media.toJS(); + + if (description) { + data.description = description; + } + + if (focus) { + focus = focus.split(','); + data.meta = { focus: { x: parseFloat(focus[0]), y: parseFloat(focus[1]) } }; + } + + dispatch(changeUploadComposeSuccess(data, true)); + } else { + api(getState).put(`/api/v1/media/${id}`, params).then(response => { + dispatch(changeUploadComposeSuccess(response.data, false)); + }).catch(error => { + dispatch(changeUploadComposeFail(id, error)); + }); + } }; } @@ -390,10 +423,11 @@ export function changeUploadComposeRequest() { }; } -export function changeUploadComposeSuccess(media) { +export function changeUploadComposeSuccess(media, attached) { return { type: COMPOSE_UPLOAD_CHANGE_SUCCESS, media: media, + attached: attached, skipLoading: true, }; } diff --git a/app/javascript/mastodon/features/compose/components/upload.js b/app/javascript/mastodon/features/compose/components/upload.js index b08307adee..af06ce1bf5 100644 --- a/app/javascript/mastodon/features/compose/components/upload.js +++ b/app/javascript/mastodon/features/compose/components/upload.js @@ -43,10 +43,10 @@ export default class Upload extends ImmutablePureComponent {
- {!!media.get('unattached') && ()} +
- {(media.get('description') || '').length === 0 && !!media.get('unattached') && ( + {(media.get('description') || '').length === 0 && (
diff --git a/app/javascript/mastodon/features/ui/components/focal_point_modal.js b/app/javascript/mastodon/features/ui/components/focal_point_modal.js index 479f4abd21..b9dbd93900 100644 --- a/app/javascript/mastodon/features/ui/components/focal_point_modal.js +++ b/app/javascript/mastodon/features/ui/components/focal_point_modal.js @@ -320,7 +320,7 @@ class FocalPointModal extends ImmutablePureComponent { - - {!!media.get('unattached') && ()} + +
- {(media.get('description') || '').length === 0 && !!media.get('unattached') && ( + {(media.get('description') || '').length === 0 && (
- +
)} diff --git a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js index 0dd07fb76b..fb432cf9ca 100644 --- a/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js @@ -320,7 +320,7 @@ class FocalPointModal extends ImmutablePureComponent { -