Merge commit '01464074c91f9b7a720928fc4ee912be3d8002d2' into glitch-soc/merge-upstream

pull/2691/head
Claire 2024-04-06 19:54:11 +02:00
commit 67842ffb22
10 changed files with 34 additions and 32 deletions

View File

@ -1,5 +1,3 @@
inherits_from: .haml-lint_todo.yml
exclude: exclude:
- 'vendor/**/*' - 'vendor/**/*'
- lib/templates/haml/scaffold/_form.html.haml - lib/templates/haml/scaffold/_form.html.haml

View File

@ -58,6 +58,7 @@ gem 'htmlentities', '~> 4.3'
gem 'http', '~> 5.1' gem 'http', '~> 5.1'
gem 'http_accept_language', '~> 2.1' gem 'http_accept_language', '~> 2.1'
gem 'httplog', '~> 1.6.2' gem 'httplog', '~> 1.6.2'
gem 'i18n', '1.14.1' # TODO: Remove version when resolved: https://github.com/glebm/i18n-tasks/issues/552 / https://github.com/ruby-i18n/i18n/pull/688
gem 'idn-ruby', require: 'idn' gem 'idn-ruby', require: 'idn'
gem 'inline_svg' gem 'inline_svg'
gem 'kaminari', '~> 1.2' gem 'kaminari', '~> 1.2'

View File

@ -866,6 +866,7 @@ DEPENDENCIES
http (~> 5.1) http (~> 5.1)
http_accept_language (~> 2.1) http_accept_language (~> 2.1)
httplog (~> 1.6.2) httplog (~> 1.6.2)
i18n (= 1.14.1)
i18n-tasks (~> 1.0) i18n-tasks (~> 1.0)
idn-ruby idn-ruby
inline_svg inline_svg

View File

