From 5436b8796da7078c29bae19e95b868a0867fca63 Mon Sep 17 00:00:00 2001 From: KMY Date: Fri, 7 Jul 2023 08:56:01 +0900 Subject: [PATCH 1/6] Add markdown config translation --- app/controllers/settings/profiles_controller.rb | 2 +- app/helpers/formatting_helper.rb | 2 +- app/models/concerns/has_user_settings.rb | 4 ++++ app/models/user_settings.rb | 1 + app/services/update_account_service.rb | 6 ++++++ app/views/settings/profiles/show.html.haml | 4 ++++ config/locales/simple_form.en.yml | 1 + config/locales/simple_form.ja.yml | 1 + 8 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/controllers/settings/profiles_controller.rb b/app/controllers/settings/profiles_controller.rb index 030c3765c2..9f00b3dc48 100644 --- a/app/controllers/settings/profiles_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -20,7 +20,7 @@ class Settings::ProfilesController < Settings::BaseController private def account_params - params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :group_allow_private_message, :discoverable, :hide_collections, fields_attributes: [:name, :value]) + params.require(:account).permit(:display_name, :note, :bio_markdown, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :group_allow_private_message, :discoverable, :hide_collections, fields_attributes: [:name, :value]) end def set_account diff --git a/app/helpers/formatting_helper.rb b/app/helpers/formatting_helper.rb index 2ce50505c9..024ea64fbb 100644 --- a/app/helpers/formatting_helper.rb +++ b/app/helpers/formatting_helper.rb @@ -54,7 +54,7 @@ module FormattingHelper end def account_bio_format(account) - html_aware_format(account.note, account.local?, markdown: true) + html_aware_format(account.note, account.local?, markdown: account.user&.setting_bio_markdown) end def account_field_value_format(field, with_rel_me: true) diff --git a/app/models/concerns/has_user_settings.rb b/app/models/concerns/has_user_settings.rb index 9a8a6378a9..0b7a387b9f 100644 --- a/app/models/concerns/has_user_settings.rb +++ b/app/models/concerns/has_user_settings.rb @@ -107,6 +107,10 @@ module HasUserSettings settings['theme'] end + def setting_bio_markdown + settings['bio_markdown'] + end + def setting_display_media settings['web.display_media'] end diff --git a/app/models/user_settings.rb b/app/models/user_settings.rb index 6a0c573357..5e32e9b61d 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -12,6 +12,7 @@ class UserSettings setting :theme, default: -> { ::Setting.theme } setting :noindex, default: -> { ::Setting.noindex } setting :noai, default: true + setting :bio_markdown, default: false setting :hide_statuses_count, default: false setting :hide_following_count, default: false setting :hide_followers_count, default: false diff --git a/app/services/update_account_service.rb b/app/services/update_account_service.rb index 7ff757c8e4..625097a16d 100644 --- a/app/services/update_account_service.rb +++ b/app/services/update_account_service.rb @@ -5,6 +5,12 @@ class UpdateAccountService < BaseService was_locked = account.locked update_method = raise_error ? :update! : :update + if account.user && params.key?(:bio_markdown) + user_params = { settings_attributes: { bio_markdown: params['bio_markdown'] } } + params.delete(:bio_markdown) + account.user.send(update_method, user_params) + end + account.send(update_method, params).tap do |ret| next unless ret diff --git a/app/views/settings/profiles/show.html.haml b/app/views/settings/profiles/show.html.haml index 3c0f030733..22ffeb17df 100644 --- a/app/views/settings/profiles/show.html.haml +++ b/app/views/settings/profiles/show.html.haml @@ -12,6 +12,10 @@ = f.input :display_name, wrapper: :with_label, input_html: { maxlength: 30, data: { default: @account.username } }, hint: false = f.input :note, wrapper: :with_label, input_html: { maxlength: 500 }, hint: false + = f.simple_fields_for :settings, current_user.settings do |ff| + .fields-group + = ff.input :bio_markdown, input_html: { name: 'account[bio_markdown]' }, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_bio_markdown') + .fields-row .fields-row__column.fields-row__column-6 = render 'application/card', account: @account diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index c3cdef3740..1cf2f76d53 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -206,6 +206,7 @@ en: setting_aggregate_reblogs: Group boosts in timelines setting_always_send_emails: Always send e-mail notifications setting_auto_play_gif: Auto-play animated GIFs + setting_bio_markdown: Enable profile markdown setting_boost_modal: Show confirmation dialog before boosting setting_crop_images: Crop images in non-expanded posts to 16x9 setting_default_language: Posting language diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index d3deed69eb..d58f52b8f2 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -214,6 +214,7 @@ ja: setting_aggregate_reblogs: ブーストをまとめる setting_always_send_emails: 常にメール通知を送信する setting_auto_play_gif: アニメーションGIFを自動再生する + setting_bio_markdown: プロフィールのMarkdownを有効にする setting_boost_modal: ブーストする前に確認ダイアログを表示する setting_crop_images: 投稿の詳細以外では画像を16:9に切り抜く setting_default_language: 投稿する言語 From a66207e1ca6d56edd2488de8731abe158798f490 Mon Sep 17 00:00:00 2001 From: KMY Date: Fri, 7 Jul 2023 17:10:25 +0900 Subject: [PATCH 2/6] Fix some translations --- app/javascript/mastodon/locales/en.json | 4 ++++ app/javascript/mastodon/locales/ja.json | 3 +++ 2 files changed, 7 insertions(+) diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index cfb68c5a27..c8485aa518 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -14,6 +14,7 @@ "about.powered_by": "Decentralized social media powered by {mastodon}", "about.rules": "Server rules", "account.account_note_header": "Note", + "account.add_or_remove_from_antenna": "Add or Remove from antennas", "account.add_or_remove_from_list": "Add or Remove from lists", "account.badges.bot": "Bot", "account.badges.group": "Group", @@ -626,6 +627,8 @@ "status.edited": "Edited {date}", "status.edited_x_times": "Edited {count, plural, one {{count} time} other {{count} times}}", "status.embed": "Embed", + "status.emoji_reaction": "Stamp", + "status.emoji_reaction.pick": "Pick stamp", "status.expiration.add": "Set status expired time", "status.favourite": "Favourite", "status.filter": "Filter this post", @@ -648,6 +651,7 @@ "status.reblogged_by": "{name} boosted", "status.reblogs.empty": "No one has boosted this post yet. When someone does, they will show up here.", "status.redraft": "Delete & re-draft", + "status.reference": "Reference", "status.remove_bookmark": "Remove bookmark", "status.replied_to": "Replied to {name}", "status.reply": "Reply", diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json index 16b6b71bf2..05e4ca0348 100644 --- a/app/javascript/mastodon/locales/ja.json +++ b/app/javascript/mastodon/locales/ja.json @@ -14,6 +14,7 @@ "about.powered_by": "{mastodon}による分散型ソーシャルメディア", "about.rules": "サーバーのルール", "account.account_note_header": "メモ", + "account.add_or_remove_from_antenna": "アンテナから追加または外す", "account.add_or_remove_from_list": "リストから追加または外す", "account.badges.bot": "Bot", "account.badges.group": "Group", @@ -624,6 +625,7 @@ "status.edited_x_times": "{count}回編集", "status.embed": "埋め込み", "status.emoji_reaction": "スタンプ", + "status.emoji_reaction.pick": "スタンプを押す", "status.expiration.add": "時限投稿を設定", "status.favourite": "お気に入り", "status.filter": "この投稿をフィルターする", @@ -646,6 +648,7 @@ "status.reblogged_by": "{name}さんがブースト", "status.reblogs.empty": "まだ誰もブーストしていません。ブーストされるとここに表示されます。", "status.redraft": "削除して下書きに戻す", + "status.reference": "参照", "status.remove_bookmark": "ブックマークを削除", "status.replied_to": "{name}さんへの返信", "status.reply": "返信", From 30e4bb8d876e1953c6de9aecb26ffecefc1c6f4a Mon Sep 17 00:00:00 2001 From: KMY Date: Fri, 7 Jul 2023 17:10:38 +0900 Subject: [PATCH 3/6] Fix duplicated post url reference --- app/services/resolve_url_service.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/services/resolve_url_service.rb b/app/services/resolve_url_service.rb index d8e795f3b0..2bcbbf200c 100644 --- a/app/services/resolve_url_service.rb +++ b/app/services/resolve_url_service.rb @@ -5,6 +5,7 @@ class ResolveURLService < BaseService include Authorization USERNAME_STATUS_RE = %r{/@(?#{Account::USERNAME_RE})/(?[0-9]+)\Z} + REMOTE_USERNAME_STATUS_RE = %r{/@(?#{Account::USERNAME_RE}@#{Account::USERNAME_RE})/(?[0-9]+)\Z} def call(url, on_behalf_of: nil) @url = url @@ -89,13 +90,17 @@ class ResolveURLService < BaseService def process_local_url recognized_params = Rails.application.routes.recognize_path(@url) - return unless recognized_params[:action] == 'show' - if recognized_params[:controller] == 'statuses' status = Status.find_by(id: recognized_params[:id]) check_local_status(status) elsif recognized_params[:controller] == 'accounts' Account.find_local(recognized_params[:username]) + elsif recognized_params[:controller] == 'home' && recognized_params[:action] == 'index' + parsed_url = Addressable::URI.parse(@url) + parsed_url.path.match(REMOTE_USERNAME_STATUS_RE) do |matched| + status = Status.find_by(id: matched[:status_id]) + check_local_status(status) + end end end From 403dfc1d2db470ebad5b9bda559814034179858e Mon Sep 17 00:00:00 2001 From: KMY Date: Fri, 7 Jul 2023 17:42:31 +0900 Subject: [PATCH 4/6] Change private searchability name --- app/javascript/mastodon/locales/en.json | 4 ++-- app/javascript/mastodon/locales/ja.json | 8 ++++---- config/locales/en.yml | 4 ++-- config/locales/ja.yml | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index c8485aa518..610e062f64 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -590,8 +590,8 @@ "searchability.private.short": "Reactionners", "searchability.public.long": "Anyone can find", "searchability.public.short": "Public", - "searchability.unlisted.long": "Your followers can find", - "searchability.unlisted.short": "Followers", + "searchability.unlisted.long": "Your followers and reactionners can find", + "searchability.unlisted.short": "Followers and reactionners", "search_popout.quick_actions": "Quick actions", "search_popout.recent": "Recent searches", "search_results.accounts": "Profiles", diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json index 05e4ca0348..1a31cac16c 100644 --- a/app/javascript/mastodon/locales/ja.json +++ b/app/javascript/mastodon/locales/ja.json @@ -583,12 +583,12 @@ "searchability.change": "検索許可範囲を変更", "searchability.direct.long": "この投稿はあなたしか検索できません", "searchability.direct.short": "自分のみ", - "searchability.private.long": "この投稿にリアクションした人だけが検索できます", - "searchability.private.short": "リアクションした人のみ", + "searchability.private.long": "この投稿に反応した人だけが検索できます", + "searchability.private.short": "反応者のみ", "searchability.public.long": "この投稿は誰でも検索できます", "searchability.public.short": "全て", - "searchability.unlisted.long": "この投稿はあなたのフォロワーしか検索できません", - "searchability.unlisted.short": "フォロワーのみ", + "searchability.unlisted.long": "この投稿はあなたのフォロワーと反応者だけが検索できます", + "searchability.unlisted.short": "フォロワーと反応者", "search_popout.quick_actions": "クイック操作", "search_popout.recent": "最近の検索", "search_results.accounts": "ユーザー", diff --git a/config/locales/en.yml b/config/locales/en.yml index cb7b616c1a..531a9c8402 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1716,8 +1716,8 @@ en: direct_long: Reacter of this post can find limited: Self only limited_long: Nobody can find, but you can - private: Followers only - private_long: Your followers can find + private: Followers and reactionners + private_long: Your followers and reactionners can find public: Public public_long: Anyone can find show_more: Show more diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 7052d023e3..d8cc4ee465 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1640,12 +1640,12 @@ ja: other: "%{count}票" vote: 投票 searchabilities: - direct: リアクションした人 - direct_long: この投稿にリアクションした人しか検索できません + direct: 反応者 + direct_long: この投稿に反応した人しか検索できません limited: 自分のみ limited_long: この投稿はあなたしか検索できません - private: フォロワーのみ - private_long: この投稿はフォロワーのみが検索できます + private: フォロワーと反応者 + private_long: この投稿はフォロワーと反応者のみが検索できます public: 全て public_long: この投稿は誰でも検索できます show_more: もっと見る From d773c74b9e3e537b72e6dfbe6e264b26c3b83ed3 Mon Sep 17 00:00:00 2001 From: KMY Date: Sat, 8 Jul 2023 08:01:06 +0900 Subject: [PATCH 5/6] Bump version to v4.1.4 (#25805) --- .github/workflows/build-image.yml | 4 +++- CHANGELOG.md | 10 +++++++++- app/lib/text_formatter.rb | 2 +- lib/mastodon/version.rb | 2 +- lib/tasks/branding.rake | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 982031c9d8..f9dd36e36f 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -49,8 +49,10 @@ jobs: images: | tootsuite/mastodon ghcr.io/mastodon/mastodon + # Only tag with latest when ran against the latest stable branch + # This needs to be updated after each minor version release flavor: | - latest=auto + latest=${{ startsWith(github.ref, 'refs/tags/v4.1.') && 'auto' || 'false' }} tags: | type=edge,branch=main type=pep440,pattern={{raw}} diff --git a/CHANGELOG.md b/CHANGELOG.md index 425c098505..d6f1b7bcb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## [4.1.4] - 2023-07-07 + +### Fixed + +- Fix branding:generate_app_icons failing because of disallowed ICO coder ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/25794)) +- Fix crash in admin interface when viewing a remote user with verified links ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/25796)) +- Fix processing of media files with unusual names ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/25788)) + ## [4.1.3] - 2023-07-06 ### Added @@ -29,7 +37,7 @@ All notable changes to this project will be documented in this file. - Fix multiple inefficiencies in automatic post cleanup worker ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/24607), [ClearlyClaire](https://github.com/mastodon/mastodon/pull/24785), [ClearlyClaire](https://github.com/mastodon/mastodon/pull/24840)) - Fix performance of streaming by parsing message JSON once ([ThisIsMissEm](https://github.com/mastodon/mastodon/pull/25278), [ThisIsMissEm](https://github.com/mastodon/mastodon/pull/25361)) - Fix CSP headers when `S3_ALIAS_HOST` includes a path component ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/25273)) -- Fix `tootctl accounts approve --number N` not aproving N earliest registrations ([danielmbrasil](https://github.com/mastodon/mastodon/pull/24605)) +- Fix `tootctl accounts approve --number N` not approving N earliest registrations ([danielmbrasil](https://github.com/mastodon/mastodon/pull/24605)) - Fix reports not being closed when performing batch suspensions ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/24988)) - Fix being able to vote on your own polls ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/25015)) - Fix race condition when reblogging a status ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/25016)) diff --git a/app/lib/text_formatter.rb b/app/lib/text_formatter.rb index 74626b63b8..abc050ad6b 100644 --- a/app/lib/text_formatter.rb +++ b/app/lib/text_formatter.rb @@ -65,7 +65,7 @@ class TextFormatter suffix = url[prefix.length + 30..-1] cutoff = url[prefix.length..-1].length > 30 - <<~HTML.squish + <<~HTML.squish.html_safe # rubocop:disable Rails/OutputSafety #{h(display_url)} HTML rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 5135e5b216..782ad6c665 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -13,7 +13,7 @@ module Mastodon end def patch - 3 + 4 end def flags diff --git a/lib/tasks/branding.rake b/lib/tasks/branding.rake index d1c1c9dede..d97c97c99e 100644 --- a/lib/tasks/branding.rake +++ b/lib/tasks/branding.rake @@ -40,7 +40,7 @@ namespace :branding do output_dest = Rails.root.join('app', 'javascript', 'icons') rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '-w :size -h :size --keep-aspect-ratio :input -o :output') - convert = Terrapin::CommandLine.new('convert', ':input :output') + convert = Terrapin::CommandLine.new('convert', ':input :output', environment: { 'MAGICK_CONFIGURE_PATH' => nil }) favicon_sizes = [16, 32, 48] apple_icon_sizes = [57, 60, 72, 76, 114, 120, 144, 152, 167, 180, 1024] From 95d65c971c788ee2df8aa5225b91dc17d063704c Mon Sep 17 00:00:00 2001 From: KMY Date: Sat, 8 Jul 2023 11:17:09 +0900 Subject: [PATCH 6/6] Fix referred_by api returns permitted status only --- .../referred_by_statuses_controller.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/statuses/referred_by_statuses_controller.rb b/app/controllers/api/v1/statuses/referred_by_statuses_controller.rb index d6f245b6f9..70f04df209 100644 --- a/app/controllers/api/v1/statuses/referred_by_statuses_controller.rb +++ b/app/controllers/api/v1/statuses/referred_by_statuses_controller.rb @@ -19,15 +19,26 @@ class Api::V1::Statuses::ReferredByStatusesController < Api::BaseController end def cached_references - cache_collection(results, Status) + results end def results - @results ||= Status.where(id: @status.referenced_by_status_objects.select(:status_id), visibility: [:public, :public_unlisted, :unlisted, :login]).paginate_by_max_id( + return @results if @results + + account = current_user&.account + statuses = Status.where(id: @status.referenced_by_status_objects.select(:status_id)) + account_ids = statuses.map(&:account_id).uniq + domains = statuses.filter_map(&:account_domain).uniq + relations = account&.relations_map(account_ids, domains) || {} + + statuses = cache_collection_paginated_by_id( + statuses, + Status, limit_param(DEFAULT_STATUSES_LIMIT), - params[:max_id], - params[:since_id] + params_slice(:max_id, :since_id, :min_id) ) + + @results = statuses.filter { |status| !StatusFilter.new(status, account, relations).filtered? } end def insert_pagination_headers