Skip to content

Commit 83b68eb

Browse files
Merge remote-tracking branch 'origin/master' into nt--remove-otp-requirement-for-enabling-webauthn
2 parents 8902ba1 + 1c89909 commit 83b68eb

331 files changed

Lines changed: 4475 additions & 1417 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.18
1+
22.19

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-offense-counts --no-auto-gen-timestamp`
3-
# using RuboCop version 1.79.2.
3+
# using RuboCop version 1.80.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new

.storybook/preview.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import { initialize, mswLoader } from 'msw-storybook-addon';
1212
import { action } from 'storybook/actions';
1313

1414
import type { LocaleData } from '@/mastodon/locales';
15-
import { reducerWithInitialState, rootReducer } from '@/mastodon/reducers';
15+
import { reducerWithInitialState } from '@/mastodon/reducers';
1616
import { defaultMiddleware } from '@/mastodon/store/store';
1717
import { mockHandlers, unhandledRequestHandler } from '@/testing/api';
1818

1919
// If you want to run the dark theme during development,
2020
// you can change the below to `/application.scss`
2121
import '../app/javascript/styles/mastodon-light.scss';
22+
import './styles.css';
2223

2324
const localeFiles = import.meta.glob('@/mastodon/locales/*.json', {
2425
query: { as: 'json' },
@@ -49,12 +50,17 @@ const preview: Preview = {
4950
locale: 'en',
5051
},
5152
decorators: [
52-
(Story, { parameters }) => {
53+
(Story, { parameters, globals }) => {
54+
const { locale } = globals as { locale: string };
5355
const { state = {} } = parameters;
54-
let reducer = rootReducer;
55-
if (typeof state === 'object' && state) {
56-
reducer = reducerWithInitialState(state as Record<string, unknown>);
57-
}
56+
const reducer = reducerWithInitialState(
57+
{
58+
meta: {
59+
locale,
60+
},
61+
},
62+
state as Record<string, unknown>,
63+
);
5864
const store = configureStore({
5965
reducer,
6066
middleware(getDefaultMiddleware) {

.storybook/styles.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
a {
2+
color: inherit;
3+
text-decoration: none;
4+
}
5+
6+
a:hover {
7+
text-decoration: underline;
8+
}

Gemfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ GEM
172172
cocoon (1.2.15)
173173
color_diff (0.1)
174174
concurrent-ruby (1.3.5)
175-
connection_pool (2.5.3)
175+
connection_pool (2.5.4)
176176
cose (1.3.1)
177177
cbor (~> 0.5.9)
178178
openssl-signature_algorithm (~> 1.0)
@@ -615,7 +615,7 @@ GEM
615615
parslet (2.0.0)
616616
pastel (0.8.0)
617617
tty-color (~> 0.5)
618-
pg (1.6.1)
618+
pg (1.6.2)
619619
pghero (3.7.0)
620620
activerecord (>= 7.1)
621621
playwright-ruby-client (1.54.1)
@@ -771,7 +771,7 @@ GEM
771771
rspec-mocks (~> 3.0)
772772
sidekiq (>= 5, < 9)
773773
rspec-support (3.13.4)
774-
rubocop (1.79.2)
774+
rubocop (1.80.2)
775775
json (~> 2.3)
776776
language_server-protocol (~> 3.17.0.2)
777777
lint_roller (~> 1.1.0)
@@ -791,17 +791,17 @@ GEM
791791
rubocop-i18n (3.2.3)
792792
lint_roller (~> 1.1)
793793
rubocop (>= 1.72.1)
794-
rubocop-performance (1.25.0)
794+
rubocop-performance (1.26.0)
795795
lint_roller (~> 1.1)
796796
rubocop (>= 1.75.0, < 2.0)
797-
rubocop-ast (>= 1.38.0, < 2.0)
797+
rubocop-ast (>= 1.44.0, < 2.0)
798798
rubocop-rails (2.33.3)
799799
activesupport (>= 4.2.0)
800800
lint_roller (~> 1.1)
801801
rack (>= 1.1)
802802
rubocop (>= 1.75.0, < 2.0)
803803
rubocop-ast (>= 1.44.0, < 2.0)
804-
rubocop-rspec (3.6.0)
804+
rubocop-rspec (3.7.0)
805805
lint_roller (~> 1.1)
806806
rubocop (~> 1.72, >= 1.72.1)
807807
rubocop-rspec_rails (2.31.0)
@@ -817,7 +817,7 @@ GEM
817817
ruby-vips (2.2.5)
818818
ffi (~> 1.12)
819819
logger
820-
rubyzip (3.0.2)
820+
rubyzip (3.1.0)
821821
rufus-scheduler (3.9.2)
822822
fugit (~> 1.1, >= 1.11.1)
823823
safety_net_attestation (0.4.0)
@@ -903,7 +903,7 @@ GEM
903903
unf (0.1.4)
904904
unf_ext
905905
unf_ext (0.0.9.1)
906-
unicode-display_width (3.1.4)
906+
unicode-display_width (3.1.5)
907907
unicode-emoji (~> 4.0, >= 4.0.4)
908908
unicode-emoji (4.0.4)
909909
uri (1.0.3)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# frozen_string_literal: true
2+
3+
class ActivityPub::ContextsController < ActivityPub::BaseController
4+
vary_by -> { 'Signature' if authorized_fetch_mode? }
5+
6+
before_action :require_account_signature!, if: :authorized_fetch_mode?
7+
before_action :set_conversation
8+
before_action :set_items
9+
10+
DESCENDANTS_LIMIT = 60
11+
12+
def show
13+
expires_in 3.minutes, public: public_fetch_mode?
14+
render_with_cache json: context_presenter, serializer: ActivityPub::ContextSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
15+
end
16+
17+
def items
18+
expires_in 3.minutes, public: public_fetch_mode?
19+
render_with_cache json: items_collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
20+
end
21+
22+
private
23+
24+
def account_required?
25+
false
26+
end
27+
28+
def set_conversation
29+
@conversation = Conversation.local.find(params[:id])
30+
end
31+
32+
def set_items
33+
@items = @conversation.statuses.distributable_visibility.paginate_by_min_id(DESCENDANTS_LIMIT, params[:min_id])
34+
end
35+
36+
def context_presenter
37+
first_page = ActivityPub::CollectionPresenter.new(
38+
id: items_context_url(@conversation, page_params),
39+
type: :unordered,
40+
part_of: items_context_url(@conversation),
41+
next: next_page,
42+
items: @items.map { |status| status.local? ? ActivityPub::TagManager.instance.uri_for(status) : status.uri }
43+
)
44+
45+
ActivityPub::ContextPresenter.from_conversation(@conversation).tap do |presenter|
46+
presenter.first = first_page
47+
end
48+
end
49+
50+
def items_collection_presenter
51+
page = ActivityPub::CollectionPresenter.new(
52+
id: items_context_url(@conversation, page_params),
53+
type: :unordered,
54+
part_of: items_context_url(@conversation),
55+
next: next_page,
56+
items: @items.map { |status| status.local? ? ActivityPub::TagManager.instance.uri_for(status) : status.uri }
57+
)
58+
59+
return page if page_requested?
60+
61+
ActivityPub::CollectionPresenter.new(
62+
id: items_context_url(@conversation),
63+
type: :unordered,
64+
first: page
65+
)
66+
end
67+
68+
def page_requested?
69+
truthy_param?(:page)
70+
end
71+
72+
def next_page
73+
return nil if @items.size < DESCENDANTS_LIMIT
74+
75+
items_context_url(@conversation, page: true, min_id: @items.last.id)
76+
end
77+
78+
def page_params
79+
params.permit(:page, :min_id)
80+
end
81+
end

app/controllers/admin/export_domain_allows_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def export_headers
4949

5050
def export_data
5151
CSV.generate(headers: export_headers, write_headers: true) do |content|
52-
DomainAllow.allowed_domains.each do |instance|
53-
content << [instance.domain]
52+
DomainAllow.allowed_domains.each do |domain|
53+
content << [domain]
5454
end
5555
end
5656
end

app/controllers/api/v1/accounts/credentials_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def user_params
4848
default_privacy: source_params.fetch(:privacy, @account.user.setting_default_privacy),
4949
default_sensitive: source_params.fetch(:sensitive, @account.user.setting_default_sensitive),
5050
default_language: source_params.fetch(:language, @account.user.setting_default_language),
51+
default_quote_policy: source_params.fetch(:quote_policy, @account.user.setting_default_quote_policy),
5152
},
5253
}
5354
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
class Settings::Preferences::PostingDefaultsController < Settings::Preferences::BaseController
4+
private
5+
6+
def after_update_redirect_path
7+
settings_preferences_posting_defaults_path
8+
end
9+
10+
def user_params
11+
super.tap do |params|
12+
params[:settings_attributes][:default_quote_policy] = 'nobody' if params[:settings_attributes][:default_privacy] == 'private'
13+
end
14+
end
15+
end

app/helpers/application_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ def copyable_input(options = {})
243243
tag.input(type: :text, maxlength: 999, spellcheck: false, readonly: true, **options)
244244
end
245245

246+
def recent_tag_users(tag)
247+
tag.statuses.public_visibility.joins(:account).merge(Account.without_suspended.without_silenced).includes(:account).limit(3).map(&:account)
248+
end
249+
246250
def recent_tag_usage(tag)
247251
people = tag.history.aggregate(2.days.ago.to_date..Time.zone.today).accounts
248252
I18n.t 'user_mailer.welcome.hashtags_recent_count', people: number_with_delimiter(people), count: people

0 commit comments

Comments
 (0)