@ -13,7 +13,7 @@ import ChevronRightIcon from '@/material-icons/400-24px/chevron_right.svg?react'
import CloseIcon from '@/material-icons/400-24px/close.svg?react'; import CloseIcon from '@/material-icons/400-24px/close.svg?react';
import SettingsIcon from '@/material-icons/400-24px/settings.svg?react'; import SettingsIcon from '@/material-icons/400-24px/settings.svg?react';
import { Icon } from 'mastodon/components/icon'; import { Icon } from 'mastodon/components/icon';
import { ButtonInTabsBar, useColumnsContext } from 'mastodon/features/ui/util/columns_context'; import { ButtonInTabsBar } from 'mastodon/features/ui/util/columns_context';
import { WithRouterPropTypes } from 'mastodon/utils/react_router'; import { WithRouterPropTypes } from 'mastodon/utils/react_router';
import { useAppHistory } from './router'; import { useAppHistory } from './router';
@ -26,10 +26,9 @@ const messages = defineMessages({
back: { id: 'column_back_button.label', defaultMessage: 'Back' }, back: { id: 'column_back_button.label', defaultMessage: 'Back' },
}); });
const BackButton = ({ pinned, show, onlyIcon }) => { const BackButton = ({ onlyIcon }) => {
const history = useAppHistory(); const history = useAppHistory();
const intl = useIntl(); const intl = useIntl();
const { multiColumn } = useColumnsContext();
const handleBackClick = useCallback(() => { const handleBackClick = useCallback(() => {
if (history.location?.state?.fromMastodon) { if (history.location?.state?.fromMastodon) {
@ -39,10 +38,6 @@ const BackButton = ({ pinned, show, onlyIcon }) => {
} }
}, [history]); }, [history]);
const showButton = history && !pinned && ((multiColumn && history.location?.state?.fromMastodon) || show);
if (!showButton) return null;
return ( return (
<button onClick={handleBackClick} className={classNames('column-header__back-button', { 'compact': onlyIcon })} aria-label={intl.formatMessage(messages.back)}> <button onClick={handleBackClick} className={classNames('column-header__back-button', { 'compact': onlyIcon })} aria-label={intl.formatMessage(messages.back)}>
<Icon id='chevron-left' icon={ArrowBackIcon} className='column-back-button__icon' /> <Icon id='chevron-left' icon={ArrowBackIcon} className='column-back-button__icon' />
@ -52,8 +47,6 @@ const BackButton = ({ pinned, show, onlyIcon }) => {
}; };
BackButton.propTypes = { BackButton.propTypes = {
pinned: PropTypes.bool,
show: PropTypes.bool,
onlyIcon: PropTypes.bool, onlyIcon: PropTypes.bool,
}; };
@ -118,7 +111,7 @@ class ColumnHeader extends PureComponent {
}; };
render () { render () {
const { title, icon, iconComponent, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage }, placeholder, appendContent, collapseIssues } = this.props; const { title, icon, iconComponent, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage }, placeholder, appendContent, collapseIssues, history } = this.props;
const { collapsed, animating } = this.state; const { collapsed, animating } = this.state;
const wrapperClassName = classNames('column-header__wrapper', { const wrapperClassName = classNames('column-header__wrapper', {
@ -161,7 +154,9 @@ class ColumnHeader extends PureComponent {
pinButton = <button className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='plus' icon={AddIcon} /> <FormattedMessage id='column_header.pin' defaultMessage='Pin' /></button>; pinButton = <button className='text-btn column-header__setting-btn' onClick={this.handlePin}><Icon id='plus' icon={AddIcon} /> <FormattedMessage id='column_header.pin' defaultMessage='Pin' /></button>;
} }
backButton = <BackButton pinned={pinned} show={showBackButton} onlyIcon={!!title} />; if (history && !pinned && ((multiColumn && history.location?.state?.fromMastodon) || showBackButton)) {
backButton = <BackButton onlyIcon={!!title} />;
}
const collapsedContent = [ const collapsedContent = [
extraContent, extraContent,
@ -199,16 +194,16 @@ class ColumnHeader extends PureComponent {
<h1 className={buttonClassName}> <h1 className={buttonClassName}>
{hasTitle && ( {hasTitle && (
<> <>
{showBackButton && backButton} {backButton}
<button onClick={this.handleTitleClick} className='column-header__title'> <button onClick={this.handleTitleClick} className='column-header__title'>
{!showBackButton && <Icon id={icon} icon={iconComponent} className='column-header__icon' />} {!backButton && <Icon id={icon} icon={iconComponent} className='column-header__icon' />}
{title} {title}
</button> </button>
</> </>
)} )}
{!hasTitle && showBackButton && backButton} {!hasTitle && backButton}
<div className='column-header__buttons'> <div className='column-header__buttons'>
{extraButton} {extraButton}

View File

@ -68,7 +68,7 @@ class FollowRequests extends ImmutablePureComponent {
); );
return ( return (
<Column bindToDocument={!multiColumn} icon='user-plus' iconComponent={PersonAddIcon} heading={intl.formatMessage(messages.heading)} alwaysShowBackButton> <Column bindToDocument={!multiColumn} icon='user-plus' iconComponent={PersonAddIcon} heading={intl.formatMessage(messages.heading)}>
<ScrollableList <ScrollableList
scrollKey='follow_requests' scrollKey='follow_requests'
onLoadMore={this.handleLoadMore} onLoadMore={this.handleLoadMore}

View File

@ -16,7 +16,13 @@ class AccountRelationshipSeveranceEvent < ApplicationRecord
belongs_to :account belongs_to :account
belongs_to :relationship_severance_event belongs_to :relationship_severance_event
delegate :severed_relationships, :type, :target_name, :purged, to: :relationship_severance_event, prefix: false delegate :severed_relationships,
:type,
:target_name,
:purged,
:purged?,
to: :relationship_severance_event,
prefix: false
before_create :set_relationships_count! before_create :set_relationships_count!

View File

@ -89,7 +89,7 @@ class Notification < ApplicationRecord
belongs_to :favourite, inverse_of: :notification belongs_to :favourite, inverse_of: :notification
belongs_to :poll, inverse_of: false belongs_to :poll, inverse_of: false
belongs_to :report, inverse_of: false belongs_to :report, inverse_of: false
belongs_to :relationship_severance_event, inverse_of: false belongs_to :account_relationship_severance_event, inverse_of: false
end end
validates :type, inclusion: { in: TYPES } validates :type, inclusion: { in: TYPES }

View File

@ -6,7 +6,7 @@ class REST::NotificationSerializer < ActiveModel::Serializer
belongs_to :from_account, key: :account, serializer: REST::AccountSerializer belongs_to :from_account, key: :account, serializer: REST::AccountSerializer
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer
belongs_to :relationship_severance_event, key: :event, if: :relationship_severance_event?, serializer: REST::AccountRelationshipSeveranceEventSerializer belongs_to :account_relationship_severance_event, key: :event, if: :relationship_severance_event?, serializer: REST::AccountRelationshipSeveranceEventSerializer
def id def id
object.id.to_s object.id.to_s

View File

@ -7,11 +7,12 @@ describe 'Severed relationships page' do
describe 'GET severed_relationships#index' do describe 'GET severed_relationships#index' do
let(:user) { Fabricate(:user) } let(:user) { Fabricate(:user) }
let(:event) { Fabricate(:account_relationship_severance_event, account: user.account) }
before do before do
sign_in user sign_in user
Fabricate(:severed_relationship, local_account: user.account) Fabricate.times(3, :severed_relationship, local_account: user.account, relationship_severance_event: event.relationship_severance_event)
end end
it 'returns http success' do it 'returns http success' do

View File

@ -5049,11 +5049,11 @@ __metadata:
linkType: hard linkType: hard
"autoprefixer@npm:^10.4.14, autoprefixer@npm:^10.4.18": "autoprefixer@npm:^10.4.14, autoprefixer@npm:^10.4.18":
version: 10.4.18 version: 10.4.19
resolution: "autoprefixer@npm:10.4.18" resolution: "autoprefixer@npm:10.4.19"
dependencies: dependencies:
browserslist: "npm:^4.23.0" browserslist: "npm:^4.23.0"
caniuse-lite: "npm:^1.0.30001591" caniuse-lite: "npm:^1.0.30001599"
fraction.js: "npm:^4.3.7" fraction.js: "npm:^4.3.7"
normalize-range: "npm:^0.1.2" normalize-range: "npm:^0.1.2"
picocolors: "npm:^1.0.0" picocolors: "npm:^1.0.0"
@ -5062,7 +5062,7 @@ __metadata:
postcss: ^8.1.0 postcss: ^8.1.0
bin: bin:
autoprefixer: bin/autoprefixer autoprefixer: bin/autoprefixer
checksum: 10c0/b6e1c1ba2fc6c09360cdcd75b00ce809c5dbe1ad4c30f0186764609a982aa5563d45965cb9e6a9d195c639a9fb1dcac2594484fc41624050195f626e9add666e checksum: 10c0/fe0178eb8b1da4f15c6535cd329926609b22d1811e047371dccce50563623f8075dd06fb167daff059e4228da651b0bdff6d9b44281541eaf0ce0b79125bfd19
languageName: node languageName: node
linkType: hard linkType: hard
@ -5805,10 +5805,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001587, caniuse-lite@npm:^1.0.30001591": "caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001587, caniuse-lite@npm:^1.0.30001599":
version: 1.0.30001591 version: 1.0.30001599
resolution: "caniuse-lite@npm:1.0.30001591" resolution: "caniuse-lite@npm:1.0.30001599"
checksum: 10c0/21937d341c3d75994504db21340f65573a1e847a8ab33ee4964ed493994d6552864c494ba144485459abd9c711c75c0708bc9fa19f2bff525bff75ffb0a42c3b checksum: 10c0/8b3b9610b5be88533a3c8d0770d6896f7b1a9fee3dbeb7339e4ee119a514c81e5e07a628a5a289a6541ca291ac78a9402f5a99cf6012139e91f379083488a8eb
languageName: node languageName: node
linkType: hard linkType: hard
@ -13882,13 +13882,13 @@ __metadata:
linkType: hard linkType: hard
"postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.33": "postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.33":
version: 8.4.37 version: 8.4.38
resolution: "postcss@npm:8.4.37" resolution: "postcss@npm:8.4.38"
dependencies: dependencies:
nanoid: "npm:^3.3.7" nanoid: "npm:^3.3.7"
picocolors: "npm:^1.0.0" picocolors: "npm:^1.0.0"
source-map-js: "npm:^1.2.0" source-map-js: "npm:^1.2.0"
checksum: 10c0/0b5730ad0ccbceaf0faaa4a283a144adefd23254f17dbdd63be5e0b37193c7df58003f88742c04c3ae6fd60d1a5158b331a4ce926797fb21e94833ae83c6bf69 checksum: 10c0/955407b8f70cf0c14acf35dab3615899a2a60a26718a63c848cf3c29f2467b0533991b985a2b994430d890bd7ec2b1963e36352b0774a19143b5f591540f7c06
languageName: node languageName: node
linkType: hard linkType: hard