From 5917b46c0530777b684cbd661d0f454264e4f046 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 15 Dec 2022 14:15:50 +0100 Subject: Allow admins to refresh remotely-suspended accounts (#22327) * Change suspension text to mention that a remotely suspended account is not locally-suspended * Add ability to refresh profile of remotely suspended accounts --- app/views/admin/accounts/show.html.haml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index dc3b35956..db5c255c9 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -195,9 +195,13 @@ - if @account.suspended? %hr.spacer/ - %p.muted-hint= @deletion_request.present? ? t('admin.accounts.suspension_reversible_hint_html', date: content_tag(:strong, l(@deletion_request.due_at.to_date))) : t('admin.accounts.suspension_irreversible') + - if @account.suspension_origin_remote? + %p.muted-hint= @deletion_request.present? ? t('admin.accounts.remote_suspension_reversible_hint_html', date: content_tag(:strong, l(@deletion_request.due_at.to_date))) : t('admin.accounts.remote_suspension_irreversible') + - else + %p.muted-hint= @deletion_request.present? ? t('admin.accounts.suspension_reversible_hint_html', date: content_tag(:strong, l(@deletion_request.due_at.to_date))) : t('admin.accounts.suspension_irreversible') = link_to t('admin.accounts.undo_suspension'), unsuspend_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unsuspend, @account) + = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account) && @account.suspension_origin_remote? - if @deletion_request.present? = link_to t('admin.accounts.delete'), admin_account_path(@account.id), method: :delete, class: 'button button--destructive', data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, @account) -- cgit From bae6ef315ef6cd5cef8213ce84edbcba3eb3cec8 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 15 Dec 2022 15:47:23 +0100 Subject: Fix missing Javascript in domain block import confirmation page (#21471) Follow-up to #20597 --- app/views/admin/export_domain_blocks/import.html.haml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/views') diff --git a/app/views/admin/export_domain_blocks/import.html.haml b/app/views/admin/export_domain_blocks/import.html.haml index 01add232d..804e61199 100644 --- a/app/views/admin/export_domain_blocks/import.html.haml +++ b/app/views/admin/export_domain_blocks/import.html.haml @@ -1,6 +1,9 @@ - content_for :page_title do = t('admin.export_domain_blocks.import.title') +- content_for :header_tags do + = javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' + %p= t('admin.export_domain_blocks.import.description_html') - if defined?(@global_private_comment) && @global_private_comment.present? -- cgit From c50e9d078aa3c353afc140669f1cedcd354ee53e Mon Sep 17 00:00:00 2001 From: Francis Murillo Date: Thu, 15 Dec 2022 15:35:25 +0000 Subject: Render current day formats in the client timezone (#21878) * Fix remaining plain %time to %time.formatted * Add %time.relative-formatted to client format dates on the current day * Add missing comma dangle to formats * Use client side message format instead of the server * Add fallback message to relatve_format.today * Remove unused translation key and fix js lint issue Co-authored-by: Effy Elden --- app/javascript/mastodon/locales/en.json | 1 + app/javascript/packs/public.js | 38 ++++++++++++++++++++++ .../admin/report_notes/_report_note.html.haml | 7 ++-- app/views/admin/reports/show.html.haml | 7 ++-- app/views/disputes/strikes/show.html.haml | 7 ++-- app/views/settings/featured_tags/index.html.haml | 2 +- config/locales/en.yml | 1 - 7 files changed, 46 insertions(+), 17 deletions(-) (limited to 'app/views') diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 05b9353bf..997b0d9e5 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -461,6 +461,7 @@ "refresh": "Refresh", "regeneration_indicator.label": "Loading…", "regeneration_indicator.sublabel": "Your home feed is being prepared!", + "relative_format.today": "Today at {time}", "relative_time.days": "{number}d", "relative_time.full.days": "{number, plural, one {# day} other {# days}} ago", "relative_time.full.hours": "{number, plural, one {# hour} other {# hours}} ago", diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index 786fc8ede..a5e2014f7 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -63,6 +63,18 @@ function main() { minute: 'numeric', }); + const dateFormat = new Intl.DateTimeFormat(locale, { + year: 'numeric', + month: 'short', + day: 'numeric', + timeFormat: false, + }); + + const timeFormat = new Intl.DateTimeFormat(locale, { + timeStyle: 'short', + hour12: false, + }); + [].forEach.call(document.querySelectorAll('.emojify'), (content) => { content.innerHTML = emojify(content.innerHTML); }); @@ -75,6 +87,32 @@ function main() { content.textContent = formattedDate; }); + const isToday = date => { + const today = new Date(); + + return date.getDate() === today.getDate() && + date.getMonth() === today.getMonth() && + date.getFullYear() === today.getFullYear(); + }; + const todayFormat = new IntlMessageFormat(messages['relative_format.today'] || 'Today at {time}', locale); + + [].forEach.call(document.querySelectorAll('time.relative-formatted'), (content) => { + const datetime = new Date(content.getAttribute('datetime')); + + let formattedContent; + + if (isToday(datetime)) { + const formattedTime = timeFormat.format(datetime); + + formattedContent = todayFormat.format({ time: formattedTime }); + } else { + formattedContent = dateFormat.format(datetime); + } + + content.title = formattedContent; + content.textContent = formattedContent; + }); + [].forEach.call(document.querySelectorAll('time.time-ago'), (content) => { const datetime = new Date(content.getAttribute('datetime')); const now = new Date(); diff --git a/app/views/admin/report_notes/_report_note.html.haml b/app/views/admin/report_notes/_report_note.html.haml index 3bccd3b4b..14df2f609 100644 --- a/app/views/admin/report_notes/_report_note.html.haml +++ b/app/views/admin/report_notes/_report_note.html.haml @@ -4,11 +4,8 @@ .report-notes__item__header %span.username = link_to report_note.account.username, admin_account_path(report_note.account_id) - %time{ datetime: report_note.created_at.iso8601, title: l(report_note.created_at) } - - if report_note.created_at.today? - = t('admin.report_notes.today_at', time: l(report_note.created_at, format: :time)) - - else - = l report_note.created_at.to_date + %time.relative-formatted{ datetime: report_note.created_at } + = t('admin.report_notes.created_at') .report-notes__item__content = simple_format(h(report_note.content)) diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index cf960565f..50ec64b06 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -144,11 +144,8 @@ = link_to @report.account.username, admin_account_path(@report.account_id) - else = link_to @report.account.domain, admin_instance_path(@report.account.domain) - %time{ datetime: @report.created_at.iso8601, title: l(@report.created_at) } - - if @report.created_at.today? - = t('admin.report_notes.today_at', time: l(@report.created_at, format: :time)) - - else - = l @report.created_at.to_date + %time.relative-formatted{ datetime: @report.created_at.iso8601 } + = t('admin.report_notes.created_at') .report-notes__item__content = simple_format(h(@report.comment)) diff --git a/app/views/disputes/strikes/show.html.haml b/app/views/disputes/strikes/show.html.haml index 4a3005f72..cab0a17eb 100644 --- a/app/views/disputes/strikes/show.html.haml +++ b/app/views/disputes/strikes/show.html.haml @@ -110,11 +110,8 @@ .report-notes__item__header %span.username = link_to @appeal.account.username, can?(:show, @appeal.account) ? admin_account_path(@appeal.account_id) : short_account_url(@appeal.account) - %time{ datetime: @appeal.created_at.iso8601, title: l(@appeal.created_at) } - - if @appeal.created_at.today? - = t('admin.report_notes.today_at', time: l(@appeal.created_at, format: :time)) - - else - = l @appeal.created_at.to_date + %time.relative-formatted{ datetime: @appeal.created_at.iso8601 } + = t('admin.report_notes.created_at') .report-notes__item__content = simple_format(h(@appeal.text)) diff --git a/app/views/settings/featured_tags/index.html.haml b/app/views/settings/featured_tags/index.html.haml index 595094fc7..078abd788 100644 --- a/app/views/settings/featured_tags/index.html.haml +++ b/app/views/settings/featured_tags/index.html.haml @@ -26,6 +26,6 @@ - if featured_tag.last_status_at.nil? = t('accounts.nothing_here') - else - %time{ datetime: featured_tag.last_status_at.iso8601, title: l(featured_tag.last_status_at) }= l featured_tag.last_status_at + %time.formatted{ datetime: featured_tag.last_status_at.iso8601, title: l(featured_tag.last_status_at) }= l featured_tag.last_status_at = table_link_to 'trash', t('filters.index.delete'), settings_featured_tag_path(featured_tag), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } .trends__item__current= friendly_number_to_human featured_tag.statuses_count diff --git a/config/locales/en.yml b/config/locales/en.yml index 2fcfd4ee1..9f71e5ed7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -563,7 +563,6 @@ en: report_notes: created_msg: Report note successfully created! destroyed_msg: Report note successfully deleted! - today_at: Today at %{time} reports: account: notes: -- cgit From bbc49f15e030df4e75af06ece8c5302b80b69342 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 15 Dec 2022 16:44:29 +0100 Subject: Add explanation text to log-in page (#20946) --- app/views/auth/sessions/new.html.haml | 2 ++ config/locales/en.yml | 3 +++ 2 files changed, 5 insertions(+) (limited to 'app/views') diff --git a/app/views/auth/sessions/new.html.haml b/app/views/auth/sessions/new.html.haml index 304e3ab84..e98c1ff3d 100644 --- a/app/views/auth/sessions/new.html.haml +++ b/app/views/auth/sessions/new.html.haml @@ -6,6 +6,8 @@ - unless omniauth_only? = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| + %h1.title= t('auth.sign_in.title', domain: site_hostname) + %p.lead= t('auth.sign_in.preamble_html', domain: site_hostname) .fields-group - if use_seamless_external_login? = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.username_or_email'), input_html: { 'aria-label': t('simple_form.labels.defaults.username_or_email') }, hint: false diff --git a/config/locales/en.yml b/config/locales/en.yml index 9f71e5ed7..075ce2136 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -975,6 +975,9 @@ en: email_below_hint_html: If the below e-mail address is incorrect, you can change it here and receive a new confirmation e-mail. email_settings_hint_html: The confirmation e-mail was sent to %{email}. If that e-mail address is not correct, you can change it in account settings. title: Setup + sign_in: + preamble_html: Sign in with your %{domain} credentials. If your account is hosted on a different server, you will not be able to log in here. + title: Sign in to %{domain} sign_up: preamble: With an account on this Mastodon server, you'll be able to follow any other person on the network, regardless of where their account is hosted. title: Let's get you set up on %{domain}. -- cgit From 3656a6b9cc353f7f08a2d8f00c1b3f2fd8e3fb21 Mon Sep 17 00:00:00 2001 From: Jeong Arm Date: Fri, 16 Dec 2022 01:30:47 +0900 Subject: Add "disabled" user filter for admin/accounts UI (#21282) --- app/models/account_filter.rb | 2 +- app/views/admin/accounts/index.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app/views') diff --git a/app/models/account_filter.rb b/app/models/account_filter.rb index 3a4ac0492..d27bb46fc 100644 --- a/app/models/account_filter.rb +++ b/app/models/account_filter.rb @@ -81,7 +81,7 @@ class AccountFilter when 'suspended' Account.suspended when 'disabled' - accounts_with_users.merge(User.disabled) + accounts_with_users.merge(User.disabled).without_suspended when 'silenced' Account.silenced when 'sensitized' diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml index f33f788ed..d0897221d 100644 --- a/app/views/admin/accounts/index.html.haml +++ b/app/views/admin/accounts/index.html.haml @@ -13,7 +13,7 @@ .filter-subset.filter-subset--with-select %strong= t('admin.accounts.moderation.title') .input.select.optional - = select_tag :status, options_for_select([[t('admin.accounts.moderation.active'), 'active'], [t('admin.accounts.moderation.silenced'), 'silenced'], [t('admin.accounts.moderation.suspended'), 'suspended'], [safe_join([t('admin.accounts.moderation.pending'), "(#{number_with_delimiter(User.pending.count)})"], ' '), 'pending']], params[:status]), prompt: I18n.t('generic.all') + = select_tag :status, options_for_select([[t('admin.accounts.moderation.active'), 'active'], [t('admin.accounts.moderation.silenced'), 'silenced'], [t('admin.accounts.moderation.disabled'), 'disabled'], [t('admin.accounts.moderation.suspended'), 'suspended'], [safe_join([t('admin.accounts.moderation.pending'), "(#{number_with_delimiter(User.pending.count)})"], ' '), 'pending']], params[:status]), prompt: I18n.t('generic.all') .filter-subset.filter-subset--with-select %strong= t('admin.accounts.role') .input.select.optional -- cgit From b70c2e2167d60dd23a4c5011cce3112127a2616c Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 15 Dec 2022 20:30:46 +0100 Subject: Fix issue with glitch-soc theming --- app/views/admin/export_domain_blocks/import.html.haml | 3 --- 1 file changed, 3 deletions(-) (limited to 'app/views') diff --git a/app/views/admin/export_domain_blocks/import.html.haml b/app/views/admin/export_domain_blocks/import.html.haml index 804e61199..01add232d 100644 --- a/app/views/admin/export_domain_blocks/import.html.haml +++ b/app/views/admin/export_domain_blocks/import.html.haml @@ -1,9 +1,6 @@ - content_for :page_title do = t('admin.export_domain_blocks.import.title') -- content_for :header_tags do - = javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous' - %p= t('admin.export_domain_blocks.import.description_html') - if defined?(@global_private_comment) && @global_private_comment.present? -- cgit From 22d9306edc2be8e38a7264b6f3eae04006d44c09 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 21 Dec 2022 23:49:08 +0100 Subject: Add links to glitch-soc's Crowdin (#2033) * Add link to glitch-soc's crowdin in app settings * Add mention of translations to CONTRIBUTING.md --- CONTRIBUTING.md | 6 ++++++ app/views/settings/preferences/appearance/show.html.haml | 2 ++ config/locales-glitch/en.yml | 4 ++++ 3 files changed, 12 insertions(+) (limited to 'app/views') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 049cd4e29..ed670f5a6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,6 +6,12 @@ Here are some guidelines, and ways you can help. > (This document is a bit of a work-in-progress, so please bear with us. > If you don't see what you're looking for here, please don't hesitate to reach out!) +## Translations + +You can submit glitch-soc-specific translations via [Crowdin](https://crowdin.com/project/glitch-soc). They are periodically merged into the codebase. + +[![Crowdin](https://badges.crowdin.net/glitch-soc/localized.svg)](https://crowdin.com/project/glitch-soc) + ## Planning ## Right now a lot of the planning for this project takes place in our development Discord, or through GitHub Issues and Projects. diff --git a/app/views/settings/preferences/appearance/show.html.haml b/app/views/settings/preferences/appearance/show.html.haml index a252289b0..946cb845d 100644 --- a/app/views/settings/preferences/appearance/show.html.haml +++ b/app/views/settings/preferences/appearance/show.html.haml @@ -11,6 +11,8 @@ - unless I18n.locale == :en .flash-message.translation-prompt #{t 'appearance.localization.body'} #{content_tag(:a, t('appearance.localization.guide_link_text'), href: t('appearance.localization.guide_link'), target: "_blank", rel: "noopener")} + = link_to t('appearance.localization.glitch_guide_link'), target: '_blank', rel: 'noopener noreferrer' do + = t('appearance.localization.glitch_guide_link_text') %h4= t 'appearance.advanced_web_interface' diff --git a/config/locales-glitch/en.yml b/config/locales-glitch/en.yml index 490069f20..e60a89e18 100644 --- a/config/locales-glitch/en.yml +++ b/config/locales-glitch/en.yml @@ -28,6 +28,10 @@ en: trending_status_cw: desc_html: When trending posts are enabled, allow posts with Content Warnings to be eligible. Changes to this setting are not retroactive. title: Allow posts with Content Warnings to trend + appearance: + localization: + glitch_guide_link: https://crowdin.com/project/glitch-soc + glitch_guide_link_text: And likewise for glitch-soc! auth: captcha_confirmation: hint_html: Just one more step! To confirm your account, this server requires you to solve a CAPTCHA. You can contact the server administrator if you have questions or need assistance with confirming your account. -- cgit From b8ad446f77479010997a4a3c52fa7b47fb403eed Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 5 Jan 2023 13:35:28 +0100 Subject: Fix incorrectly formatted datetime in account moderation note timestamp (#22555) * Fix incorrectly formatted datetime in account moderation note timestamp Fix oversight from #21878 * Fix use of non-existent translation string --- app/views/admin/report_notes/_report_note.html.haml | 4 ++-- app/views/admin/reports/show.html.haml | 2 +- app/views/disputes/strikes/show.html.haml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/views/admin/report_notes/_report_note.html.haml b/app/views/admin/report_notes/_report_note.html.haml index 14df2f609..54c252ee8 100644 --- a/app/views/admin/report_notes/_report_note.html.haml +++ b/app/views/admin/report_notes/_report_note.html.haml @@ -4,8 +4,8 @@ .report-notes__item__header %span.username = link_to report_note.account.username, admin_account_path(report_note.account_id) - %time.relative-formatted{ datetime: report_note.created_at } - = t('admin.report_notes.created_at') + %time.relative-formatted{ datetime: report_note.created_at.iso8601 } + = l report_note.created_at.to_date .report-notes__item__content = simple_format(h(report_note.content)) diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index 50ec64b06..5a45b9b78 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -145,7 +145,7 @@ - else = link_to @report.account.domain, admin_instance_path(@report.account.domain) %time.relative-formatted{ datetime: @report.created_at.iso8601 } - = t('admin.report_notes.created_at') + = l @report.created_at.to_date .report-notes__item__content = simple_format(h(@report.comment)) diff --git a/app/views/disputes/strikes/show.html.haml b/app/views/disputes/strikes/show.html.haml index cab0a17eb..7797348dd 100644 --- a/app/views/disputes/strikes/show.html.haml +++ b/app/views/disputes/strikes/show.html.haml @@ -111,7 +111,7 @@ %span.username = link_to @appeal.account.username, can?(:show, @appeal.account) ? admin_account_path(@appeal.account_id) : short_account_url(@appeal.account) %time.relative-formatted{ datetime: @appeal.created_at.iso8601 } - = t('admin.report_notes.created_at') + = l @appeal.created_at.to_date .report-notes__item__content = simple_format(h(@appeal.text)) -- cgit From 70b3207e33743290e55b67a4b88cddbed36c1903 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 5 Jan 2023 13:35:47 +0100 Subject: Add a11y tags to the modal (#22549) Closes #22547 --- app/views/layouts/modal.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/layouts/modal.html.haml b/app/views/layouts/modal.html.haml index c0ea211ff..bbdae602f 100644 --- a/app/views/layouts/modal.html.haml +++ b/app/views/layouts/modal.html.haml @@ -8,7 +8,7 @@ .name = t 'users.signed_in_as' %span.username @#{current_account.local_username_and_domain} - = link_to destroy_user_session_path(continue: true), method: :delete, class: 'logout-link icon-button' do + = link_to destroy_user_session_path(continue: true), method: :delete, class: 'logout-link icon-button', title: t('applications.logout'), 'aria-label': t('applications.logout') do = fa_icon 'sign-out' .container-alt= yield -- cgit From 2ba14097ffb377d1a07fb08612ba3d7727ae437e Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 11 Jan 2023 21:51:43 +0100 Subject: Change trending tags admin interface to always show batch actions (#23013) Fixes #22565 --- app/views/admin/trends/tags/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/admin/trends/tags/index.html.haml b/app/views/admin/trends/tags/index.html.haml index bde32a295..1ea34c9e3 100644 --- a/app/views/admin/trends/tags/index.html.haml +++ b/app/views/admin/trends/tags/index.html.haml @@ -23,7 +23,7 @@ - Trends::TagFilter::KEYS.each do |key| = hidden_field_tag key, params[key] if params[key].present? - .batch-table.optional + .batch-table .batch-table__toolbar %label.batch-table__toolbar__select.batch-checkbox-all = check_box_tag :batch_checkbox_all, nil, false -- cgit 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 +- .../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 (limited to 'app/views') 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' 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 000000000..6609798dc --- /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 -- 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/views') 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/views') 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 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/views') 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/views') 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/views') 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