Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream changes up to e1d7efadc04dd0826c6bcfe43325688566e13881 #2939

Merged
merged 29 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
22c1b6f
Fix `Invite#code` changing value on every save (#33550)
mjankowski Jan 10, 2025
f3f6b65
Update dependency @babel/plugin-transform-nullish-coalescing-operator…
renovate[bot] Jan 13, 2025
44d9dc4
Update dependency pino-http to v10.4.0 (#33560)
renovate[bot] Jan 13, 2025
99637f2
Update dependency ox to v2.14.20 (#33567)
renovate[bot] Jan 13, 2025
53885b0
New Crowdin Translations (automated) (#33559)
github-actions[bot] Jan 13, 2025
d517fa5
Change ActivityPub path generation to all happen in `ActivityPub::Tag…
ClearlyClaire Jan 13, 2025
50449ae
Fix media preview height in compose form when 3 or more images are at…
ClearlyClaire Jan 13, 2025
68d8181
Switch `webpush` dependency to latest version of Mastodon-maintained …
ClearlyClaire Jan 13, 2025
3c4a83f
Remove unused `LanguagePresenter#native_name` (#33551)
mjankowski Jan 13, 2025
3a762cd
Reject announce payload if object is nil (#33570)
ShadowJonathan Jan 13, 2025
0db7558
Fix HTTP 500 on `POST /api/v1/admin/ip_blocks` (#29308)
danielmbrasil Jan 13, 2025
f9451c5
Fix issue with trending order when user has chosen languages (#33557)
mjankowski Jan 13, 2025
77a44e6
Add enum validation to `DomainBlock#severity` (#29158)
hendrixfan Jan 13, 2025
74da9e9
Fix custom css cache miss (#33583)
tribela Jan 14, 2025
ee4edbb
New Crowdin Translations (automated) (#33582)
github-actions[bot] Jan 14, 2025
4a28131
Add support for standard webpush (#33528)
p1gp1g Jan 14, 2025
a9a8b6b
Expand coverage of admin/trends/* areas (#33581)
mjankowski Jan 14, 2025
e2f085e
Use final specification for new WebPush subscriptions in web interfac…
ClearlyClaire Jan 14, 2025
e946296
Redirect new users to onboarding (#33471)
ClearlyClaire Jan 14, 2025
7b608b4
Update dependency @babel/plugin-transform-nullish-coalescing-operator…
renovate[bot] Jan 14, 2025
6356870
Update dependency sass to v1.83.4 (#33585)
renovate[bot] Jan 14, 2025
87849d7
Update dependency rspec-github to v3 (#33589)
renovate[bot] Jan 14, 2025
7c56517
Move mastodon version config to `config_for` yml (#33577)
mjankowski Jan 14, 2025
50013b1
Add `Status::Visibility` concern to hold visibility logic (#33578)
mjankowski Jan 14, 2025
bfe73e1
Update dependency postcss to v8.5.1 (#33586)
renovate[bot] Jan 14, 2025
e1d7efa
Fix libyaml missing from Dockerfile build stage (#33591)
vmstan Jan 14, 2025
ab152eb
Merge commit 'e1d7efadc04dd0826c6bcfe43325688566e13881' into glitch-s…
ClearlyClaire Jan 14, 2025
563ff91
[Glitch] Use final specification for new WebPush subscriptions in web…
ClearlyClaire Jan 14, 2025
09bd5aa
[Glitch] Redirect new users to onboarding
ClearlyClaire Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ RUN \
libpq-dev \
libssl-dev \
libtool \
libyaml-dev \
meson \
nasm \
pkg-config \
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ gem 'twitter-text', '~> 3.1.0'
gem 'tzinfo-data', '~> 1.2023'
gem 'webauthn', '~> 3.0'
gem 'webpacker', '~> 5.4'
gem 'webpush', github: 'ClearlyClaire/webpush', ref: 'f14a4d52e201128b1b00245d11b6de80d6cfdcd9'
gem 'webpush', github: 'mastodon/webpush', ref: '9631ac63045cfabddacc69fc06e919b4c13eb913'

gem 'json-ld'
gem 'json-ld-preloaded', '~> 3.2'
Expand Down Expand Up @@ -125,7 +125,7 @@ group :test do
gem 'flatware-rspec'

# Adds RSpec Error/Warning annotations to GitHub PRs on the Files tab
gem 'rspec-github', '~> 2.4', require: false
gem 'rspec-github', '~> 3.0', require: false

# RSpec helpers for email specs
gem 'email_spec'
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GIT
remote: https://github.com/ClearlyClaire/webpush.git
revision: f14a4d52e201128b1b00245d11b6de80d6cfdcd9
ref: f14a4d52e201128b1b00245d11b6de80d6cfdcd9
remote: https://github.com/mastodon/webpush.git
revision: 9631ac63045cfabddacc69fc06e919b4c13eb913
ref: 9631ac63045cfabddacc69fc06e919b4c13eb913
specs:
webpush (0.3.8)
webpush (1.1.0)
hkdf (~> 0.2)
jwt (~> 2.0)

Expand Down Expand Up @@ -555,7 +555,7 @@ GEM
opentelemetry-api (~> 1.0)
orm_adapter (0.5.0)
ostruct (0.6.1)
ox (2.14.19)
ox (2.14.20)
bigdecimal (>= 3.0)
parallel (1.26.3)
parser (3.3.6.0)
Expand Down Expand Up @@ -690,7 +690,7 @@ GEM
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-github (2.4.0)
rspec-github (3.0.0)
rspec-core (~> 3.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
Expand Down Expand Up @@ -994,7 +994,7 @@ DEPENDENCIES
redis (~> 4.5)
redis-namespace (~> 1.10)
rqrcode (~> 2.2)
rspec-github (~> 2.4)
rspec-github (~> 3.0)
rspec-rails (~> 7.0)
rspec-sidekiq (~> 5.0)
rubocop
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/activitypub/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def set_type

def collection_presenter
ActivityPub::CollectionPresenter.new(
id: account_collection_url(@account, params[:id]),
id: ActivityPub::TagManager.instance.collection_uri_for(@account, params[:id]),
type: @type,
size: @size,
items: @items
Expand Down
8 changes: 2 additions & 6 deletions app/controllers/activitypub/outboxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ def outbox_presenter
end
end

def outbox_url(**)
if params[:account_username].present?
account_outbox_url(@account, **)
else
instance_actor_outbox_url(**)
end
def outbox_url(...)
ActivityPub::TagManager.instance.outbox_uri_for(@account, ...)
end

def next_page
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/api/v1/push/subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def create
endpoint: subscription_params[:endpoint],
key_p256dh: subscription_params[:keys][:p256dh],
key_auth: subscription_params[:keys][:auth],
standard: subscription_params[:standard] || false,
data: data_params,
user_id: current_user.id,
access_token_id: doorkeeper_token.id
Expand Down Expand Up @@ -55,7 +56,7 @@ def check_push_subscription
end

def subscription_params
params.require(:subscription).permit(:endpoint, keys: [:auth, :p256dh])
params.require(:subscription).permit(:endpoint, :standard, keys: [:auth, :p256dh])
end

def data_params
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/api/web/push_subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def set_push_subscription
end

def subscription_params
@subscription_params ||= params.require(:subscription).permit(:endpoint, keys: [:auth, :p256dh])
@subscription_params ||= params.require(:subscription).permit(:standard, :endpoint, keys: [:auth, :p256dh])
end

def web_push_subscription_params
Expand All @@ -76,6 +76,7 @@ def web_push_subscription_params
endpoint: subscription_params[:endpoint],
key_auth: subscription_params[:keys][:auth],
key_p256dh: subscription_params[:keys][:p256dh],
standard: subscription_params[:standard] || false,
user_id: active_session.user_id,
}
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/follower_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def page_requested?
end

def page_url(page)
account_followers_url(@account, page: page) unless page.nil?
ActivityPub::TagManager.instance.followers_uri_for(@account, page: page) unless page.nil?
end

def next_page_url
Expand Down
4 changes: 3 additions & 1 deletion app/helpers/theme_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def active_custom_stylesheet
end

def cached_custom_css_digest
Rails.cache.read(:setting_digest_custom_css)
Rails.cache.fetch(:setting_digest_custom_css) do
Setting.custom_css&.then { |content| Digest::SHA256.hexdigest(content) }
end
end

def theme_color_for(theme)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const unsubscribe = ({ registration, subscription }) =>
subscription ? subscription.unsubscribe().then(() => registration) : registration;

const sendSubscriptionToBackend = (subscription) => {
const params = { subscription };
const params = { subscription: { ...subscription.toJSON(), standard: true } };

if (me) {
const data = pushNotificationsSetting.get(me);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/api_types/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface BaseApiAccountJSON {
avatar_static: string;
bot: boolean;
created_at: string;
discoverable: boolean;
discoverable?: boolean;
indexable: boolean;
display_name: string;
emojis: ApiCustomEmojiJSON[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import AddPhotoAlternateIcon from '@/material-icons/400-24px/add_photo_alternate
import EditIcon from '@/material-icons/400-24px/edit.svg?react';
import PersonIcon from '@/material-icons/400-24px/person.svg?react';
import { updateAccount } from 'flavours/glitch/actions/accounts';
import { closeOnboarding } from 'flavours/glitch/actions/onboarding';
import { Button } from 'flavours/glitch/components/button';
import { Column } from 'flavours/glitch/components/column';
import { ColumnHeader } from 'flavours/glitch/components/column_header';
Expand Down Expand Up @@ -58,7 +59,9 @@ export const Profile: React.FC<{
);
const [avatar, setAvatar] = useState<File>();
const [header, setHeader] = useState<File>();
const [discoverable, setDiscoverable] = useState(true);
const [discoverable, setDiscoverable] = useState(
account?.discoverable ?? true,
);
const [isSaving, setIsSaving] = useState(false);
const [errors, setErrors] = useState<ApiAccountErrors>();
const avatarFileRef = createRef<HTMLInputElement>();
Expand Down Expand Up @@ -132,6 +135,7 @@ export const Profile: React.FC<{
)
.then(() => {
history.push('/start/follows');
dispatch(closeOnboarding());
return '';
})
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
Expand Down
13 changes: 9 additions & 4 deletions app/javascript/flavours/glitch/features/ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const mapStateToProps = state => ({
hicolorPrivacyIcons: state.getIn(['local_settings', 'hicolor_privacy_icons']),
moved: state.getIn(['accounts', me, 'moved']) && state.getIn(['accounts', state.getIn(['accounts', me, 'moved'])]),
firstLaunch: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION,
newAccount: !state.getIn(['accounts', me, 'note']) && !state.getIn(['accounts', me, 'bot']) && state.getIn(['accounts', me, 'following_count'], 0) === 0 && state.getIn(['accounts', me, 'statuses_count'], 0) === 0,
username: state.getIn(['accounts', me, 'username']),
});

Expand Down Expand Up @@ -144,6 +145,7 @@ class SwitchingColumnsArea extends PureComponent {
children: PropTypes.node,
location: PropTypes.object,
singleColumn: PropTypes.bool,
forceOnboarding: PropTypes.bool,
};

UNSAFE_componentWillMount () {
Expand Down Expand Up @@ -174,14 +176,16 @@ class SwitchingColumnsArea extends PureComponent {
};

render () {
const { children, singleColumn } = this.props;
const { children, singleColumn, forceOnboarding } = this.props;
const { signedIn } = this.props.identity;
const pathName = this.props.location.pathname;

let redirect;

if (signedIn) {
if (singleColumn) {
if (forceOnboarding) {
redirect = <Redirect from='/' to='/start' exact />;
} else if (singleColumn) {
redirect = <Redirect from='/' to='/home' exact />;
} else {
redirect = <Redirect from='/' to='/deck/getting-started' exact />;
Expand Down Expand Up @@ -292,6 +296,7 @@ class UI extends PureComponent {
moved: PropTypes.map,
layout: PropTypes.string.isRequired,
firstLaunch: PropTypes.bool,
newAccount: PropTypes.bool,
username: PropTypes.string,
...WithRouterPropTypes,
};
Expand Down Expand Up @@ -615,7 +620,7 @@ class UI extends PureComponent {

render () {
const { draggingOver } = this.state;
const { children, isWide, location, layout, moved } = this.props;
const { children, isWide, location, layout, moved, firstLaunch, newAccount } = this.props;

const className = classNames('ui', {
'wide': isWide,
Expand Down Expand Up @@ -662,7 +667,7 @@ class UI extends PureComponent {

<Header />

<SwitchingColumnsArea identity={this.props.identity} location={location} singleColumn={layout === 'mobile' || layout === 'single-column'}>
<SwitchingColumnsArea identity={this.props.identity} location={location} singleColumn={layout === 'mobile' || layout === 'single-column'} forceOnboarding={firstLaunch && newAccount}>
{children}
</SwitchingColumnsArea>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const unsubscribe = ({ registration, subscription }) =>
subscription ? subscription.unsubscribe().then(() => registration) : registration;

const sendSubscriptionToBackend = (subscription) => {
const params = { subscription };
const params = { subscription: { ...subscription.toJSON(), standard: true } };

if (me) {
const data = pushNotificationsSetting.get(me);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/api_types/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface BaseApiAccountJSON {
avatar_static: string;
bot: boolean;
created_at: string;
discoverable: boolean;
discoverable?: boolean;
indexable: boolean;
display_name: string;
emojis: ApiCustomEmojiJSON[];
Expand Down
6 changes: 5 additions & 1 deletion app/javascript/mastodon/features/onboarding/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import AddPhotoAlternateIcon from '@/material-icons/400-24px/add_photo_alternate
import EditIcon from '@/material-icons/400-24px/edit.svg?react';
import PersonIcon from '@/material-icons/400-24px/person.svg?react';
import { updateAccount } from 'mastodon/actions/accounts';
import { closeOnboarding } from 'mastodon/actions/onboarding';
import { Button } from 'mastodon/components/button';
import { Column } from 'mastodon/components/column';
import { ColumnHeader } from 'mastodon/components/column_header';
Expand Down Expand Up @@ -58,7 +59,9 @@ export const Profile: React.FC<{
);
const [avatar, setAvatar] = useState<File>();
const [header, setHeader] = useState<File>();
const [discoverable, setDiscoverable] = useState(true);
const [discoverable, setDiscoverable] = useState(
account?.discoverable ?? true,
);
const [isSaving, setIsSaving] = useState(false);
const [errors, setErrors] = useState<ApiAccountErrors>();
const avatarFileRef = createRef<HTMLInputElement>();
Expand Down Expand Up @@ -132,6 +135,7 @@ export const Profile: React.FC<{
)
.then(() => {
history.push('/start/follows');
dispatch(closeOnboarding());
return '';
})
// eslint-disable-next-line @typescript-eslint/use-unknown-in-catch-callback-variable
Expand Down
13 changes: 9 additions & 4 deletions app/javascript/mastodon/features/ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const mapStateToProps = state => ({
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < state.getIn(['server', 'server', 'configuration', 'statuses', 'max_media_attachments']),
firstLaunch: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION,
newAccount: !state.getIn(['accounts', me, 'note']) && !state.getIn(['accounts', me, 'bot']) && state.getIn(['accounts', me, 'following_count'], 0) === 0 && state.getIn(['accounts', me, 'statuses_count'], 0) === 0,
username: state.getIn(['accounts', me, 'username']),
});

Expand Down Expand Up @@ -135,6 +136,7 @@ class SwitchingColumnsArea extends PureComponent {
children: PropTypes.node,
location: PropTypes.object,
singleColumn: PropTypes.bool,
forceOnboarding: PropTypes.bool,
};

UNSAFE_componentWillMount () {
Expand Down Expand Up @@ -165,14 +167,16 @@ class SwitchingColumnsArea extends PureComponent {
};

render () {
const { children, singleColumn } = this.props;
const { children, singleColumn, forceOnboarding } = this.props;
const { signedIn } = this.props.identity;
const pathName = this.props.location.pathname;

let redirect;

if (signedIn) {
if (singleColumn) {
if (forceOnboarding) {
redirect = <Redirect from='/' to='/start' exact />;
} else if (singleColumn) {
redirect = <Redirect from='/' to='/home' exact />;
} else {
redirect = <Redirect from='/' to='/deck/getting-started' exact />;
Expand Down Expand Up @@ -276,6 +280,7 @@ class UI extends PureComponent {
intl: PropTypes.object.isRequired,
layout: PropTypes.string.isRequired,
firstLaunch: PropTypes.bool,
newAccount: PropTypes.bool,
username: PropTypes.string,
...WithRouterPropTypes,
};
Expand Down Expand Up @@ -568,7 +573,7 @@ class UI extends PureComponent {

render () {
const { draggingOver } = this.state;
const { children, isComposing, location, layout } = this.props;
const { children, isComposing, location, layout, firstLaunch, newAccount } = this.props;

const handlers = {
help: this.handleHotkeyToggleHelp,
Expand Down Expand Up @@ -597,7 +602,7 @@ class UI extends PureComponent {
<div className={classNames('ui', { 'is-composing': isComposing })} ref={this.setRef}>
<Header />

<SwitchingColumnsArea identity={this.props.identity} location={location} singleColumn={layout === 'mobile' || layout === 'single-column'}>
<SwitchingColumnsArea identity={this.props.identity} location={location} singleColumn={layout === 'mobile' || layout === 'single-column'} forceOnboarding={firstLaunch && newAccount}>
{children}
</SwitchingColumnsArea>

Expand Down
Loading
Loading