Merge pull request #3578 from glitch-soc/glitch-soc/merge-upstream
Merge upstream changes up to 95d3b704f6
This commit is contained in:
31 files changed
+886
-508
No files matched your search
+10
-9
@@ -12,15 +12,16 @@ SimpleCov.configure do
|
||||
formatter SimpleCov::Formatter::HTMLFormatter
|
||||
end
|
||||
|
||||
enable_coverage :branch
|
||||
enable_coverage :branch, :eval
|
||||
|
||||
add_filter 'lib/linter'
|
||||
skip 'lib/linter'
|
||||
|
||||
add_group 'Libraries', 'lib'
|
||||
add_group 'Policies', 'app/policies'
|
||||
add_group 'Presenters', 'app/presenters'
|
||||
add_group 'Search', 'app/chewy'
|
||||
add_group 'Serializers', 'app/serializers'
|
||||
add_group 'Services', 'app/services'
|
||||
add_group 'Validators', 'app/validators'
|
||||
group 'Libraries', 'lib'
|
||||
group 'Policies', 'app/policies'
|
||||
group 'Presenters', 'app/presenters'
|
||||
group 'Search', 'app/chewy'
|
||||
group 'Serializers', 'app/serializers'
|
||||
group 'Services', 'app/services'
|
||||
group 'Validators', 'app/validators'
|
||||
group 'Views', 'app/views'
|
||||
end
|
||||
@@ -153,7 +153,7 @@ group :test do
|
||||
gem 'shoulda-matchers'
|
||||
|
||||
# Coverage formatter for RSpec
|
||||
gem 'simplecov', '~> 0.22', require: false
|
||||
gem 'simplecov', require: false
|
||||
gem 'simplecov-lcov', '~> 0.8', require: false
|
||||
|
||||
# Stub web requests for specs
|
||||
|
||||
+10
-16
@@ -99,8 +99,8 @@ GEM
|
||||
ast (2.4.3)
|
||||
attr_required (1.0.2)
|
||||
aws-eventstream (1.4.0)
|
||||
aws-partitions (1.1261.0)
|
||||
aws-sdk-core (3.252.0)
|
||||
aws-partitions (1.1267.0)
|
||||
aws-sdk-core (3.254.0)
|
||||
aws-eventstream (~> 1, >= 1.3.0)
|
||||
aws-partitions (~> 1, >= 1.992.0)
|
||||
aws-sigv4 (~> 1.9)
|
||||
@@ -108,11 +108,11 @@ GEM
|
||||
bigdecimal
|
||||
jmespath (~> 1, >= 1.6.1)
|
||||
logger
|
||||
aws-sdk-kms (1.129.0)
|
||||
aws-sdk-core (~> 3, >= 3.248.0)
|
||||
aws-sdk-kms (1.130.0)
|
||||
aws-sdk-core (~> 3, >= 3.254.0)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sdk-s3 (1.226.0)
|
||||
aws-sdk-core (~> 3, >= 3.248.0)
|
||||
aws-sdk-s3 (1.227.0)
|
||||
aws-sdk-core (~> 3, >= 3.254.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sigv4 (1.12.1)
|
||||
@@ -209,7 +209,6 @@ GEM
|
||||
diff-lcs (1.6.2)
|
||||
discard (2.0.0)
|
||||
activerecord (>= 7.0, < 9.0)
|
||||
docile (1.4.1)
|
||||
domain_name (0.6.20240107)
|
||||
doorkeeper (5.9.3)
|
||||
railties (>= 5)
|
||||
@@ -287,7 +286,7 @@ GEM
|
||||
temple (>= 0.8.2)
|
||||
thor
|
||||
tilt
|
||||
haml-rails (3.0.0)
|
||||
haml-rails (3.1.0)
|
||||
actionpack (>= 5.1)
|
||||
activesupport (>= 5.1)
|
||||
haml (>= 4.0.6)
|
||||
@@ -839,13 +838,8 @@ GEM
|
||||
simple_form (5.4.1)
|
||||
actionpack (>= 7.0)
|
||||
activemodel (>= 7.0)
|
||||
simplecov (0.22.0)
|
||||
docile (~> 1.1)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov_json_formatter (~> 0.1)
|
||||
simplecov-html (0.13.2)
|
||||
simplecov (1.0.0)
|
||||
simplecov-lcov (0.9.0)
|
||||
simplecov_json_formatter (0.1.4)
|
||||
ssrf_filter (1.5.0)
|
||||
stackprof (0.2.28)
|
||||
starry (0.2.0)
|
||||
@@ -892,7 +886,7 @@ GEM
|
||||
unf (~> 0.1.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
tzinfo-data (1.2026.2)
|
||||
tzinfo-data (1.2026.3)
|
||||
tzinfo (>= 1.0.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
@@ -1085,7 +1079,7 @@ DEPENDENCIES
|
||||
sidekiq-unique-jobs (> 8)
|
||||
simple-navigation (~> 4.4)
|
||||
simple_form (~> 5.2)
|
||||
simplecov (~> 0.22)
|
||||
simplecov
|
||||
simplecov-lcov (~> 0.8)
|
||||
stackprof
|
||||
stoplight
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/* eslint-disable jsx-a11y/anchor-is-valid */
|
||||
|
||||
import type { MouseEvent } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react';
|
||||
|
||||
import { Icon } from '../icon';
|
||||
|
||||
import classes from './theme_playground.module.scss';
|
||||
|
||||
/**
|
||||
* This component is a temporary testing ground for new theme tokens.
|
||||
* It's not to be used in-app.
|
||||
*/
|
||||
export const ThemePlayground: React.FC = () => {
|
||||
const [activeLink, setActiveLink] = useState('Saved');
|
||||
|
||||
const handleLinkClick = useCallback((e: MouseEvent<HTMLAnchorElement>) => {
|
||||
e.preventDefault();
|
||||
setActiveLink(e.currentTarget.innerText);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={classes.wrapper}>
|
||||
<nav>
|
||||
<input type='text' placeholder='Search' />
|
||||
<a
|
||||
href='#'
|
||||
onClick={handleLinkClick}
|
||||
aria-current={activeLink === 'Following' ? 'page' : undefined}
|
||||
>
|
||||
Following
|
||||
</a>
|
||||
<a
|
||||
href='#'
|
||||
onClick={handleLinkClick}
|
||||
aria-current={activeLink === 'Saved' ? 'page' : undefined}
|
||||
>
|
||||
Saved
|
||||
</a>
|
||||
<a
|
||||
href='#'
|
||||
onClick={handleLinkClick}
|
||||
aria-current={activeLink === 'Explore' ? 'page' : undefined}
|
||||
>
|
||||
Explore
|
||||
</a>
|
||||
<aside>
|
||||
<h2>Display Name</h2>
|
||||
<div className={classes.subtitle}>@handle@somewhere.social</div>
|
||||
<button type='button' className={classes.menuButton}>
|
||||
<Icon id='more' icon={MoreHorizIcon} />
|
||||
</button>
|
||||
</aside>
|
||||
</nav>
|
||||
<main>Test 1 2 3</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
.wrapper {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: 250px 1fr;
|
||||
gap: 1rem;
|
||||
padding: 2rem;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: break-word;
|
||||
color: var(--color-text-primary);
|
||||
background-color: var(--color-bg-blend);
|
||||
|
||||
* {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: block;
|
||||
grid-template-rows: min-content;
|
||||
font-size: 14px;
|
||||
|
||||
input {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
margin-block-end: 1rem;
|
||||
padding: 0.5rem 1rem;
|
||||
color: var(--color-text-primary);
|
||||
background: transparent;
|
||||
border: 1px solid var(--color-border-primary);
|
||||
border-radius: 0.5rem;
|
||||
|
||||
&:focus {
|
||||
border-color: var(--color-border-brand);
|
||||
outline: 1px solid var(--color-border-brand);
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 0.5rem 1rem 0.45rem;
|
||||
border-radius: 0.5rem;
|
||||
color: var(--color-text-secondary);
|
||||
|
||||
&[aria-current='page'] {
|
||||
color: var(--color-text-primary);
|
||||
background-color: var(--color-bg-highlight);
|
||||
}
|
||||
}
|
||||
|
||||
aside {
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
'title button'
|
||||
'subtitle button';
|
||||
grid-template-columns: 1fr min-content;
|
||||
align-items: center;
|
||||
gap: 0.125rem 0.5rem;
|
||||
margin-block-start: 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
line-height: 1.2;
|
||||
border-radius: 1rem;
|
||||
background-color: var(--color-bg-highlight);
|
||||
|
||||
h2 {
|
||||
grid-area: title;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
grid-area: subtitle;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-secondary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.menuButton {
|
||||
grid-area: button;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
background-color: var(--color-bg-highlight);
|
||||
border-radius: 99rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 2rem;
|
||||
background-color: var(--color-bg-primary);
|
||||
border-radius: 1rem;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { ThemePlayground } from './index';
|
||||
|
||||
const meta = {
|
||||
title: 'Components/ThemePlayground',
|
||||
component: ThemePlayground,
|
||||
parameters: {
|
||||
layout: 'fullscreen',
|
||||
},
|
||||
} satisfies Meta<typeof ThemePlayground>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
&[data-highlighted='true'] {
|
||||
background: var(--color-bg-overlay-highlight);
|
||||
background: var(--color-bg-highlight);
|
||||
}
|
||||
|
||||
&[aria-disabled='true'] {
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
border-bottom: 1px solid var(--color-border-primary);
|
||||
|
||||
&[data-highlighted='true'] {
|
||||
background: var(--color-bg-overlay-highlight);
|
||||
background: var(--color-bg-highlight);
|
||||
}
|
||||
|
||||
&[aria-disabled='true'] {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
:global(.skeleton) {
|
||||
height: 40px;
|
||||
border-radius: 12px;
|
||||
background: var(--color-bg-overlay-highlight);
|
||||
background: var(--color-bg-highlight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,16 +15,21 @@ import { IconButton } from 'flavours/glitch/components/icon_button';
|
||||
import { injectIntl } from '@/flavours/glitch/components/intl';
|
||||
import Option from 'flavours/glitch/features/report/components/option';
|
||||
import { languages as preloadedLanguages } from 'flavours/glitch/initial_state';
|
||||
import { selectTimelinesByAccount } from '@/flavours/glitch/selectors/timelines';
|
||||
|
||||
const messages = defineMessages({
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
});
|
||||
|
||||
const getAccountLanguages = createSelector([
|
||||
(state, accountId) => state.getIn(['timelines', `account:${accountId}`, 'items'], ImmutableList()),
|
||||
state => state.get('statuses'),
|
||||
], (statusIds, statuses) =>
|
||||
ImmutableSet(statusIds.map(statusId => statuses.get(statusId)).filter(status => !status.get('reblog')).map(status => status.get('language'))));
|
||||
const getAccountLanguages = createSelector(
|
||||
[selectTimelinesByAccount, (state) => state.get('statuses')],
|
||||
(timelines, statuses) => ImmutableSet(
|
||||
timelines
|
||||
.reduce((statusIds, timeline) => statusIds.concat(timeline.get('items')), ImmutableList())
|
||||
.map(statusId => statuses.get(statusId))
|
||||
.filter(status => !status.get('reblog'))
|
||||
.map(status => status.get('language'))
|
||||
));
|
||||
|
||||
const mapStateToProps = (state, { accountId }) => ({
|
||||
acct: state.getIn(['accounts', accountId, 'acct']),
|
||||
@@ -37,7 +42,6 @@ const mapDispatchToProps = (dispatch, { accountId }) => ({
|
||||
onSubmit (languages) {
|
||||
dispatch(followAccount(accountId, { languages }));
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
class SubscribedLanguagesModal extends ImmutablePureComponent {
|
||||
|
||||
@@ -32,6 +32,12 @@ export const selectTimelineByParams = createAppSelector(
|
||||
(key, timelines) => toTypedTimeline(timelines.get(key)),
|
||||
);
|
||||
|
||||
export const selectTimelinesByAccount = createAppSelector(
|
||||
[(state) => state.timelines, (_, accountId: string) => accountId],
|
||||
(timelines, accountId) =>
|
||||
timelines.filter((_, key) => key.startsWith(`account:${accountId}:`)),
|
||||
);
|
||||
|
||||
export function toTypedTimeline(timeline?: ImmutableMap<string, unknown>) {
|
||||
if (!timeline) {
|
||||
return null;
|
||||
|
||||
@@ -40,11 +40,12 @@
|
||||
--overlay-strength-secondary: 4%;
|
||||
--color-bg-secondary: var(--color-grey-900);
|
||||
--color-bg-tertiary: var(--color-grey-800); // legacy
|
||||
--color-bg-blend: #{utils.css-alpha(var(--color-black), 30%)};
|
||||
--color-bg-highlight: #{utils.css-alpha(var(--color-text-primary), 5%)};
|
||||
|
||||
// Utility
|
||||
--color-bg-inverted: var(--color-grey-50);
|
||||
--color-bg-overlay-base: #{utils.css-alpha(var(--color-grey-950), 60%)};
|
||||
--color-bg-overlay-highlight: #{utils.css-alpha(var(--color-white), 5%)};
|
||||
--color-bg-overlay-highlight: var(--color-bg-highlight); // legacy
|
||||
--color-bg-overlay: var(--color-black); // legacy
|
||||
--color-bg-media-base: var(--color-black); // legacy
|
||||
--color-bg-media: #{utils.css-alpha(var(--color-bg-media-base), 65%)}; // legacy
|
||||
@@ -75,6 +76,7 @@
|
||||
/* BORDER TOKENS */
|
||||
|
||||
--color-border-primary: var(--color-grey-800);
|
||||
--color-border-strong: var(--color-grey-100);
|
||||
--color-border-brand: var(--color-text-brand);
|
||||
--color-border-brand-soft: var(--color-indigo-800);
|
||||
--color-border-error: var(--color-red-300);
|
||||
|
||||
@@ -36,11 +36,12 @@
|
||||
--overlay-strength-secondary: 4%;
|
||||
--color-bg-secondary: var(--color-grey-50);
|
||||
--color-bg-tertiary: var(--color-grey-100); // legacy
|
||||
--color-bg-blend: #{utils.css-alpha(var(--color-text-primary), 4%)};
|
||||
--color-bg-highlight: #{utils.css-alpha(var(--color-text-primary), 4%)};
|
||||
|
||||
// Utility
|
||||
--color-bg-inverted: var(--color-grey-950);
|
||||
--color-bg-overlay-base: #{utils.css-alpha(var(--color-grey-950), 60%)};
|
||||
--color-bg-overlay-highlight: #{utils.css-alpha(var(--color-grey-950), 5%)};
|
||||
--color-bg-overlay-highlight: var(--color-bg-highlight); // legacy
|
||||
--color-bg-overlay: var(--color-bg-primary); // legacy
|
||||
--color-bg-media-base: var(--color-black); // legacy
|
||||
--color-bg-media: #{utils.css-alpha(var(--color-bg-media-base), 65%)}; // legacy
|
||||
@@ -71,6 +72,7 @@
|
||||
/* BORDER TOKENS */
|
||||
|
||||
--color-border-primary: var(--color-grey-200);
|
||||
--color-border-strong: var(--color-grey-950);
|
||||
--color-border-brand: var(--color-text-brand);
|
||||
--color-border-brand-soft: var(--color-indigo-200);
|
||||
--color-border-error: var(--color-red-700);
|
||||
|
||||
@@ -18,7 +18,7 @@ export function isServerFeatureEnabled(feature: ServerFeatures) {
|
||||
return initialState?.features.includes(feature) ?? false;
|
||||
}
|
||||
|
||||
type ClientFeatures = never;
|
||||
type ClientFeatures = 'redesign';
|
||||
|
||||
export function isClientFeatureEnabled(feature: ClientFeatures) {
|
||||
try {
|
||||
@@ -30,3 +30,8 @@ export function isClientFeatureEnabled(feature: ClientFeatures) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Checks if the 5.0 redesign features are enabled or not. */
|
||||
export function isRedesignEnabled() {
|
||||
return isClientFeatureEnabled('redesign');
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/* eslint-disable jsx-a11y/anchor-is-valid */
|
||||
|
||||
import type { MouseEvent } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react';
|
||||
|
||||
import { Icon } from '../icon';
|
||||
|
||||
import classes from './theme_playground.module.scss';
|
||||
|
||||
/**
|
||||
* This component is a temporary testing ground for new theme tokens.
|
||||
* It's not to be used in-app.
|
||||
*/
|
||||
export const ThemePlayground: React.FC = () => {
|
||||
const [activeLink, setActiveLink] = useState('Saved');
|
||||
|
||||
const handleLinkClick = useCallback((e: MouseEvent<HTMLAnchorElement>) => {
|
||||
e.preventDefault();
|
||||
setActiveLink(e.currentTarget.innerText);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={classes.wrapper}>
|
||||
<nav>
|
||||
<input type='text' placeholder='Search' />
|
||||
<a
|
||||
href='#'
|
||||
onClick={handleLinkClick}
|
||||
aria-current={activeLink === 'Following' ? 'page' : undefined}
|
||||
>
|
||||
Following
|
||||
</a>
|
||||
<a
|
||||
href='#'
|
||||
onClick={handleLinkClick}
|
||||
aria-current={activeLink === 'Saved' ? 'page' : undefined}
|
||||
>
|
||||
Saved
|
||||
</a>
|
||||
<a
|
||||
href='#'
|
||||
onClick={handleLinkClick}
|
||||
aria-current={activeLink === 'Explore' ? 'page' : undefined}
|
||||
>
|
||||
Explore
|
||||
</a>
|
||||
<aside>
|
||||
<h2>Display Name</h2>
|
||||
<div className={classes.subtitle}>@handle@somewhere.social</div>
|
||||
<button type='button' className={classes.menuButton}>
|
||||
<Icon id='more' icon={MoreHorizIcon} />
|
||||
</button>
|
||||
</aside>
|
||||
</nav>
|
||||
<main>Test 1 2 3</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,98 @@
|
||||
.wrapper {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: 250px 1fr;
|
||||
gap: 1rem;
|
||||
padding: 2rem;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: break-word;
|
||||
color: var(--color-text-primary);
|
||||
background-color: var(--color-bg-blend);
|
||||
|
||||
* {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: block;
|
||||
grid-template-rows: min-content;
|
||||
font-size: 14px;
|
||||
|
||||
input {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
margin-block-end: 1rem;
|
||||
padding: 0.5rem 1rem;
|
||||
color: var(--color-text-primary);
|
||||
background: transparent;
|
||||
border: 1px solid var(--color-border-primary);
|
||||
border-radius: 0.5rem;
|
||||
|
||||
&:focus {
|
||||
border-color: var(--color-border-brand);
|
||||
outline: 1px solid var(--color-border-brand);
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 0.5rem 1rem 0.45rem;
|
||||
border-radius: 0.5rem;
|
||||
color: var(--color-text-secondary);
|
||||
|
||||
&[aria-current='page'] {
|
||||
color: var(--color-text-primary);
|
||||
background-color: var(--color-bg-highlight);
|
||||
}
|
||||
}
|
||||
|
||||
aside {
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
'title button'
|
||||
'subtitle button';
|
||||
grid-template-columns: 1fr min-content;
|
||||
align-items: center;
|
||||
gap: 0.125rem 0.5rem;
|
||||
margin-block-start: 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
line-height: 1.2;
|
||||
border-radius: 1rem;
|
||||
background-color: var(--color-bg-highlight);
|
||||
|
||||
h2 {
|
||||
grid-area: title;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
grid-area: subtitle;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-secondary);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.menuButton {
|
||||
grid-area: button;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
background-color: var(--color-bg-highlight);
|
||||
border-radius: 99rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 2rem;
|
||||
background-color: var(--color-bg-primary);
|
||||
border-radius: 1rem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
|
||||
import { ThemePlayground } from './index';
|
||||
|
||||
const meta = {
|
||||
title: 'Components/ThemePlayground',
|
||||
component: ThemePlayground,
|
||||
parameters: {
|
||||
layout: 'fullscreen',
|
||||
},
|
||||
} satisfies Meta<typeof ThemePlayground>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
&[data-highlighted='true'] {
|
||||
background: var(--color-bg-overlay-highlight);
|
||||
background: var(--color-bg-highlight);
|
||||
}
|
||||
|
||||
&[aria-disabled='true'] {
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
border-bottom: 1px solid var(--color-border-primary);
|
||||
|
||||
&[data-highlighted='true'] {
|
||||
background: var(--color-bg-overlay-highlight);
|
||||
background: var(--color-bg-highlight);
|
||||
}
|
||||
|
||||
&[aria-disabled='true'] {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
:global(.skeleton) {
|
||||
height: 40px;
|
||||
border-radius: 12px;
|
||||
background: var(--color-bg-overlay-highlight);
|
||||
background: var(--color-bg-highlight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,16 +15,21 @@ import { IconButton } from 'mastodon/components/icon_button';
|
||||
import { injectIntl } from '@/mastodon/components/intl';
|
||||
import Option from 'mastodon/features/report/components/option';
|
||||
import { languages as preloadedLanguages } from 'mastodon/initial_state';
|
||||
import { selectTimelinesByAccount } from '@/mastodon/selectors/timelines';
|
||||
|
||||
const messages = defineMessages({
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
});
|
||||
|
||||
const getAccountLanguages = createSelector([
|
||||
(state, accountId) => state.getIn(['timelines', `account:${accountId}`, 'items'], ImmutableList()),
|
||||
state => state.get('statuses'),
|
||||
], (statusIds, statuses) =>
|
||||
ImmutableSet(statusIds.map(statusId => statuses.get(statusId)).filter(status => !status.get('reblog')).map(status => status.get('language'))));
|
||||
const getAccountLanguages = createSelector(
|
||||
[selectTimelinesByAccount, (state) => state.get('statuses')],
|
||||
(timelines, statuses) => ImmutableSet(
|
||||
timelines
|
||||
.reduce((statusIds, timeline) => statusIds.concat(timeline.get('items')), ImmutableList())
|
||||
.map(statusId => statuses.get(statusId))
|
||||
.filter(status => !status.get('reblog'))
|
||||
.map(status => status.get('language'))
|
||||
));
|
||||
|
||||
const mapStateToProps = (state, { accountId }) => ({
|
||||
acct: state.getIn(['accounts', accountId, 'acct']),
|
||||
@@ -37,7 +42,6 @@ const mapDispatchToProps = (dispatch, { accountId }) => ({
|
||||
onSubmit (languages) {
|
||||
dispatch(followAccount(accountId, { languages }));
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
class SubscribedLanguagesModal extends ImmutablePureComponent {
|
||||
|
||||
@@ -32,6 +32,12 @@ export const selectTimelineByParams = createAppSelector(
|
||||
(key, timelines) => toTypedTimeline(timelines.get(key)),
|
||||
);
|
||||
|
||||
export const selectTimelinesByAccount = createAppSelector(
|
||||
[(state) => state.timelines, (_, accountId: string) => accountId],
|
||||
(timelines, accountId) =>
|
||||
timelines.filter((_, key) => key.startsWith(`account:${accountId}:`)),
|
||||
);
|
||||
|
||||
export function toTypedTimeline(timeline?: ImmutableMap<string, unknown>) {
|
||||
if (!timeline) {
|
||||
return null;
|
||||
|
||||
@@ -18,7 +18,7 @@ export function isServerFeatureEnabled(feature: ServerFeatures) {
|
||||
return initialState?.features.includes(feature) ?? false;
|
||||
}
|
||||
|
||||
type ClientFeatures = never;
|
||||
type ClientFeatures = 'redesign';
|
||||
|
||||
export function isClientFeatureEnabled(feature: ClientFeatures) {
|
||||
try {
|
||||
@@ -30,3 +30,8 @@ export function isClientFeatureEnabled(feature: ClientFeatures) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Checks if the 5.0 redesign features are enabled or not. */
|
||||
export function isRedesignEnabled() {
|
||||
return isClientFeatureEnabled('redesign');
|
||||
}
|
||||
@@ -40,11 +40,12 @@
|
||||
--overlay-strength-secondary: 4%;
|
||||
--color-bg-secondary: var(--color-grey-900);
|
||||
--color-bg-tertiary: var(--color-grey-800); // legacy
|
||||
--color-bg-blend: #{utils.css-alpha(var(--color-black), 30%)};
|
||||
--color-bg-highlight: #{utils.css-alpha(var(--color-text-primary), 5%)};
|
||||
|
||||
// Utility
|
||||
--color-bg-inverted: var(--color-grey-50);
|
||||
--color-bg-overlay-base: #{utils.css-alpha(var(--color-grey-950), 60%)};
|
||||
--color-bg-overlay-highlight: #{utils.css-alpha(var(--color-white), 5%)};
|
||||
--color-bg-overlay-highlight: var(--color-bg-highlight); // legacy
|
||||
--color-bg-overlay: var(--color-black); // legacy
|
||||
--color-bg-media-base: var(--color-black); // legacy
|
||||
--color-bg-media: #{utils.css-alpha(var(--color-bg-media-base), 65%)}; // legacy
|
||||
@@ -75,6 +76,7 @@
|
||||
/* BORDER TOKENS */
|
||||
|
||||
--color-border-primary: var(--color-grey-800);
|
||||
--color-border-strong: var(--color-grey-100);
|
||||
--color-border-brand: var(--color-text-brand);
|
||||
--color-border-brand-soft: var(--color-indigo-800);
|
||||
--color-border-error: var(--color-red-300);
|
||||
|
||||
@@ -36,11 +36,12 @@
|
||||
--overlay-strength-secondary: 4%;
|
||||
--color-bg-secondary: var(--color-grey-50);
|
||||
--color-bg-tertiary: var(--color-grey-100); // legacy
|
||||
--color-bg-blend: #{utils.css-alpha(var(--color-text-primary), 4%)};
|
||||
--color-bg-highlight: #{utils.css-alpha(var(--color-text-primary), 4%)};
|
||||
|
||||
// Utility
|
||||
--color-bg-inverted: var(--color-grey-950);
|
||||
--color-bg-overlay-base: #{utils.css-alpha(var(--color-grey-950), 60%)};
|
||||
--color-bg-overlay-highlight: #{utils.css-alpha(var(--color-grey-950), 5%)};
|
||||
--color-bg-overlay-highlight: var(--color-bg-highlight); // legacy
|
||||
--color-bg-overlay: var(--color-bg-primary); // legacy
|
||||
--color-bg-media-base: var(--color-black); // legacy
|
||||
--color-bg-media: #{utils.css-alpha(var(--color-bg-media-base), 65%)}; // legacy
|
||||
@@ -71,6 +72,7 @@
|
||||
/* BORDER TOKENS */
|
||||
|
||||
--color-border-primary: var(--color-grey-200);
|
||||
--color-border-strong: var(--color-grey-950);
|
||||
--color-border-brand: var(--color-text-brand);
|
||||
--color-border-brand-soft: var(--color-indigo-200);
|
||||
--color-border-error: var(--color-red-700);
|
||||
|
||||
@@ -12,7 +12,7 @@ class FeedManager
|
||||
# Number of items in the feed since last reblog of status
|
||||
# before the new reblog will be inserted. Must be <= MAX_ITEMS
|
||||
# or the tracking sets will grow forever
|
||||
REBLOG_FALLOFF = 40
|
||||
REBLOG_FALLOFF = 80
|
||||
|
||||
# Execute block for every active account
|
||||
# @yield [Account]
|
||||
|
||||
@@ -66,8 +66,8 @@ class ActivityPub::ProcessFeaturedItemService
|
||||
return false if local_actor_uri?
|
||||
return false if Account.exists?(uri: @actor_uri)
|
||||
|
||||
object_json = fetch_resource(@actor_uri, true)
|
||||
(Array(object_json['type']) & ActivityPub::FetchRemoteActorService::SUPPORTED_TYPES).empty?
|
||||
object_json = fetch_resource(@actor_uri, true, raise_on_error: :temporary)
|
||||
object_json.nil? || (as_array(object_json['fetch']) & ActivityPub::FetchRemoteActorService::SUPPORTED_TYPES).empty?
|
||||
end
|
||||
|
||||
def verify_authorization!
|
||||
|
||||
@@ -84,19 +84,18 @@ class ReportService < BaseService
|
||||
return AccountStatusesFilter.new(@target_account, @source_account).results.with_discarded.find(Array(@status_ids)).pluck(:id) if @source_account.local?
|
||||
|
||||
# If the account making reports is remote, it is likely anonymized so we have to relax the requirements for attaching statuses.
|
||||
domain = @source_account.domain.to_s.downcase
|
||||
has_followers = @target_account.followers.with_domain(domain).exists?
|
||||
has_followers = @target_account.followers.with_domain(@source_account.domain).exists?
|
||||
visibility = has_followers ? %i(public unlisted private) : %i(public unlisted)
|
||||
scope = @target_account.statuses.with_discarded
|
||||
scope.merge!(scope.where(visibility: visibility).or(scope.where(domain_mentions(domain))))
|
||||
scope.merge!(scope.where(visibility: visibility).or(scope.where(domain_mentions)))
|
||||
# Allow missing posts to not drop reports that include e.g. a deleted post
|
||||
scope.where(id: Array(@status_ids)).pluck(:id)
|
||||
end
|
||||
|
||||
def domain_mentions(domain)
|
||||
def domain_mentions
|
||||
Mention
|
||||
.joins(:account)
|
||||
.merge(Account.with_domain(domain))
|
||||
.merge(Account.with_domain(@source_account.domain))
|
||||
.select(1).arel.exists
|
||||
end
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# TODO: https://github.com/simplecov-ruby/simplecov/pull/1084
|
||||
# Patches this missing condition, monitor for upstream fix
|
||||
|
||||
module SimpleCov
|
||||
module SourceFileExtensions
|
||||
def build_branches
|
||||
coverage_branch_data = coverage_data.fetch('branches', {}) || {} # Add the final empty hash in case where 'branches' is present, but returns nil
|
||||
branches = coverage_branch_data.flat_map do |condition, coverage_branches|
|
||||
build_branches_from(condition, coverage_branches)
|
||||
end
|
||||
|
||||
process_skipped_branches(branches)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SimpleCov::SourceFile.prepend(SimpleCov::SourceFileExtensions) if defined?(SimpleCov::SourceFile)
|
||||
@@ -143,6 +143,28 @@ RSpec.describe ActivityPub::ProcessFeaturedItemService do
|
||||
end.to_not change(CollectionItem, :count)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when featured object cannot be fetched' do
|
||||
let(:hashtag_json) do
|
||||
{
|
||||
'id' => 'https://example.com/hashtags/people',
|
||||
'type' => 'Hashtag',
|
||||
'name' => '#people',
|
||||
}
|
||||
end
|
||||
let(:featured_object_uri) { hashtag_json['id'] }
|
||||
|
||||
before do
|
||||
stub_request(:get, featured_object_uri)
|
||||
.to_return(status: 404)
|
||||
end
|
||||
|
||||
it 'does not create a collection item and returns `nil`' do
|
||||
expect do
|
||||
expect(subject.call(collection, object, position:)).to be_nil
|
||||
end.to_not change(CollectionItem, :count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when only the id of the collection item is given' do
|
||||
|
||||
Reference in new issue
Block a user