mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 03:25:14 +00:00
Merge tag 'v4.2.26'
This commit is contained in:
commit
98139a72bc
7 changed files with 93 additions and 5 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
|
@ -2,6 +2,17 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [4.2.26] - 2025-09-23
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
- Update dependencies
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix processing of out-of-order `Update` as implicit updates (#36190 by @ClearlyClaire)
|
||||||
|
- Fix getting `Create` and `Update` out of order (#36176 by @ClearlyClaire)
|
||||||
|
|
||||||
## [4.2.25] - 2025-09-16
|
## [4.2.25] - 2025-09-16
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -604,7 +604,7 @@ GEM
|
||||||
responders (3.1.0)
|
responders (3.1.0)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
rexml (3.3.9)
|
rexml (3.4.4)
|
||||||
rotp (6.3.0)
|
rotp (6.3.0)
|
||||||
rouge (4.1.2)
|
rouge (4.1.2)
|
||||||
rpam2 (4.0.2)
|
rpam2 (4.0.2)
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@ class ActivityPub::Activity::Update < ActivityPub::Activity
|
||||||
|
|
||||||
@status = Status.find_by(uri: object_uri, account_id: @account.id)
|
@status = Status.find_by(uri: object_uri, account_id: @account.id)
|
||||||
|
|
||||||
|
# We may be getting `Create` and `Update` out of order
|
||||||
|
@status ||= ActivityPub::Activity::Create.new(@json, @account, **@options).perform
|
||||||
|
|
||||||
return if @status.nil?
|
return if @status.nil?
|
||||||
|
|
||||||
ActivityPub::ProcessStatusUpdateService.new.call(@status, @json, @object, request_id: @options[:request_id])
|
ActivityPub::ProcessStatusUpdateService.new.call(@status, @json, @object, request_id: @options[:request_id])
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
||||||
|
|
||||||
if @status_parser.edited_at.present? && (@status.edited_at.nil? || @status_parser.edited_at > @status.edited_at)
|
if @status_parser.edited_at.present? && (@status.edited_at.nil? || @status_parser.edited_at > @status.edited_at)
|
||||||
handle_explicit_update!
|
handle_explicit_update!
|
||||||
|
elsif @status.edited_at.present? && (@status_parser.edited_at.nil? || @status_parser.edited_at < @status.edited_at)
|
||||||
|
# This is an older update, reject it
|
||||||
|
return @status
|
||||||
else
|
else
|
||||||
handle_implicit_update!
|
handle_implicit_update!
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ services:
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
image: ghcr.io/mastodon/mastodon:v4.2.25
|
image: ghcr.io/mastodon/mastodon:v4.2.26
|
||||||
restart: always
|
restart: always
|
||||||
env_file: .env.production
|
env_file: .env.production
|
||||||
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
|
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
|
||||||
|
|
@ -77,7 +77,7 @@ services:
|
||||||
|
|
||||||
streaming:
|
streaming:
|
||||||
build: .
|
build: .
|
||||||
image: ghcr.io/mastodon/mastodon:v4.2.25
|
image: ghcr.io/mastodon/mastodon:v4.2.26
|
||||||
restart: always
|
restart: always
|
||||||
env_file: .env.production
|
env_file: .env.production
|
||||||
command: node ./streaming
|
command: node ./streaming
|
||||||
|
|
@ -95,7 +95,7 @@ services:
|
||||||
|
|
||||||
sidekiq:
|
sidekiq:
|
||||||
build: .
|
build: .
|
||||||
image: ghcr.io/mastodon/mastodon:v4.2.25
|
image: ghcr.io/mastodon/mastodon:v4.2.26
|
||||||
restart: always
|
restart: always
|
||||||
env_file: .env.production
|
env_file: .env.production
|
||||||
command: bundle exec sidekiq
|
command: bundle exec sidekiq
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ module Mastodon
|
||||||
end
|
end
|
||||||
|
|
||||||
def patch
|
def patch
|
||||||
25
|
26
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_prerelease
|
def default_prerelease
|
||||||
|
|
|
||||||
71
spec/lib/activitypub/activity_spec.rb
Normal file
71
spec/lib/activitypub/activity_spec.rb
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ActivityPub::Activity do
|
||||||
|
describe 'processing a Create and an Update' do
|
||||||
|
let(:sender) { Fabricate(:account, followers_url: 'http://example.com/followers', domain: 'example.com', uri: 'https://example.com/actor') }
|
||||||
|
|
||||||
|
let(:create_json) do
|
||||||
|
{
|
||||||
|
'@context': [
|
||||||
|
'https://www.w3.org/ns/activitystreams',
|
||||||
|
],
|
||||||
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#create'].join,
|
||||||
|
type: 'Create',
|
||||||
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||||
|
object: {
|
||||||
|
id: [ActivityPub::TagManager.instance.uri_for(sender), 'post1'].join('/'),
|
||||||
|
type: 'Note',
|
||||||
|
to: [
|
||||||
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
|
],
|
||||||
|
content: 'foo',
|
||||||
|
published: '2025-05-24T11:03:10Z',
|
||||||
|
},
|
||||||
|
}.deep_stringify_keys
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:update_json) do
|
||||||
|
{
|
||||||
|
'@context': [
|
||||||
|
'https://www.w3.org/ns/activitystreams',
|
||||||
|
],
|
||||||
|
id: [ActivityPub::TagManager.instance.uri_for(sender), '#update'].join,
|
||||||
|
type: 'Update',
|
||||||
|
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||||
|
object: {
|
||||||
|
id: [ActivityPub::TagManager.instance.uri_for(sender), 'post1'].join('/'),
|
||||||
|
type: 'Note',
|
||||||
|
to: [
|
||||||
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
|
],
|
||||||
|
content: 'bar',
|
||||||
|
updated: '2025-05-25T11:03:10Z',
|
||||||
|
},
|
||||||
|
}.deep_stringify_keys
|
||||||
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
sender.update(uri: ActivityPub::TagManager.instance.uri_for(sender))
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when getting them in order' do
|
||||||
|
it 'creates a status with the edited contents' do
|
||||||
|
described_class.factory(create_json, sender).perform
|
||||||
|
status = described_class.factory(update_json, sender).perform
|
||||||
|
|
||||||
|
expect(status.text).to eq 'bar'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when getting them out of order' do
|
||||||
|
it 'creates a status with the edited contents' do
|
||||||
|
described_class.factory(update_json, sender).perform
|
||||||
|
status = described_class.factory(create_json, sender).perform
|
||||||
|
|
||||||
|
expect(status.text).to eq 'bar'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue