Merge tag 'v4.2.25'

This commit is contained in:
bgme 2025-09-17 15:38:40 +08:00
commit be5f59d4ee
8 changed files with 79 additions and 15 deletions

View file

@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
## [4.2.25] - 2025-09-16
### Fixed
- Fix processing of remote edited statuses with new media and no text (#35970 by @unfokus)
## [4.2.24] - 2025-08-05
### Security

View file

@ -94,11 +94,16 @@ export const ensureComposeIsVisible = (getState, routerHistory) => {
};
export function setComposeToStatus(status, text, spoiler_text) {
return{
type: COMPOSE_SET_STATUS,
status,
text,
spoiler_text,
return (dispatch, getState) => {
const maxOptions = getState().server.getIn(['server', 'configuration', 'polls', 'max_options']);
dispatch({
type: COMPOSE_SET_STATUS,
status,
text,
spoiler_text,
maxOptions,
});
};
}

View file

@ -86,10 +86,15 @@ export function fetchStatusFail(id, error, skipLoading) {
}
export function redraft(status, raw_text) {
return {
type: REDRAFT,
status,
raw_text,
return (dispatch, getState) => {
const maxOptions = getState().server.getIn(['server', 'configuration', 'polls', 'max_options']);
dispatch({
type: REDRAFT,
status,
raw_text,
maxOptions,
});
};
}

View file

@ -492,8 +492,13 @@ export default function compose(state = initialState, action) {
}
if (action.status.get('poll')) {
let options = ImmutableList(action.status.get('poll').options.map(x => x.title));
if (options.size < action.maxOptions) {
options = options.push('');
}
map.set('poll', ImmutableMap({
options: action.status.getIn(['poll', 'options']).map(x => x.get('title')),
options: options,
multiple: action.status.getIn(['poll', 'multiple']),
expires_in: expiresInFromExpiresAt(action.status.getIn(['poll', 'expires_at'])),
}));
@ -521,8 +526,13 @@ export default function compose(state = initialState, action) {
}
if (action.status.get('poll')) {
let options = ImmutableList(action.status.get('poll').options.map(x => x.title));
if (options.size < action.maxOptions) {
options = options.push('');
}
map.set('poll', ImmutableMap({
options: action.status.getIn(['poll', 'options']).map(x => x.get('title')),
options: options,
multiple: action.status.getIn(['poll', 'multiple']),
expires_in: expiresInFromExpiresAt(action.status.getIn(['poll', 'expires_at'])),
}));

View file

@ -102,6 +102,8 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
@status.ordered_media_attachment_ids = @next_media_attachments.map(&:id)
@media_attachments_changed = true if @status.ordered_media_attachment_ids != previous_media_attachments_ids
@status.media_attachments.reload if @media_attachments_changed
end
def download_media_files!

View file

@ -56,7 +56,7 @@ services:
web:
build: .
image: ghcr.io/mastodon/mastodon:v4.2.24
image: ghcr.io/mastodon/mastodon:v4.2.25
restart: always
env_file: .env.production
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
@ -77,7 +77,7 @@ services:
streaming:
build: .
image: ghcr.io/mastodon/mastodon:v4.2.24
image: ghcr.io/mastodon/mastodon:v4.2.25
restart: always
env_file: .env.production
command: node ./streaming
@ -95,7 +95,7 @@ services:
sidekiq:
build: .
image: ghcr.io/mastodon/mastodon:v4.2.24
image: ghcr.io/mastodon/mastodon:v4.2.25
restart: always
env_file: .env.production
command: bundle exec sidekiq

View file

@ -13,7 +13,7 @@ module Mastodon
end
def patch
24
25
end
def default_prerelease

View file

@ -368,6 +368,42 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
end
context 'when originally without media attachments and text is removed' do
before do
stub_request(:get, 'https://example.com/foo.png').to_return(body: attachment_fixture('emojo.png'))
end
let(:payload) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
id: 'foo',
type: 'Note',
content: '',
updated: '2021-09-08T22:39:25Z',
attachment: [
{ type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png' },
],
}
end
it 'updates media attachments, fetches attachment, records media and text removal in edit' do
subject.call(status, json, json)
expect(status.reload.ordered_media_attachments.first)
.to be_present
.and(have_attributes(remote_url: 'https://example.com/foo.png'))
expect(a_request(:get, 'https://example.com/foo.png'))
.to have_been_made
expect(status.edits.reload.last.ordered_media_attachment_ids)
.to_not be_empty
expect(status.edits.reload.last.text)
.to_not be_present
end
end
context 'when originally with media attachments' do
let(:media_attachments) { [Fabricate(:media_attachment, remote_url: 'https://example.com/foo.png'), Fabricate(:media_attachment, remote_url: 'https://example.com/unused.png')] }