Merge commit 'd2ea2974a1f1ffb0a690d62965c5b25dcdce18a0' into glitch-soc/merge-4.6
Conflicts: - `spec/models/tag_feed_spec.rb`: Minor conflict due to glitch-soc's local-only posts. Adopted upstream's changes.
This commit is contained in:
commit
f0c2cd4ec0
16 files changed
+109
-25
No files matched your search
@@ -24,7 +24,7 @@ runs:
|
||||
${{ inputs.additional-system-dependencies }}
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1
|
||||
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
||||
with:
|
||||
ruby-version: ${{ inputs.ruby-version }}
|
||||
bundler-cache: true
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1
|
||||
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1
|
||||
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1
|
||||
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4.0.5
|
||||
4.0.9
|
||||
+1
-1
@@ -13,7 +13,7 @@ ARG BASE_REGISTRY="docker.io"
|
||||
|
||||
# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="4.0.x"]
|
||||
# renovate: datasource=docker depName=docker.io/ruby
|
||||
ARG RUBY_VERSION="4.0.5"
|
||||
ARG RUBY_VERSION="4.0.9"
|
||||
# # Node.js version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="22"]
|
||||
# renovate: datasource=node-version depName=node
|
||||
ARG NODE_MAJOR_VERSION="24"
|
||||
|
||||
+7
-6
@@ -178,9 +178,10 @@ GEM
|
||||
crack (1.0.1)
|
||||
bigdecimal
|
||||
rexml
|
||||
crass (1.0.7)
|
||||
css_parser (3.0.0)
|
||||
crass (1.0.8)
|
||||
css_parser (3.3.0)
|
||||
addressable
|
||||
base64
|
||||
ssrf_filter (~> 1.5)
|
||||
csv (3.3.5)
|
||||
database_cleaner-active_record (2.2.2)
|
||||
@@ -230,7 +231,7 @@ GEM
|
||||
erubi (1.13.1)
|
||||
et-orbi (1.4.0)
|
||||
tzinfo
|
||||
excon (1.5.0)
|
||||
excon (1.8.0)
|
||||
logger
|
||||
fabrication (3.0.0)
|
||||
faker (3.8.0)
|
||||
@@ -595,7 +596,7 @@ GEM
|
||||
pastel (0.8.0)
|
||||
tty-color (~> 0.5)
|
||||
pg (1.6.3)
|
||||
pghero (3.8.0)
|
||||
pghero (4.1.0)
|
||||
activerecord (>= 7.2)
|
||||
playwright-ruby-client (1.60.0)
|
||||
base64
|
||||
@@ -808,8 +809,8 @@ GEM
|
||||
fugit (~> 1.1, >= 1.11.1)
|
||||
safety_net_attestation (0.5.0)
|
||||
jwt (>= 2.0, < 4.0)
|
||||
sanitize (7.0.0)
|
||||
crass (~> 1.0.2)
|
||||
sanitize (7.0.1)
|
||||
crass (~> 1.0.8)
|
||||
nokogiri (>= 1.16.8)
|
||||
scenic (1.9.0)
|
||||
activerecord (>= 4.0.0)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
.avatar {
|
||||
margin-top: -64px;
|
||||
margin-left: calc(var(--space-4) - 2px);
|
||||
margin-left: calc(16px - 2px);
|
||||
position: relative;
|
||||
width: 82px;
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
// Section component
|
||||
|
||||
.section {
|
||||
padding: var(--space-6) var(--space-4);
|
||||
padding: 24px 16px;
|
||||
border-bottom: 1px solid var(--color-border-primary);
|
||||
font-size: 15px;
|
||||
|
||||
|
||||
@@ -48,11 +48,14 @@ class AccountStatusesFilter
|
||||
def filtered_scope
|
||||
scope = account.statuses
|
||||
|
||||
if exclude_direct?
|
||||
scope = scope.where(visibility: follower? ? %i(public unlisted private) : %i(public unlisted))
|
||||
if exclude_direct? && follower?
|
||||
scope = scope.list_eligible_visibility
|
||||
elsif exclude_direct?
|
||||
scope = account.statuses.left_outer_joins(:mentions)
|
||||
scope.merge!(scope.distributable_visibility.or(scope.where(visibility: :private).where(mentions: { account_id: current_account.id })).group(Status.arel_table[:id]))
|
||||
else
|
||||
scope = account.statuses.left_outer_joins(:mentions)
|
||||
scope.merge!(scope.where(visibility: follower? ? %i(public unlisted private) : %i(public unlisted)).or(scope.where(mentions: { account_id: current_account.id })).group(Status.arel_table[:id]))
|
||||
scope.merge!(visibility_scope(scope).or(scope.where(mentions: { account_id: current_account.id })).group(Status.arel_table[:id]))
|
||||
end
|
||||
|
||||
scope.merge!(filtered_reblogs_scope) if reblogs_may_occur?
|
||||
@@ -60,6 +63,14 @@ class AccountStatusesFilter
|
||||
scope
|
||||
end
|
||||
|
||||
def visibility_scope(scope)
|
||||
if follower?
|
||||
scope.list_eligible_visibility
|
||||
else
|
||||
scope.distributable_visibility
|
||||
end
|
||||
end
|
||||
|
||||
def filtered_reblogs_scope
|
||||
scope = Status.left_outer_joins(reblog: :account)
|
||||
scope
|
||||
|
||||
@@ -53,11 +53,26 @@ class StatusCacheHydrator
|
||||
end
|
||||
|
||||
def fill_status_payload(payload, status, account, nested: false, fresh: true)
|
||||
payload[:favourited] = Favourite.exists?(account_id: account.id, status_id: status.id)
|
||||
payload[:reblogged] = Status.exists?(account_id: account.id, reblog_of_id: status.id)
|
||||
payload[:muted] = ConversationMute.exists?(account_id: account.id, conversation_id: status.conversation_id)
|
||||
payload[:bookmarked] = Bookmark.exists?(account_id: account.id, status_id: status.id)
|
||||
payload[:pinned] = StatusPin.exists?(account_id: account.id, status_id: status.id) if status.account_id == account.id
|
||||
queries = [
|
||||
Favourite.where(account_id: account.id, status_id: status.id).arel.exists.as('favourited'),
|
||||
Status.where(account_id: account.id, reblog_of_id: status.id).arel.exists.as('reblogged'),
|
||||
ConversationMute.where(account_id: account.id, conversation_id: status.conversation_id).arel.exists.as('muted'),
|
||||
Bookmark.where(account_id: account.id, status_id: status.id).arel.exists.as('bookmarked'),
|
||||
]
|
||||
|
||||
if status.account_id == account.id
|
||||
queries.push(
|
||||
StatusPin.where(account_id: account.id, status_id: status.id).arel.exists.as('pinned')
|
||||
)
|
||||
end
|
||||
|
||||
flags = Status.connection.select_one(Arel::SelectManager.new.project(queries))
|
||||
|
||||
payload[:favourited] = flags['favourited']
|
||||
payload[:reblogged] = flags['reblogged']
|
||||
payload[:muted] = flags['muted']
|
||||
payload[:bookmarked] = flags['bookmarked']
|
||||
payload[:pinned] = flags['pinned'] if status.account_id == account.id
|
||||
payload[:filtered] = mapped_applied_custom_filter(account, status)
|
||||
payload[:quote_approval][:current_user] = status.quote_policy_for_account(account) if payload[:quote_approval]
|
||||
payload[:quote] = hydrate_quote_payload(payload[:quote], status.quote, account, nested:) if payload[:quote]
|
||||
|
||||
@@ -31,6 +31,7 @@ class TagFeed < PublicFeed
|
||||
scope.merge!(tagged_with_any_scope)
|
||||
scope.merge!(tagged_with_all_scope)
|
||||
scope.merge!(tagged_with_none_scope)
|
||||
scope.merge!(tagged_with_cursor_scope(max_id, since_id, min_id))
|
||||
scope.merge!(local_only_scope) if local_only?
|
||||
scope.merge!(remote_only_scope) if remote_only?
|
||||
scope.merge!(account_filters_scope) if account?
|
||||
@@ -61,6 +62,14 @@ class TagFeed < PublicFeed
|
||||
Status.group(:id).tagged_with_none(tags_for(options[:none]))
|
||||
end
|
||||
|
||||
def tagged_with_cursor_scope(max_id, since_id, min_id)
|
||||
lower_id = min_id.presence || since_id.presence
|
||||
scope = Status.all
|
||||
scope = scope.where(statuses_tags: { status_id: ...max_id }) if max_id.present?
|
||||
scope = scope.where('statuses_tags.status_id > ?', lower_id) if lower_id.present?
|
||||
scope
|
||||
end
|
||||
|
||||
def tags_for(names)
|
||||
Tag.matching_name(Array(names).take(LIMIT_PER_MODE)).pluck(:id) if names.present?
|
||||
end
|
||||
|
||||
@@ -10,13 +10,13 @@ class RevokeCollectionItemService < BaseService
|
||||
|
||||
@collection_item.revoke!
|
||||
|
||||
distribute_stamp_deletion! if @collection_item.remote?
|
||||
distribute_stamp_deletion!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def distribute_stamp_deletion!
|
||||
ActivityPub::DeliveryWorker.perform_async(signed_activity_json, @account.id, @collection.account.inbox_url)
|
||||
ActivityPub::DeliveryWorker.perform_async(signed_activity_json, @account.id, @collection.account.inbox_url) if @collection_item.remote?
|
||||
ActivityPub::CollectionRawDistributionWorker.perform_async(signed_activity_json, @collection.id)
|
||||
end
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace :dev do
|
||||
).find_or_create_by!(id: 10_000_000)
|
||||
showcase_user.mark_email_as_confirmed!
|
||||
showcase_user.approve!
|
||||
showcase_account.reload
|
||||
|
||||
french_post = Status.create_with(
|
||||
text: 'Ceci est un sondage public écrit en Français',
|
||||
@@ -200,6 +201,7 @@ namespace :dev do
|
||||
domain: 'example.org',
|
||||
uri: 'https://example.org/foo/bar',
|
||||
url: 'https://example.org/foo/bar',
|
||||
inbox_url: 'https://example.org/users/fake.example/inbox',
|
||||
locked: true
|
||||
).find_or_create_by!(id: 10_000_001)
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'rake'
|
||||
|
||||
RSpec.describe Rake::Task do
|
||||
describe 'dev:populate_sample_data' do
|
||||
subject { described_class['dev:populate_sample_data'] }
|
||||
|
||||
before do
|
||||
Rails.application.load_tasks unless described_class.tasks.any?
|
||||
subject.reenable
|
||||
end
|
||||
|
||||
describe '.invoke' do
|
||||
context 'when the task is invoked successfully' do
|
||||
it 'runs without aborting' do
|
||||
expect { subject.invoke }.to_not raise_error
|
||||
end
|
||||
|
||||
it 'populates accounts and users' do
|
||||
expect { subject.invoke }
|
||||
.to change(Account, :count).by(3)
|
||||
.and change(User, :count).by(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -72,6 +72,21 @@ RSpec.describe TagFeed do
|
||||
expect(results).to include(status)
|
||||
end
|
||||
|
||||
it 'paginates with max_id' do
|
||||
results = described_class.new(tag_cats, nil, any: [tag_dogs.name]).get(20, both.id)
|
||||
expect(results).to contain_exactly(status_tagged_with_cats, status_tagged_with_dogs)
|
||||
end
|
||||
|
||||
it 'paginates with since_id' do
|
||||
results = described_class.new(tag_cats, nil, any: [tag_dogs.name]).get(20, nil, status_tagged_with_cats.id)
|
||||
expect(results).to contain_exactly(status_tagged_with_dogs, both)
|
||||
end
|
||||
|
||||
it 'paginates with min_id' do
|
||||
results = described_class.new(tag_cats, nil, any: [tag_dogs.name]).get(20, nil, nil, status_tagged_with_cats.id)
|
||||
expect(results).to contain_exactly(status_tagged_with_dogs, both)
|
||||
end
|
||||
|
||||
context 'when the feed contains a local-only status' do
|
||||
let!(:status) { Fabricate(:status, tags: [tag_cats], local_only: true) }
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ RSpec.describe RevokeCollectionItemService do
|
||||
it 'revokes the collection item and sends a Delete activity' do
|
||||
expect { subject.call(collection_item) }
|
||||
.to change { collection_item.reload.state }.from('accepted').to('revoked')
|
||||
|
||||
expect(ActivityPub::CollectionRawDistributionWorker).to have_enqueued_sidekiq_job
|
||||
end
|
||||
|
||||
context 'when the collection is remote' do
|
||||
@@ -17,7 +19,7 @@ RSpec.describe RevokeCollectionItemService do
|
||||
let(:collection) { Fabricate(:remote_collection, account:) }
|
||||
let(:collection_item) { Fabricate(:collection_item, collection:, uri: 'https://example.com') }
|
||||
|
||||
it 'federates a `Delete` activity' do
|
||||
it 'federates a `Delete` activity to collection owner as well' do
|
||||
subject.call(collection_item)
|
||||
|
||||
expect(ActivityPub::DeliveryWorker).to have_enqueued_sidekiq_job.with(instance_of(String), collection_item.account_id, 'https://example.com/actor/1/inbox')
|
||||
|
||||
Reference in new issue
Block a user