Skip to content

Commit 44c0587

Browse files
committed
Merge branch 'temp3_for-taruntarun' into for-taruntarun
2 parents cb80884 + 9588d6c commit 44c0587

246 files changed

Lines changed: 2238 additions & 1297 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.

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33
orbs:
44
ruby: circleci/ruby@2.3.0
5-
node: circleci/node@6.3.0
5+
node: circleci/node@7.0.0
66

77
executors:
88
default:
@@ -52,7 +52,7 @@ commands:
5252
bundle config without 'development production'
5353
name: Set bundler settings
5454
- ruby/install-deps:
55-
bundler-version: '2.5.18'
55+
bundler-version: '2.5.23'
5656
key: ruby<< parameters.ruby-version >>-gems-v2
5757
wait-db:
5858
steps:

.github/workflows/test-migrations.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- '**/*.rb'
1313
- '.github/workflows/test-migrations.yml'
1414
- 'lib/tasks/tests.rake'
15+
- 'lib/tasks/db.rake'
1516

1617
pull_request:
1718
paths:
@@ -90,6 +91,11 @@ jobs:
9091
bin/rails db:drop
9192
bin/rails db:create
9293
SKIP_POST_DEPLOYMENT_MIGRATIONS=true bin/rails tests:migrations:prepare_database
94+
95+
# Migrate up to v4.2.0 breakpoint
96+
bin/rails db:migrate VERSION=20230907150100
97+
98+
# Migrate the rest
9399
SKIP_POST_DEPLOYMENT_MIGRATIONS=true bin/rails db:migrate
94100
bin/rails db:migrate
95101
bin/rails tests:migrations:check_database

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.11
1+
22.12

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ The following changelog entries focus on changes visible to users, administrator
399399
- Fix empty environment variables not using default nil value (#27400 by @renchap)
400400
- Fix language sorting in settings (#27158 by @gunchleoc)
401401

402-
## |4.2.11] - 2024-08-16
402+
## [4.2.11] - 2024-08-16
403403

404404
### Added
405405

Gemfile.lock

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ GEM
9494
ast (2.4.2)
9595
attr_required (1.0.2)
9696
aws-eventstream (1.3.0)
97-
aws-partitions (1.1015.0)
97+
aws-partitions (1.1017.0)
9898
aws-sdk-core (3.214.0)
9999
aws-eventstream (~> 1, >= 1.3.0)
100100
aws-partitions (~> 1, >= 1.992.0)
@@ -103,7 +103,7 @@ GEM
103103
aws-sdk-kms (1.96.0)
104104
aws-sdk-core (~> 3, >= 3.210.0)
105105
aws-sigv4 (~> 1.5)
106-
aws-sdk-s3 (1.175.0)
106+
aws-sdk-s3 (1.176.0)
107107
aws-sdk-core (~> 3, >= 3.210.0)
108108
aws-sdk-kms (~> 1)
109109
aws-sigv4 (~> 1.5)
@@ -128,7 +128,7 @@ GEM
128128
msgpack (~> 1.2)
129129
brakeman (6.2.2)
130130
racc
131-
browser (6.1.0)
131+
browser (6.2.0)
132132
brpoplpush-redis_script (0.1.3)
133133
concurrent-ruby (~> 1.0, >= 1.0.5)
134134
redis (>= 1.0, < 6)
@@ -426,7 +426,7 @@ GEM
426426
net-smtp (0.5.0)
427427
net-protocol
428428
nio4r (2.7.4)
429-
nokogiri (1.16.7)
429+
nokogiri (1.16.8)
430430
mini_portile2 (~> 2.8.2)
431431
racc (~> 1.4)
432432
oj (3.16.7)
@@ -466,7 +466,7 @@ GEM
466466
opentelemetry-api (1.4.0)
467467
opentelemetry-common (0.21.0)
468468
opentelemetry-api (~> 1.0)
469-
opentelemetry-exporter-otlp (0.29.0)
469+
opentelemetry-exporter-otlp (0.29.1)
470470
google-protobuf (>= 3.18)
471471
googleapis-common-protos-types (~> 1.3)
472472
opentelemetry-api (~> 1.1)
@@ -490,8 +490,9 @@ GEM
490490
opentelemetry-instrumentation-active_job (0.7.8)
491491
opentelemetry-api (~> 1.0)
492492
opentelemetry-instrumentation-base (~> 0.22.1)
493-
opentelemetry-instrumentation-active_model_serializers (0.20.2)
493+
opentelemetry-instrumentation-active_model_serializers (0.20.3)
494494
opentelemetry-api (~> 1.0)
495+
opentelemetry-instrumentation-active_support (>= 0.6.0)
495496
opentelemetry-instrumentation-base (~> 0.22.1)
496497
opentelemetry-instrumentation-active_record (0.8.1)
497498
opentelemetry-api (~> 1.0)
@@ -545,7 +546,7 @@ GEM
545546
opentelemetry-instrumentation-base (~> 0.22.1)
546547
opentelemetry-registry (0.3.1)
547548
opentelemetry-api (~> 1.1)
548-
opentelemetry-sdk (1.5.0)
549+
opentelemetry-sdk (1.6.0)
549550
opentelemetry-api (~> 1.1)
550551
opentelemetry-common (~> 0.20)
551552
opentelemetry-registry (~> 0.2)
@@ -632,9 +633,9 @@ GEM
632633
activesupport (>= 5.0.0)
633634
minitest
634635
nokogiri (>= 1.6)
635-
rails-html-sanitizer (1.6.0)
636+
rails-html-sanitizer (1.6.1)
636637
loofah (~> 2.21)
637-
nokogiri (~> 1.14)
638+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
638639
rails-i18n (7.0.10)
639640
i18n (>= 0.7, < 2)
640641
railties (>= 6.0.0, < 8)

app/controllers/api/v1/trends/tags_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def set_tags
2727
end
2828

2929
def tags_from_trends
30-
Trends.tags.query.allowed
30+
scope = Trends.tags.query.allowed.in_locale(content_locale)
31+
scope = scope.filtered_for(current_account) if user_signed_in?
32+
scope
3133
end
3234

3335
def next_path

app/helpers/application_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def body_classes
158158
output << content_for(:body_classes)
159159
output << "theme-#{current_theme.parameterize}"
160160
output << 'system-font' if current_account&.user&.setting_system_font_ui
161+
output << 'custom-scrollbars' unless current_account&.user&.setting_system_scrollbars_ui
161162
output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion')
162163
output << NAVIGATION_PANEL_LAYOUT[current_account&.user&.setting_navigation_panel_layout]
163164
output << FAB_LAYOUT[current_account&.user&.setting_fab_layout]

app/javascript/mastodon/actions/alerts.js

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { defineMessages } from 'react-intl';
2+
import type { MessageDescriptor } from 'react-intl';
3+
4+
import { AxiosError } from 'axios';
5+
import type { AxiosResponse } from 'axios';
6+
7+
interface Alert {
8+
title: string | MessageDescriptor;
9+
message: string | MessageDescriptor;
10+
values?: Record<string, string | number | Date>;
11+
}
12+
13+
interface ApiErrorResponse {
14+
error?: string;
15+
}
16+
17+
const messages = defineMessages({
18+
unexpectedTitle: { id: 'alert.unexpected.title', defaultMessage: 'Oops!' },
19+
unexpectedMessage: {
20+
id: 'alert.unexpected.message',
21+
defaultMessage: 'An unexpected error occurred.',
22+
},
23+
rateLimitedTitle: {
24+
id: 'alert.rate_limited.title',
25+
defaultMessage: 'Rate limited',
26+
},
27+
rateLimitedMessage: {
28+
id: 'alert.rate_limited.message',
29+
defaultMessage: 'Please retry after {retry_time, time, medium}.',
30+
},
31+
});
32+
33+
export const ALERT_SHOW = 'ALERT_SHOW';
34+
export const ALERT_DISMISS = 'ALERT_DISMISS';
35+
export const ALERT_CLEAR = 'ALERT_CLEAR';
36+
export const ALERT_NOOP = 'ALERT_NOOP';
37+
38+
export const dismissAlert = (alert: Alert) => ({
39+
type: ALERT_DISMISS,
40+
alert,
41+
});
42+
43+
export const clearAlert = () => ({
44+
type: ALERT_CLEAR,
45+
});
46+
47+
export const showAlert = (alert: Alert) => ({
48+
type: ALERT_SHOW,
49+
alert,
50+
});
51+
52+
export const showAlertForError = (error: unknown, skipNotFound = false) => {
53+
if (error instanceof AxiosError && error.response) {
54+
const { status, statusText, headers } = error.response;
55+
const { data } = error.response as AxiosResponse<ApiErrorResponse>;
56+
57+
// Skip these errors as they are reflected in the UI
58+
if (skipNotFound && (status === 404 || status === 410)) {
59+
return { type: ALERT_NOOP };
60+
}
61+
62+
// Rate limit errors
63+
if (status === 429 && headers['x-ratelimit-reset']) {
64+
return showAlert({
65+
title: messages.rateLimitedTitle,
66+
message: messages.rateLimitedMessage,
67+
values: {
68+
retry_time: new Date(headers['x-ratelimit-reset'] as string),
69+
},
70+
});
71+
}
72+
73+
return showAlert({
74+
title: `${status}`,
75+
message: data.error ?? statusText,
76+
});
77+
}
78+
79+
// An aborted request, e.g. due to reloading the browser window, it not really error
80+
if (error instanceof AxiosError && error.code === AxiosError.ECONNABORTED) {
81+
return { type: ALERT_NOOP };
82+
}
83+
84+
console.error(error);
85+
86+
return showAlert({
87+
title: messages.unexpectedTitle,
88+
message: messages.unexpectedMessage,
89+
});
90+
};

0 commit comments

Comments
 (0)