From 076005eae29d623b5bd68f660c4e2d9da50abda8 Mon Sep 17 00:00:00 2001 From: PGray <77597544+PGrayCS@users.noreply.github.com> Date: Fri, 6 Jun 2025 13:25:38 +0100 Subject: [PATCH 1/8] fix: update search column input on param change (#34951) --- .../mastodon/features/compose/components/search.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/compose/components/search.tsx b/app/javascript/mastodon/features/compose/components/search.tsx index 2186ff36ab..30a7a84db6 100644 --- a/app/javascript/mastodon/features/compose/components/search.tsx +++ b/app/javascript/mastodon/features/compose/components/search.tsx @@ -1,4 +1,4 @@ -import { useCallback, useState, useRef } from 'react'; +import { useCallback, useState, useRef, useEffect } from 'react'; import { defineMessages, @@ -72,6 +72,10 @@ export const Search: React.FC<{ const [expanded, setExpanded] = useState(false); const [selectedOption, setSelectedOption] = useState(-1); const [quickActions, setQuickActions] = useState([]); + useEffect(() => { + setValue(initialValue ?? ''); + setQuickActions([]); + }, [initialValue]); const searchOptions: SearchOption[] = []; if (searchEnabled) { From c92e21813e203f8babc344dc82a018e465f12798 Mon Sep 17 00:00:00 2001 From: diondiondion Date: Fri, 6 Jun 2025 14:37:56 +0200 Subject: [PATCH 2/8] fix: Fix indentation of quote posts in threads (#34961) --- app/javascript/styles/mastodon/components.scss | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 0122b81b8b..d31b6f0e3d 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -1882,16 +1882,18 @@ body > [data-popper-placement] { } .status__quote { + --quote-margin: 36px; + position: relative; margin-block-start: 16px; - margin-inline-start: 36px; + margin-inline-start: calc(var(--quote-margin) + var(--thread-margin, 0px)); border-radius: 8px; color: var(--nested-card-text); background: var(--nested-card-background); border: var(--nested-card-border); - @media screen and (min-width: $mobile-breakpoint) { - margin-inline-start: 56px; + @container (width > 460px) { + --quote-margin: 56px; } } @@ -1951,7 +1953,7 @@ body > [data-popper-placement] { transform: translateY(-50%); } - @media screen and (min-width: $mobile-breakpoint) { + @container (width > 460px) { inset-inline-start: -50px; } } @@ -2878,6 +2880,7 @@ a.account__display-name { display: flex; flex-direction: column; contain: inline-size layout paint style; + container: column / inline-size; @media screen and (min-width: $no-gap-breakpoint) { max-width: 600px; From ba75ba3adc520b704efc4f7e6ed6362dc368e360 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 6 Jun 2025 14:57:41 +0200 Subject: [PATCH 3/8] Change github workflow for chromatic to only run on official Mastodon repository (#34963) --- .github/workflows/chromatic.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 96bd0bb4e5..4e6179bc77 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -20,6 +20,7 @@ jobs: chromatic: name: Run Chromatic runs-on: ubuntu-latest + if: github.repository == 'mastodon/mastodon' steps: - name: Checkout code uses: actions/checkout@v4 From d0c6f3037808b56c225a81d5a9d6917b88ff108f Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 6 Jun 2025 17:23:16 +0200 Subject: [PATCH 4/8] Add `fasp` queue to sidekiq queue system check (#34965) --- app/lib/admin/system_check/sidekiq_process_check.rb | 1 + spec/lib/admin/system_check/sidekiq_process_check_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/lib/admin/system_check/sidekiq_process_check.rb b/app/lib/admin/system_check/sidekiq_process_check.rb index d577b3bf3c..f55cb7a2f0 100644 --- a/app/lib/admin/system_check/sidekiq_process_check.rb +++ b/app/lib/admin/system_check/sidekiq_process_check.rb @@ -8,6 +8,7 @@ class Admin::SystemCheck::SidekiqProcessCheck < Admin::SystemCheck::BaseCheck pull scheduler ingress + fasp ).freeze def skip? diff --git a/spec/lib/admin/system_check/sidekiq_process_check_spec.rb b/spec/lib/admin/system_check/sidekiq_process_check_spec.rb index 992fd7aee0..c32f4d736c 100644 --- a/spec/lib/admin/system_check/sidekiq_process_check_spec.rb +++ b/spec/lib/admin/system_check/sidekiq_process_check_spec.rb @@ -35,11 +35,11 @@ RSpec.describe Admin::SystemCheck::SidekiqProcessCheck do describe 'message' do it 'sends values to message instance' do - allow(Admin::SystemCheck::Message).to receive(:new).with(:sidekiq_process_check, 'default, push, mailers, pull, scheduler, ingress') + allow(Admin::SystemCheck::Message).to receive(:new).with(:sidekiq_process_check, 'default, push, mailers, pull, scheduler, ingress, fasp') check.message - expect(Admin::SystemCheck::Message).to have_received(:new).with(:sidekiq_process_check, 'default, push, mailers, pull, scheduler, ingress') + expect(Admin::SystemCheck::Message).to have_received(:new).with(:sidekiq_process_check, 'default, push, mailers, pull, scheduler, ingress, fasp') end end end From d887790e86124493df850e9bc52e1e059207b523 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 6 Jun 2025 11:25:09 -0400 Subject: [PATCH 5/8] Update `SafeReblogInsert` concern to match Rails 8 method (#34966) --- .../concerns/status/safe_reblog_insert.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/models/concerns/status/safe_reblog_insert.rb b/app/models/concerns/status/safe_reblog_insert.rb index 48d585ea18..94bed5b39a 100644 --- a/app/models/concerns/status/safe_reblog_insert.rb +++ b/app/models/concerns/status/safe_reblog_insert.rb @@ -16,7 +16,7 @@ module Status::SafeReblogInsert # The code is kept similar to ActiveRecord::Persistence code and calls it # directly when we are not handling a reblog. # - # https://github.com/rails/rails/blob/v7.2.1.1/activerecord/lib/active_record/persistence.rb#L238-L263 + # https://github.com/rails/rails/blob/v8.0.2/activerecord/lib/active_record/persistence.rb#L238-L261 def _insert_record(connection, values, returning) return super unless values.is_a?(Hash) && values['reblog_of_id']&.value.present? @@ -36,15 +36,13 @@ module Status::SafeReblogInsert # Instead, we use a custom builder when a reblog is happening: im = _compile_reblog_insert(values) - with_connection do |_c| - connection.insert( - im, "#{self} Create", primary_key || false, primary_key_value, - returning: returning - ).tap do |result| - # Since we are using SELECT instead of VALUES, a non-error `nil` return is possible. - # For our purposes, it's equivalent to a foreign key constraint violation - raise ActiveRecord::InvalidForeignKey, "(reblog_of_id)=(#{values['reblog_of_id'].value}) is not present in table \"statuses\"" if result.nil? - end + connection.insert( + im, "#{self} Create", primary_key || false, primary_key_value, + returning: returning + ).tap do |result| + # Since we are using SELECT instead of VALUES, a non-error `nil` return is possible. + # For our purposes, it's equivalent to a foreign key constraint violation + raise ActiveRecord::InvalidForeignKey, "(reblog_of_id)=(#{values['reblog_of_id'].value}) is not present in table \"statuses\"" if result.nil? end end From 3b13487e8f16c8412bdf69e02024f0a85078daf0 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 6 Jun 2025 11:59:26 +0200 Subject: [PATCH 6/8] [Glitch] Rewrite `AccountNote` as Typescript functional component Port 68810643d8a5af999e9fc86ac5334d218baab4d4 to glitch-soc Co-authored-by: diondiondion Signed-off-by: Claire --- .../account/components/account_note.jsx | 181 ------------------ .../account/components/account_note.tsx | 131 +++++++++++++ .../containers/account_note_container.js | 19 -- .../components/account_header.tsx | 4 +- 4 files changed, 133 insertions(+), 202 deletions(-) delete mode 100644 app/javascript/flavours/glitch/features/account/components/account_note.jsx create mode 100644 app/javascript/flavours/glitch/features/account/components/account_note.tsx delete mode 100644 app/javascript/flavours/glitch/features/account/containers/account_note_container.js diff --git a/app/javascript/flavours/glitch/features/account/components/account_note.jsx b/app/javascript/flavours/glitch/features/account/components/account_note.jsx deleted file mode 100644 index 1317df4c44..0000000000 --- a/app/javascript/flavours/glitch/features/account/components/account_note.jsx +++ /dev/null @@ -1,181 +0,0 @@ -import PropTypes from 'prop-types'; -import { PureComponent } from 'react'; - -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; - -import { is } from 'immutable'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -import Textarea from 'react-textarea-autosize'; - -import { LoadingIndicator } from '@/flavours/glitch/components/loading_indicator'; - -const messages = defineMessages({ - placeholder: { id: 'account_note.placeholder', defaultMessage: 'Click to add a note' }, -}); - -class InlineAlert extends PureComponent { - - static propTypes = { - show: PropTypes.bool, - }; - - state = { - mountMessage: false, - }; - - static TRANSITION_DELAY = 200; - - UNSAFE_componentWillReceiveProps (nextProps) { - if (!this.props.show && nextProps.show) { - this.setState({ mountMessage: true }); - } else if (this.props.show && !nextProps.show) { - setTimeout(() => this.setState({ mountMessage: false }), InlineAlert.TRANSITION_DELAY); - } - } - - render () { - const { show } = this.props; - const { mountMessage } = this.state; - - return ( - - {mountMessage && } - - ); - } - -} - -class AccountNote extends ImmutablePureComponent { - - static propTypes = { - accountId: PropTypes.string.isRequired, - value: PropTypes.string, - onSave: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - }; - - state = { - value: null, - saving: false, - saved: false, - }; - - UNSAFE_componentWillMount () { - this._reset(); - } - - UNSAFE_componentWillReceiveProps (nextProps) { - const accountWillChange = !is(this.props.accountId, nextProps.accountId); - const newState = {}; - - if (accountWillChange && this._isDirty()) { - this._save(false); - } - - if (accountWillChange || nextProps.value === this.state.value) { - newState.saving = false; - } - - if (this.props.value !== nextProps.value) { - newState.value = nextProps.value; - } - - this.setState(newState); - } - - componentWillUnmount () { - if (this._isDirty()) { - this._save(false); - } - } - - setTextareaRef = c => { - this.textarea = c; - }; - - handleChange = e => { - this.setState({ value: e.target.value, saving: false }); - }; - - handleKeyDown = e => { - if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { - e.preventDefault(); - - if (this.textarea) { - this.textarea.blur(); - } else { - this._save(); - } - } else if (e.keyCode === 27) { - e.preventDefault(); - - this._reset(() => { - if (this.textarea) { - this.textarea.blur(); - } - }); - } - }; - - handleBlur = () => { - if (this._isDirty()) { - this._save(); - } - }; - - _save (showMessage = true) { - this.setState({ saving: true }, () => this.props.onSave(this.state.value)); - - if (showMessage) { - this.setState({ saved: true }, () => setTimeout(() => this.setState({ saved: false }), 2000)); - } - } - - _reset (callback) { - this.setState({ value: this.props.value }, callback); - } - - _isDirty () { - return !this.state.saving && this.props.value !== null && this.state.value !== null && this.state.value !== this.props.value; - } - - render () { - const { accountId, intl } = this.props; - const { value, saved } = this.state; - - if (!accountId) { - return null; - } - - return ( -
- - - {this.props.value === undefined ? ( -
- -
- ) : ( -