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 57f592fed50747f3c97718a2761e17bafe6c8698 #2426

Merged
merged 36 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a011d3a
Ignore CVE-2023-26141 (Sidekiq) from bundler audit (#27037)
renchap Sep 22, 2023
4aaaf0d
Fix the search documentation URL in system checks (#27036)
renchap Sep 22, 2023
e824585
New Crowdin Translations (automated) (#27052)
github-actions[bot] Sep 22, 2023
39da3d8
Fix ActiveRecord using two connection pools when no replica is define…
ClearlyClaire Sep 22, 2023
b93ffb7
Improve modals reducer types (#26610)
renchap Sep 22, 2023
4b7bc1f
Convert `dropdown_menu` state to Typescript (#25585)
renchap Sep 22, 2023
1fa40cf
Update eslint (non-major) (#27113)
renovate[bot] Sep 25, 2023
a4c29a4
Update Node.js to v20.7 (#27112)
renovate[bot] Sep 25, 2023
c56d7d7
Update dependency @reduxjs/toolkit to v1.9.6 (#27110)
renovate[bot] Sep 25, 2023
736fe75
New Crowdin Translations (automated) (#27080)
github-actions[bot] Sep 25, 2023
82c44f4
Update dependency glob to v10.3.7 (#27078)
renovate[bot] Sep 25, 2023
aeeddb9
Update DefinitelyTyped types (non-major) (#27109)
renovate[bot] Sep 25, 2023
88fa8e7
Fix line wrapping of language selection button with long locale codes…
gunchleoc Sep 25, 2023
1bd7455
Fix inefficient queries in “Follows and followers” as well as several…
ClearlyClaire Sep 25, 2023
38753ac
Fix width of large text icon buttons (#27127)
ClearlyClaire Sep 25, 2023
3de6dcf
Add redirection on `/deck` URLs for logged-out users (#27128)
ClearlyClaire Sep 25, 2023
a001ae2
Fix explore prompt sometimes showing up when the home TL is loading (…
ClearlyClaire Sep 25, 2023
06444c8
Fix division by zero in video in bitrate computation code (#27129)
ClearlyClaire Sep 25, 2023
cf9230f
Update docker/build-push-action action to v5 (#27120)
renovate[bot] Sep 25, 2023
19bc73b
Update docker/login-action action to v3 (#27121)
renovate[bot] Sep 25, 2023
8ea98aa
Update docker/metadata-action action to v5 (#27122)
renovate[bot] Sep 25, 2023
cdd8c4e
Update docker/setup-buildx-action action to v3 (#27123)
renovate[bot] Sep 25, 2023
530f486
Update docker/setup-qemu-action action to v3 (#27124)
renovate[bot] Sep 25, 2023
bd81039
Properly remove tIME chunk from PNG uploads (#27111)
TheEssem Sep 25, 2023
33a066a
Update dependency glob to v10.3.8 (#27145)
renovate[bot] Sep 26, 2023
5ea3e8e
New Crowdin Translations (automated) (#27144)
github-actions[bot] Sep 26, 2023
fdc9f97
Update dependency selenium-webdriver to v4.13.1 (#27141)
renovate[bot] Sep 26, 2023
82eaa26
Update `tootctl maintenance fix-duplicates` to Mastodon v4.2.0 (#27147)
ClearlyClaire Sep 26, 2023
2054ee7
Update dependency glob to v10.3.9 (#27148)
renovate[bot] Sep 26, 2023
57f592f
Add Typescript types for some API objects (#26602)
renchap Sep 26, 2023
abdb588
Merge commit '57f592fed50747f3c97718a2761e17bafe6c8698' into glitch-s…
ClearlyClaire Sep 26, 2023
b2d67fb
[Glitch] Improve modals reducer types
renchap Sep 22, 2023
919ed0e
[Glitch] Convert `dropdown_menu` state to Typescript
renchap Sep 22, 2023
02e6d9f
[Glitch] Fix explore prompt sometimes showing up when the home TL is …
ClearlyClaire Sep 25, 2023
ca7d169
[Glitch] Fix line wrapping of language selection button with long loc…
gunchleoc Sep 25, 2023
1eeaa0d
[Glitch] Fix width of large text icon buttons
ClearlyClaire Sep 25, 2023
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
4 changes: 4 additions & 0 deletions .bundler-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
ignore:
# Sidekiq security issue, fixes in the latest Sidekiq 7 but we can not upgrade. Will be fixed in Sidekiq 6.5.10
- CVE-2023-26141
14 changes: 7 additions & 7 deletions .github/workflows/build-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v2
- uses: docker/setup-qemu-action@v3
if: contains(inputs.platforms, 'linux/arm64') && !inputs.use_native_arm64_builder

- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v3
id: buildx
if: ${{ !(inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')) }}

Expand All @@ -41,7 +41,7 @@ jobs:
run: |
docker run --rm -d --name buildkitd -p 1234:1234 --privileged moby/buildkit:latest --addr tcp://0.0.0.0:1234

- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v3
id: buildx-native
if: inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')
with:
Expand All @@ -61,20 +61,20 @@ jobs:

- name: Log in to Docker Hub
if: contains(inputs.push_to_images, 'tootsuite')
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the Github Container registry
if: contains(inputs.push_to_images, 'ghcr.io')
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v4
- uses: docker/metadata-action@v5
id: meta
if: ${{ inputs.push_to_images != '' }}
with:
Expand All @@ -83,7 +83,7 @@ jobs:
tags: ${{ inputs.tags }}
labels: ${{ inputs.labels }}

- uses: docker/build-push-action@v4
- uses: docker/build-push-action@v5
with:
context: .
build-args: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4
# This needs to be bookworm-slim because the Ruby image is built on bookworm-slim
ARG NODE_VERSION="20.6-bookworm-slim"
ARG NODE_VERSION="20.7-bookworm-slim"

FROM ghcr.io/moritzheiber/ruby-jemalloc:3.2.2-slim as ruby
FROM node:${NODE_VERSION} as build
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ GEM
scenic (1.7.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
selenium-webdriver (4.11.0)
selenium-webdriver (4.13.1)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
Expand Down Expand Up @@ -804,7 +804,7 @@ GEM
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket (1.2.9)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down
17 changes: 15 additions & 2 deletions app/helpers/database_helper.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# frozen_string_literal: true

module DatabaseHelper
def replica_enabled?
ENV['REPLICA_DB_NAME'] || ENV.fetch('REPLICA_DATABASE_URL', nil)
end
module_function :replica_enabled?

def with_read_replica(&block)
ApplicationRecord.connected_to(role: :reading, prevent_writes: true, &block)
if replica_enabled?
ApplicationRecord.connected_to(role: :reading, prevent_writes: true, &block)
else
yield
end
end

def with_primary(&block)
ApplicationRecord.connected_to(role: :writing, &block)
if replica_enabled?
ApplicationRecord.connected_to(role: :writing, &block)
else
yield
end
end
end
10 changes: 0 additions & 10 deletions app/javascript/flavours/glitch/actions/dropdown_menu.js

This file was deleted.

11 changes: 11 additions & 0 deletions app/javascript/flavours/glitch/actions/dropdown_menu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createAction } from '@reduxjs/toolkit';

export const openDropdownMenu = createAction<{
id: string;
keyboard: boolean;
scrollKey: string;
}>('dropdownMenu/open');

export const closeDropdownMenu = createAction<{ id: string }>(
'dropdownMenu/close',
);
4 changes: 3 additions & 1 deletion app/javascript/flavours/glitch/actions/modal.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createAction } from '@reduxjs/toolkit';

import type { ModalProps } from 'flavours/glitch/reducers/modal';

import type { MODAL_COMPONENTS } from '../features/ui/components/modal_root';

export type ModalType = keyof typeof MODAL_COMPONENTS;

interface OpenModalPayload {
modalType: ModalType;
modalProps: unknown;
modalProps: ModalProps;
}
export const openModal = createAction<OpenModalPayload>('MODAL_OPEN');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import { openDropdownMenu, closeDropdownMenu } from 'flavours/glitch/actions/dro
import { fetchHistory } from 'flavours/glitch/actions/history';
import DropdownMenu from 'flavours/glitch/components/dropdown_menu';

/**
*
* @param {import('flavours/glitch/store').RootState} state
* @param {*} props
*/
const mapStateToProps = (state, { statusId }) => ({
openDropdownId: state.getIn(['dropdown_menu', 'openId']),
openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
openDropdownId: state.dropdownMenu.openId,
openedViaKeyboard: state.dropdownMenu.keyboard,
items: state.getIn(['history', statusId, 'items']),
loading: state.getIn(['history', statusId, 'loading']),
});
Expand All @@ -15,11 +20,11 @@ const mapDispatchToProps = (dispatch, { statusId }) => ({

onOpen (id, onItemClick, keyboard) {
dispatch(fetchHistory(statusId));
dispatch(openDropdownMenu(id, keyboard));
dispatch(openDropdownMenu({ id, keyboard }));
},

onClose (id) {
dispatch(closeDropdownMenu(id));
dispatch(closeDropdownMenu({ id }));
},

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ const MOUSE_IDLE_DELAY = 300;

const listenerOptions = supportsPassiveEvents ? { passive: true } : false;

/**
*
* @param {import('flavours/glitch/store').RootState} state
* @param {*} props
*/
const mapStateToProps = (state, { scrollKey }) => {
return {
preventScroll: scrollKey === state.getIn(['dropdown_menu', 'scroll_key']),
preventScroll: scrollKey === state.dropdownMenu.scrollKey,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import DropdownMenu from 'flavours/glitch/components/dropdown_menu';

import { isUserTouching } from '../is_mobile';

/**
* @param {import('flavours/glitch/store').RootState} state
*/
const mapStateToProps = state => ({
openDropdownId: state.getIn(['dropdown_menu', 'openId']),
openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
openDropdownId: state.dropdownMenu.openId,
openedViaKeyboard: state.dropdownMenu.keyboard,
});

const mapDispatchToProps = (dispatch, { status, items, scrollKey }) => ({
Expand All @@ -20,15 +23,15 @@ const mapDispatchToProps = (dispatch, { status, items, scrollKey }) => ({
actions: items,
onClick: onItemClick,
},
}) : openDropdownMenu(id, keyboard, scrollKey));
}) : openDropdownMenu({ id, keyboard, scrollKey }));
},

onClose(id) {
dispatch(closeModal({
modalType: 'ACTIONS',
ignoreFocus: false,
}));
dispatch(closeDropdownMenu(id));
dispatch(closeDropdownMenu({ id }));
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PureComponent } from 'react';
const iconStyle = {
height: null,
lineHeight: '27px',
width: `${18 * 1.28571429}px`,
minWidth: `${18 * 1.28571429}px`,
};

export default class TextIconButton extends PureComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ const homeTooSlow = createSelector([
getHomeFeedSpeed,
], (isLoading, isPartial, speed) =>
!isLoading && !isPartial // Only if the home feed has finished loading
&& (speed.gap > (30 * 60) // If the average gap between posts is more than 20 minutes
|| (Date.now() - speed.newest) > (1000 * 3600)) // If the most recent post is from over an hour ago
&& (
(speed.gap > (30 * 60) // If the average gap between posts is more than 30 minutes
|| (Date.now() - speed.newest) > (1000 * 3600)) // If the most recent post is from over an hour ago
)
);

const mapStateToProps = state => ({
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/features/ui/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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 < 4,
isWide: state.getIn(['local_settings', 'stretch']),
dropdownMenuIsOpen: state.getIn(['dropdown_menu', 'openId']) !== null,
dropdownMenuIsOpen: state.dropdownMenu.openId !== null,
unreadNotifications: state.getIn(['notifications', 'unread']),
showFaviconBadge: state.getIn(['local_settings', 'notifications', 'favicon_badge']),
hicolorPrivacyIcons: state.getIn(['local_settings', 'hicolor_privacy_icons']),
Expand Down
19 changes: 0 additions & 19 deletions app/javascript/flavours/glitch/reducers/dropdown_menu.js

This file was deleted.

33 changes: 33 additions & 0 deletions app/javascript/flavours/glitch/reducers/dropdown_menu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { createReducer } from '@reduxjs/toolkit';

import { closeDropdownMenu, openDropdownMenu } from '../actions/dropdown_menu';

interface DropdownMenuState {
openId: string | null;
keyboard: boolean;
scrollKey: string | null;
}

const initialState: DropdownMenuState = {
openId: null,
keyboard: false,
scrollKey: null,
};

export const dropdownMenuReducer = createReducer(initialState, (builder) => {
builder
.addCase(
openDropdownMenu,
(state, { payload: { id, keyboard, scrollKey } }) => {
state.openId = id;
state.keyboard = keyboard;
state.scrollKey = scrollKey;
},
)
.addCase(closeDropdownMenu, (state, { payload: { id } }) => {
if (state.openId === id) {
state.openId = null;
state.scrollKey = null;
}
});
});
4 changes: 2 additions & 2 deletions app/javascript/flavours/glitch/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import contexts from './contexts';
import conversations from './conversations';
import custom_emojis from './custom_emojis';
import domain_lists from './domain_lists';
import dropdown_menu from './dropdown_menu';
import { dropdownMenuReducer } from './dropdown_menu';
import filters from './filters';
import followed_tags from './followed_tags';
import height_cache from './height_cache';
Expand Down Expand Up @@ -49,7 +49,7 @@ import user_lists from './user_lists';

const reducers = {
announcements,
dropdown_menu,
dropdownMenu: dropdownMenuReducer,
timelines,
meta,
alerts,
Expand Down
Loading
Loading