From 2db9d6ac92cf8eb26badfe18a3fa847d229085a2 Mon Sep 17 00:00:00 2001 From: aoisensi <1350990+aoisensi@users.noreply.github.com> Date: Mon, 18 Mar 2024 14:18:19 +0900 Subject: [PATCH 01/14] =?UTF-8?q?Fix:=20=E3=81=8A=E7=9F=A5=E3=82=89?= =?UTF-8?q?=E3=81=9B=E3=81=AE=E3=83=9A=E3=83=BC=E3=82=B8=E9=80=81=E3=82=8A?= =?UTF-8?q?=E3=81=AE=E6=95=B0=E5=AD=97=E3=81=8C=E3=81=9A=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=20(#656)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/styles/mastodon/components.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 01c397d974..ed763a4db7 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -4142,6 +4142,10 @@ a.status-card { .announcements { z-index: 1; position: relative; + + .announcements__pagination > * { + vertical-align: middle; + } } } From a670b1055219b517af4c9b5804f11b3666de53bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Tue, 19 Mar 2024 12:04:21 +0900 Subject: [PATCH 02/14] =?UTF-8?q?Add:=20=E8=B2=A2=E7=8C=AE=E8=80=85=20(#65?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AUTHORS_KB.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS_KB.md b/AUTHORS_KB.md index 3f17d5563a..2cda5fd31d 100644 --- a/AUTHORS_KB.md +++ b/AUTHORS_KB.md @@ -5,6 +5,7 @@ kmyblueフォークは、以下の方の貢献によって成り立っています。 本家Mastodonの貢献者については、`AUTHORS.md`をご覧ください。 +- [aoisensi](https://github.com/aoisensi) - [KMY](https://github.com/kmycode) - [S-H-GAMELINKS](https://github.com/S-H-GAMELINKS) - [Yuicho](https://github.com/yuicho) @@ -12,6 +13,6 @@ kmyblueフォークは、以下の方の貢献によって成り立っていま ## 特記 kmyblueフォークの開発にあたって、API・Activity仕様の設計(一部機能については内部仕様)策定の過程で下記リポジトリのコードを参考にしました。 -kmyblueフォークに直接貢献したわけではありませんが、以下のリポジトリにある絵文字リアクション機能・検索範囲機能のコードのうち、ごく一部ではありますがkmyblueへ転写した箇所がございますため、お名前記載させていただきます。 +kmyblueフォークに直接貢献したわけではありませんが、以下のリポジトリにある絵文字リアクション機能・検索範囲機能のコードのうち一部にkmyblueへ転写した箇所がございますため、お名前記載させていただきます。 - [Fedibird](https://github.com/fedibird/mastodon) From 08d6cf2a38eec3c0a85ae5717c07b158c9549b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Thu, 21 Mar 2024 15:15:14 +0900 Subject: [PATCH 03/14] =?UTF-8?q?Fix:=20#655=20=E3=82=BB=E3=83=B3=E3=82=B7?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=83=96=E3=83=95=E3=83=A9=E3=82=B0=E4=BB=98?= =?UTF-8?q?=E3=81=8D=E3=81=AE=E7=94=BB=E5=83=8F=E3=82=92=E7=B7=A8=E9=9B=86?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A8=E3=83=95=E3=83=A9=E3=82=B0=E3=81=8C?= =?UTF-8?q?=E5=A4=96=E3=82=8C=E3=82=8B=20(#662)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/reducers/compose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 62a5904736..28fbe9068e 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -629,7 +629,7 @@ export default function compose(state = initialState, action) { map.set('spoiler', true); map.set('spoiler_text', action.spoiler_text); } else { - map.set('spoiler', false); + map.set('spoiler', action.status.get('sensitive')); map.set('spoiler_text', ''); } From f096449e7feb46bd45ed7651b8dd8bec1f511dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Wed, 27 Mar 2024 08:32:05 +0900 Subject: [PATCH 04/14] =?UTF-8?q?Change:=20#671=20=E3=80=8C=E3=83=A1?= =?UTF-8?q?=E3=83=87=E3=82=A3=E3=82=A2=E3=82=92=E5=B8=B8=E3=81=AB=E9=96=B2?= =?UTF-8?q?=E8=A6=A7=E6=B3=A8=E6=84=8F=E3=81=A8=E3=81=97=E3=81=A6=E3=83=9E?= =?UTF-8?q?=E3=83=BC=E3=82=AF=E3=81=99=E3=82=8B=E3=80=8D=E3=82=92ON?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E6=99=82=E3=80=81?= =?UTF-8?q?=EF=BC=92=E6=9E=9A=E7=9B=AE=E4=BB=A5=E9=99=8D=E3=81=AE=E7=94=BB?= =?UTF-8?q?=E5=83=8F=E3=82=A2=E3=83=83=E3=83=97=E3=83=AD=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=81=A7=E3=82=BB=E3=83=B3=E3=82=B7=E3=83=86=E3=82=A3=E3=83=96?= =?UTF-8?q?=E3=83=95=E3=83=A9=E3=82=B0=E3=82=92=E4=BB=98=E3=81=91=E3=81=AA?= =?UTF-8?q?=E3=81=84=20(#673)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/actions/compose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 03392a8c79..0c161d6642 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -337,7 +337,7 @@ export function uploadCompose(files) { if (status === 200) { dispatch(uploadComposeSuccess(data, file)); - if (defaultSensitive && !spoiler) { + if (defaultSensitive && !spoiler && (media.size + i) === 0) { dispatch(changeComposeSpoilerness()); } } else if (status === 202) { From de9ab9042f50d48fa25146f551782ce22456a8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Wed, 27 Mar 2024 12:11:11 +0900 Subject: [PATCH 05/14] =?UTF-8?q?Fix:=20=E3=83=89=E3=83=A1=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF=E3=81=AE=E3=83=88?= =?UTF-8?q?=E3=83=AC=E3=83=B3=E3=83=89=E6=8E=B2=E8=BC=89=E3=82=92=E6=8B=92?= =?UTF-8?q?=E5=90=A6=E3=81=AB=E3=80=81=E3=83=8F=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E3=82=BF=E3=82=B0=E3=81=8C=E5=90=AB=E3=81=BE=E3=82=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E5=95=8F=E9=A1=8C=20(#676)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/trends/tags.rb | 1 + spec/models/trends/tags_spec.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/models/trends/tags.rb b/app/models/trends/tags.rb index 03707d6870..5b00fca7ec 100644 --- a/app/models/trends/tags.rb +++ b/app/models/trends/tags.rb @@ -13,6 +13,7 @@ class Trends::Tags < Trends::Base def register(status, at_time = Time.now.utc) return unless !status.reblog? && %i(public public_unlisted login).include?(status.visibility.to_sym) && !status.account.silenced? + return if !status.account.local? && DomainBlock.block_trends?(status.account.domain) status.tags.each do |tag| add(tag, status.account_id, at_time) if tag.usable? diff --git a/spec/models/trends/tags_spec.rb b/spec/models/trends/tags_spec.rb index f2818fca87..91ca91f078 100644 --- a/spec/models/trends/tags_spec.rb +++ b/spec/models/trends/tags_spec.rb @@ -23,6 +23,33 @@ RSpec.describe Trends::Tags do end end + describe '#register' do + let(:tag) { Fabricate(:tag, usable: true) } + let(:account) { Fabricate(:account) } + let(:status) { Fabricate(:status, account: account, tags: [tag], created_at: at_time, updated_at: at_time) } + + it 'records history' do + subject.register(status, at_time) + expect(tag.history.get(at_time).accounts).to eq 1 + expect(tag.history.get(at_time).uses).to eq 1 + expect(subject.send(:recently_used_ids, at_time)).to eq [tag.id] + end + + context 'when account is rejected appending trends' do + let(:account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') } + + before do + Fabricate(:domain_block, domain: 'example.com', block_trends: true, severity: :noop) + end + + it 'does not record history' do + subject.register(status, at_time) + expect(tag.history.get(at_time).accounts).to eq 0 + expect(tag.history.get(at_time).uses).to eq 0 + end + end + end + describe '#query' do it 'returns a composable query scope' do expect(subject.query).to be_a Trends::Query From aef6d96d55a6dee35ece4b7d47cbe021f272cd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Mon, 1 Apr 2024 08:54:16 +0900 Subject: [PATCH 06/14] =?UTF-8?q?Fix:=20=E6=8A=95=E7=A8=BF=E3=81=ABNG?= =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=83=89=E3=81=8C=E5=90=AB=E3=81=BE=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E5=A0=B4=E5=90=88=E3=80=81=E6=8A=95=E7=A8=BF=E3=81=AE?= =?UTF-8?q?=E3=83=A2=E3=83=87=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=81=8C=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=8F=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=8C=E3=81=82=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=20(#685)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin/statuses_controller.rb | 12 ++++++++---- app/models/admin/status_batch_action.rb | 4 ++-- app/services/approve_appeal_service.rb | 4 ++-- app/services/update_status_service.rb | 4 ++++ spec/services/update_status_service_spec.rb | 7 +++++++ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/controllers/admin/statuses_controller.rb b/app/controllers/admin/statuses_controller.rb index 5fdea8c52f..64b516d815 100644 --- a/app/controllers/admin/statuses_controller.rb +++ b/app/controllers/admin/statuses_controller.rb @@ -34,7 +34,8 @@ module Admin UpdateStatusService.new.call( @status, edit_status_account_id, - no_history: true + no_history: true, + bypass_validation: true ) log_action(:remove_history, @status) redirect_to admin_account_status_path @@ -46,7 +47,8 @@ module Admin @status, edit_status_account_id, media_ids: [], - media_attributes: [] + media_attributes: [], + bypass_validation: true ) log_action(:remove_media, @status) redirect_to admin_account_status_path @@ -57,7 +59,8 @@ module Admin UpdateStatusService.new.call( @status, edit_status_account_id, - sensitive: true + sensitive: true, + bypass_validation: true ) log_action(:force_sensitive, @status) redirect_to admin_account_status_path @@ -68,7 +71,8 @@ module Admin UpdateStatusService.new.call( @status, edit_status_account_id, - spoiler_text: 'CW' + spoiler_text: 'CW', + bypass_validation: true ) log_action(:force_cw, @status) redirect_to admin_account_status_path diff --git a/app/models/admin/status_batch_action.rb b/app/models/admin/status_batch_action.rb index 99274c85b2..d295b01e28 100644 --- a/app/models/admin/status_batch_action.rb +++ b/app/models/admin/status_batch_action.rb @@ -83,7 +83,7 @@ class Admin::StatusBatchAction authorize([:admin, status], :update?) if target_account.local? - UpdateStatusService.new.call(status, representative_account.id, sensitive: true) + UpdateStatusService.new.call(status, representative_account.id, sensitive: true, bypass_validation: true) else status.update(sensitive: true) end @@ -119,7 +119,7 @@ class Admin::StatusBatchAction status_text = "#{status.spoiler_text}\n\n#{status_text}" if status.spoiler_text if target_account.local? - UpdateStatusService.new.call(status, representative_account.id, spoiler_text: 'CW', text: status_text) + UpdateStatusService.new.call(status, representative_account.id, spoiler_text: 'CW', text: status_text, bypass_validation: true) else status.update(spoiler_text: 'CW', text: status_text) end diff --git a/app/services/approve_appeal_service.rb b/app/services/approve_appeal_service.rb index 6de051edc4..40bb76b8a4 100644 --- a/app/services/approve_appeal_service.rb +++ b/app/services/approve_appeal_service.rb @@ -56,14 +56,14 @@ class ApproveAppealService < BaseService def undo_mark_statuses_as_sensitive! representative_account = Account.representative @strike.statuses.includes(:media_attachments).find_each do |status| - UpdateStatusService.new.call(status, representative_account.id, sensitive: false) if status.with_media? + UpdateStatusService.new.call(status, representative_account.id, sensitive: false, bypass_validation: true) if status.with_media? end end def undo_force_cw! representative_account = Account.representative @strike.statuses.includes(:media_attachments).find_each do |status| - UpdateStatusService.new.call(status, representative_account.id, spoiler_text: '') + UpdateStatusService.new.call(status, representative_account.id, spoiler_text: '', bypass_validation: true) if status.spoiler_text.present? end end diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb index 2a3bf5f179..342c320e82 100644 --- a/app/services/update_status_service.rb +++ b/app/services/update_status_service.rb @@ -84,6 +84,7 @@ class UpdateStatusService < BaseService end def validate_status! + return if @options[:bypass_validation] raise Mastodon::ValidationError, I18n.t('statuses.contains_ng_words') if Admin::NgWord.reject?("#{@options[:spoiler_text]}\n#{@options[:text]}") raise Mastodon::ValidationError, I18n.t('statuses.too_many_hashtags') if Admin::NgWord.hashtag_reject_with_extractor?(@options[:text] || '') raise Mastodon::ValidationError, I18n.t('statuses.too_many_mentions') if Admin::NgWord.mention_reject_with_extractor?(@options[:text] || '') @@ -91,10 +92,13 @@ class UpdateStatusService < BaseService end def validate_status_mentions! + return if @options[:bypass_validation] raise Mastodon::ValidationError, I18n.t('statuses.contains_ng_words') if (mention_to_stranger? || reference_to_stranger?) && Setting.stranger_mention_from_local_ng && Admin::NgWord.stranger_mention_reject?("#{@options[:spoiler_text]}\n#{@options[:text]}") end def validate_status_ng_rules! + return if @options[:bypass_validation] + result = check_invalid_status_for_ng_rule! @status.account, reaction_type: 'edit', spoiler_text: @options.key?(:spoiler_text) ? (@options[:spoiler_text] || '') : @status.spoiler_text, diff --git a/spec/services/update_status_service_spec.rb b/spec/services/update_status_service_spec.rb index 89184a4f4c..22bbc4d5b8 100644 --- a/spec/services/update_status_service_spec.rb +++ b/spec/services/update_status_service_spec.rb @@ -277,6 +277,13 @@ RSpec.describe UpdateStatusService, type: :service do expect { subject.call(status, status.account_id, text: text) }.to raise_error(Mastodon::ValidationError) end + it 'bypass ng words' do + text = 'ng word test' + Fabricate(:ng_word, keyword: 'test', stranger: false) + + expect { subject.call(status, status.account_id, text: text, bypass_validation: true) }.to_not raise_error + end + it 'not hit ng words' do text = 'ng word aiueo' Form::AdminSettings.new(ng_words: 'test').save From 305021b543c417fadd8966ca211fe247838316bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Mon, 1 Apr 2024 08:54:57 +0900 Subject: [PATCH 07/14] =?UTF-8?q?Fix:=20`threads.net`=E3=81=AE=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=B3=E3=82=B9=E6=83=85=E5=A0=B1?= =?UTF-8?q?=E3=81=AE=E3=83=95=E3=82=A7=E3=83=83=E3=83=81=E3=81=8C=E6=AD=A2?= =?UTF-8?q?=E3=81=BE=E3=82=89=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C=20(#681)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/workers/activitypub/fetch_instance_info_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/activitypub/fetch_instance_info_worker.rb b/app/workers/activitypub/fetch_instance_info_worker.rb index 1b25c2a551..fb71106e25 100644 --- a/app/workers/activitypub/fetch_instance_info_worker.rb +++ b/app/workers/activitypub/fetch_instance_info_worker.rb @@ -30,7 +30,7 @@ class ActivityPub::FetchInstanceInfoWorker update_info!(link) true - rescue Mastodon::UnexpectedResponseError + rescue true end From f16bd4fcb1e13a64e2ec600af1384d080e464623 Mon Sep 17 00:00:00 2001 From: KMY Date: Mon, 1 Apr 2024 09:25:02 +0900 Subject: [PATCH 08/14] Fix test --- spec/services/update_status_service_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/services/update_status_service_spec.rb b/spec/services/update_status_service_spec.rb index 22bbc4d5b8..13dfc46379 100644 --- a/spec/services/update_status_service_spec.rb +++ b/spec/services/update_status_service_spec.rb @@ -279,7 +279,7 @@ RSpec.describe UpdateStatusService, type: :service do it 'bypass ng words' do text = 'ng word test' - Fabricate(:ng_word, keyword: 'test', stranger: false) + Form::AdminSettings.new(ng_words: 'test').save expect { subject.call(status, status.account_id, text: text, bypass_validation: true) }.to_not raise_error end From af7aae66f838e1d36153130c61f0ead212db5672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Sat, 6 Apr 2024 20:30:45 +0900 Subject: [PATCH 09/14] =?UTF-8?q?Add:=20=E7=B5=B5=E6=96=87=E5=AD=97?= =?UTF-8?q?=E3=83=AA=E3=82=A2=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=E3=82=B5=E3=83=BC=E3=83=90=E3=83=BC=E3=81=AB`rosekey`?= =?UTF-8?q?=20(#698)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/instance_info.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/instance_info.rb b/app/models/instance_info.rb index d3aa039721..98367f31ea 100644 --- a/app/models/instance_info.rb +++ b/app/models/instance_info.rb @@ -27,6 +27,7 @@ class InstanceInfo < ApplicationRecord meisskey misskey pleroma + rosekey sharkey ).freeze From 13e5eed8112120277d981228af79650eec2a5438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Mon, 8 Apr 2024 12:05:08 +0900 Subject: [PATCH 10/14] =?UTF-8?q?Fix:=20#367=20#557=20Web=E3=81=A7?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E3=81=95=E3=82=8C=E3=81=9F=E6=8A=95=E7=A8=BF?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=81=A8=E3=80=81?= =?UTF-8?q?=E3=81=9D=E3=81=AE=E6=8A=95=E7=A8=BF=E3=81=AE=E3=83=AA=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E6=83=85=E5=A0=B1=E3=81=8C?= =?UTF-8?q?=E3=83=AA=E3=82=BB=E3=83=83=E3=83=88=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=20(#702)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/actions/importer/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/actions/importer/index.js b/app/javascript/mastodon/actions/importer/index.js index 4edccd908f..906e384354 100644 --- a/app/javascript/mastodon/actions/importer/index.js +++ b/app/javascript/mastodon/actions/importer/index.js @@ -72,7 +72,7 @@ export function importFetchedStatuses(statuses) { processStatus(status.reblog); } - if (status.quote && status.quote.id) { + if (status.quote && status.quote.id && !getState().getIn(['statuses', status.id])) { processStatus(status.quote); } From e53c6b13eb24ad25a88f7a83d455ae803cc372f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Tue, 9 Apr 2024 09:02:50 +0900 Subject: [PATCH 11/14] =?UTF-8?q?Fix:=20#703=20NG=E3=83=AF=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=80=81=E3=82=BB=E3=83=B3=E3=82=B7=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=83=96=E3=83=AF=E3=83=BC=E3=83=89=E3=80=8C=E7=84=A1=E9=96=A2?= =?UTF-8?q?=E4=BF=82=E3=81=AA=E3=83=95=E3=82=A9=E3=83=AD=E3=83=AF=E3=83=BC?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E3=83=A1=E3=83=B3=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=80=8D=E3=81=8C=E3=80=81=E8=87=AA=E5=88=86=E8=87=AA=E8=BA=AB?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E3=83=A1=E3=83=B3=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=81=AB=E3=82=82=E9=81=A9=E7=94=A8=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=20(#704)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/concerns/account/interactions.rb | 4 ++++ app/services/post_status_service.rb | 6 ++--- app/services/update_status_service.rb | 6 ++--- spec/services/post_status_service_spec.rb | 25 +++++++++++++++++++++ 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/app/models/concerns/account/interactions.rb b/app/models/concerns/account/interactions.rb index d5c232336a..a8c9c1c5e7 100644 --- a/app/models/concerns/account/interactions.rb +++ b/app/models/concerns/account/interactions.rb @@ -186,6 +186,10 @@ module Account::Interactions active_relationships.exists?(target_account: other_account) end + def following_or_self?(other_account) + id == other_account.id || following?(other_account) + end + def following_anyone? active_relationships.exists? end diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 4663b9e631..0ec41fef03 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -248,12 +248,12 @@ class PostStatusService < BaseService def mention_to_stranger? return @mention_to_stranger if defined?(@mention_to_stranger) - @mention_to_stranger = @status.mentions.map(&:account).to_a.any? { |mentioned_account| mentioned_account.id != @account.id && !mentioned_account.following?(@account) } || - (@in_reply_to && @in_reply_to.account.id != @account.id && !@in_reply_to.account.following?(@account)) + @mention_to_stranger = @status.mentions.map(&:account).to_a.any? { |mentioned_account| !mentioned_account.following_or_self?(@account) } || + (@in_reply_to && !@in_reply_to.account.following_or_self?(@account)) end def reference_to_stranger? - referred_statuses.any? { |status| !status.account.following?(@account) } + referred_statuses.any? { |status| !status.account.following_or_self?(@account) } end def referred_statuses diff --git a/app/services/update_status_service.rb b/app/services/update_status_service.rb index 342c320e82..3feec8c68d 100644 --- a/app/services/update_status_service.rb +++ b/app/services/update_status_service.rb @@ -123,12 +123,12 @@ class UpdateStatusService < BaseService end def mention_to_stranger? - @status.mentions.map(&:account).to_a.any? { |mentioned_account| mentioned_account.id != @status.account.id && !mentioned_account.following?(@status.account) } || - (@status.thread.present? && @status.thread.account.id != @status.account.id && !@status.thread.account.following?(@status.account)) + @status.mentions.map(&:account).to_a.any? { |mentioned_account| !mentioned_account.following_or_self?(@status.account) } || + (@status.thread.present? && !@status.thread.account.following_or_self?(@status.account)) end def reference_to_stranger? - referred_statuses.any? { |status| !status.account.following?(@status.account) } + referred_statuses.any? { |status| !status.account.following_or_self?(@status.account) } end def referred_statuses diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 659cecb4e0..1713ddada0 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -663,6 +663,18 @@ RSpec.describe PostStatusService, type: :service do expect(status.text).to eq text end + it 'does not hit ng words for mention to self' do + account = Fabricate(:account, username: 'cool', domain: nil) + text = 'ng word test @cool' + Form::AdminSettings.new(stranger_mention_from_local_ng: '1').save + Fabricate(:ng_word, keyword: 'test', stranger: true) + + status = subject.call(account, text: text) + + expect(status).to be_persisted + expect(status.text).to eq text + end + it 'hit ng words for reply' do account = Fabricate(:account) text = 'ng word test' @@ -721,6 +733,19 @@ RSpec.describe PostStatusService, type: :service do expect(status.text).to eq text end + it 'does not hit ng words for reference to self' do + target_status = Fabricate(:status) + account = target_status.account + text = "ng word test BT: #{ActivityPub::TagManager.instance.uri_for(target_status)}" + Form::AdminSettings.new(stranger_mention_from_local_ng: '1').save + Fabricate(:ng_word, keyword: 'test', stranger: true) + + status = subject.call(account, text: text) + + expect(status).to be_persisted + expect(status.text).to eq text + end + it 'using hashtag under limit' do account = Fabricate(:account) text = '#a #b' From 83900d2581d3456f3973246778548619f8cd2e74 Mon Sep 17 00:00:00 2001 From: KMY Date: Tue, 9 Apr 2024 09:22:26 +0900 Subject: [PATCH 12/14] Fix test --- spec/services/post_status_service_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 1713ddada0..aab50cf7c9 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -666,8 +666,7 @@ RSpec.describe PostStatusService, type: :service do it 'does not hit ng words for mention to self' do account = Fabricate(:account, username: 'cool', domain: nil) text = 'ng word test @cool' - Form::AdminSettings.new(stranger_mention_from_local_ng: '1').save - Fabricate(:ng_word, keyword: 'test', stranger: true) + Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '1').save status = subject.call(account, text: text) @@ -737,8 +736,7 @@ RSpec.describe PostStatusService, type: :service do target_status = Fabricate(:status) account = target_status.account text = "ng word test BT: #{ActivityPub::TagManager.instance.uri_for(target_status)}" - Form::AdminSettings.new(stranger_mention_from_local_ng: '1').save - Fabricate(:ng_word, keyword: 'test', stranger: true) + Form::AdminSettings.new(ng_words_for_stranger_mention: 'test', stranger_mention_from_local_ng: '1').save status = subject.call(account, text: text) From bc968abfbe1f72752578d729dec65375d9368ef4 Mon Sep 17 00:00:00 2001 From: Yuicho <43964607+yuicho@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:32:52 +0900 Subject: [PATCH 13/14] =?UTF-8?q?Fix:=20[WebUI]=20=E3=83=95=E3=83=AB?= =?UTF-8?q?=E3=83=80=E3=83=BC=E3=82=AF=E3=83=86=E3=83=BC=E3=83=9E=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20(#708)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix media alt textarea color 投稿に添付したメディアの編集モーダルウインドウに存在する「視覚的に閲覧が難しいユーザーへの説明」を入力するテキストエリアの色を修正 * Fix compose-form__warning color 投稿画面にて一部の公開範囲などを選んだ際に、入力欄の上部に表示される .compose-form__warning の背景色を修正(文字の視認性向上のため) * fix CSS Selector idの指定を`#~~~` から `[id=~~~]` に変更 --- app/javascript/styles/full-dark/diff.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/javascript/styles/full-dark/diff.scss b/app/javascript/styles/full-dark/diff.scss index 1c98d95037..9483e7ecb6 100644 --- a/app/javascript/styles/full-dark/diff.scss +++ b/app/javascript/styles/full-dark/diff.scss @@ -1,6 +1,7 @@ input[type='text']:not(#cw-spoiler-input), input[type='search'], input[type='number'], +textarea[id='upload-modal__description'], input:not([type]) { background: $ui-base-color !important; color: $primary-text-color !important; @@ -24,6 +25,7 @@ input:not([type]) { color: $classic-secondary-color !important; } +.compose-form__warning, .modal-root__modal { background: lighten($classic-base-color, 12%); } From 2de228f84f92f76d1b8a324279c9341f079429b2 Mon Sep 17 00:00:00 2001 From: KMY Date: Mon, 1 Apr 2024 09:02:44 +0900 Subject: [PATCH 14/14] Bump version to 11.4 --- lib/mastodon/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 57e8b037e3..e6c3f21bd9 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -9,7 +9,7 @@ module Mastodon end def kmyblue_minor - 3 + 4 end def kmyblue_flag