From 21a1a8ee887f82cb36b3d21011a0235e7bfc8e45 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 13 Jan 2023 10:46:52 +0100 Subject: 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 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/models/admin/status_batch_action.rb b/app/models/admin/status_batch_action.rb index 0f019b854..39cd7d0eb 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 404d53a77..486eb486c 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' -- cgit From f79c200f7ee5c381751ee615cd8ac12b59800919 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 13 Jan 2023 11:03:14 +0100 Subject: 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(-) (limited to 'app') diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index 5a45b9b78..a286aaec3 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 075ce2136..2a8fe2463 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 6edf7b4e9..43b9654f1 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 -- cgit From 332a411fadf961f52706db1e358d92d92ed8bf49 Mon Sep 17 00:00:00 2001 From: nametoolong Date: Fri, 13 Jan 2023 22:12:26 +0800 Subject: Remove title from mailer layout (#23078) --- app/views/layouts/mailer.html.haml | 2 -- 1 file changed, 2 deletions(-) (limited to 'app') diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index f26de8d99..d816f1b8c 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 } -- cgit From ff70e5019910c309f8ab38d729c4eb5819512698 Mon Sep 17 00:00:00 2001 From: David Freedman Date: Fri, 13 Jan 2023 15:40:06 +0000 Subject: Don't crash on unobtainable avatars (#22462) --- app/models/concerns/omniauthable.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/concerns/omniauthable.rb b/app/models/concerns/omniauthable.rb index a90d5d888..feac0a1f5 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 -- cgit From f33e22ae4c32d6a01b2e706bb0b55f961689f03f Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 13 Jan 2023 16:40:21 +0100 Subject: 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 --- app/controllers/api/v1/accounts/credentials_controller.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/api/v1/accounts/credentials_controller.rb b/app/controllers/api/v1/accounts/credentials_controller.rb index 64b5cb747..94b707771 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 -- cgit From d35fe3d5e3a45629634edde4c3d2726262c4f57e Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Fri, 13 Jan 2023 07:43:17 -0800 Subject: 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(+) (limited to 'app') diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml index f60d1c766..17c9e93dd 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 2a8fe2463..e5c7c0ea3 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 43b9654f1..e9f4d3746 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 -- cgit From 507e1d22f580b23d47d8dc0cb47f6f0b3170fc56 Mon Sep 17 00:00:00 2001 From: Darius Kazemi Date: Fri, 13 Jan 2023 08:14:39 -0800 Subject: 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(+) (limited to 'app') diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml index 17c9e93dd..59188833b 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 e5c7c0ea3..4f04430ee 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 e9f4d3746..f66e12c4c 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 -- cgit From d66dfc7b3c1b62a0d5276387ea8745da598afacc Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Sat, 14 Jan 2023 22:00:23 +0900 Subject: 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(-) (limited to 'app') diff --git a/app/views/relationships/show.html.haml b/app/views/relationships/show.html.haml index c82e639e0..2899cd514 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 4f04430ee..763110c77 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 48d3d4599..a320723bf 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: 팔로워 -- cgit