Merge commit 'db13dddcf90343574dee320fff7e8bb9bf3707e4' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2026-04-07 20:08:57 +02:00
commit 69b70d48c6
128 files changed
+866 -333

No files matched your search

@@ -65,7 +65,7 @@ export const AccountEditTagSearch: FC = () => {
value={query}
onChange={handleSearchChange}
placeholder={inputLabel}
items={suggestedTags as TagSearchResult[]}
items={suggestedTags}
isLoading={isLoading}
renderItem={renderItem}
onSelectItem={handleSelect}
@@ -13,11 +13,15 @@ import { Button } from '@/mastodon/components/button';
import { DismissibleCallout } from '@/mastodon/components/callout/dismissible';
import { CustomEmojiProvider } from '@/mastodon/components/emoji/context';
import { EmojiHTML } from '@/mastodon/components/emoji/html';
import { ToggleField } from '@/mastodon/components/form_fields';
import { useElementHandledLink } from '@/mastodon/components/status/handled_link';
import { useAccount } from '@/mastodon/hooks/useAccount';
import { useCurrentAccountId } from '@/mastodon/hooks/useAccountId';
import { autoPlayGif } from '@/mastodon/initial_state';
import { fetchProfile } from '@/mastodon/reducers/slices/profile_edit';
import {
fetchProfile,
patchProfile,
} from '@/mastodon/reducers/slices/profile_edit';
import { useAppDispatch, useAppSelector } from '@/mastodon/store';
import { AccountEditColumn, AccountEditEmptyColumn } from './components/column';
@@ -108,6 +112,10 @@ export const messages = defineMessages({
id: 'account_edit.profile_tab.subtitle',
defaultMessage: 'Customize the tabs on your profile and what they display.',
},
advancedSettingsTitle: {
id: 'account_edit.advanced_settings.title',
defaultMessage: 'Advanced settings',
},
});
export const AccountEdit: FC = () => {
@@ -117,7 +125,7 @@ export const AccountEdit: FC = () => {
const dispatch = useAppDispatch();
const { profile } = useAppSelector((state) => state.profileEdit);
const { profile, isPending } = useAppSelector((state) => state.profileEdit);
useEffect(() => {
void dispatch(fetchProfile());
}, [dispatch]);
@@ -162,6 +170,10 @@ export const AccountEdit: FC = () => {
history.push('/profile/featured_tags');
}, [history]);
const handleBotToggle = useCallback(() => {
void dispatch(patchProfile({ bot: !profile?.bot }));
}, [dispatch, profile?.bot]);
// Normally we would use the account emoji, but we want all custom emojis to be available to render after editing.
const emojis = useAppSelector((state) => state.custom_emojis);
const htmlHandlers = useElementHandledLink({
@@ -327,6 +339,26 @@ export const AccountEdit: FC = () => {
</Button>
}
/>
<AccountEditSection title={messages.advancedSettingsTitle}>
<ToggleField
checked={profile.bot}
onChange={handleBotToggle}
disabled={isPending}
label={
<FormattedMessage
id='account_edit.advanced_settings.bot_label'
defaultMessage='Automated account'
/>
}
hint={
<FormattedMessage
id='account_edit.advanced_settings.bot_hint'
defaultMessage='Signal to others that the account mainly performs automated actions and might not be monitored'
/>
}
/>
</AccountEditSection>
</CustomEmojiProvider>
</AccountEditColumn>
);
@@ -8,13 +8,16 @@ import classNames from 'classnames';
import Overlay from 'react-overlays/esm/Overlay';
import FollowerIcon from '@/images/icons/icon_follower.svg?react';
import { showAlert } from '@/mastodon/actions/alerts';
import { Badge } from '@/mastodon/components/badge';
import { Button } from '@/mastodon/components/button';
import { DisplayName } from '@/mastodon/components/display_name';
import { Icon } from '@/mastodon/components/icon';
import { useAccount } from '@/mastodon/hooks/useAccount';
import { useRelationship } from '@/mastodon/hooks/useRelationship';
import { useAppSelector } from '@/mastodon/store';
import { useAppDispatch, useAppSelector } from '@/mastodon/store';
import AtIcon from '@/material-icons/400-24px/alternate_email.svg?react';
import ContentCopyIcon from '@/material-icons/400-24px/content_copy.svg?react';
import HelpIcon from '@/material-icons/400-24px/help.svg?react';
import DomainIcon from '@/material-icons/400-24px/language.svg?react';
@@ -30,6 +33,10 @@ const messages = defineMessages({
id: 'account.name_info',
defaultMessage: 'What does this mean?',
},
copied: {
id: 'copy_icon_button.copied',
defaultMessage: 'Copied to clipboard',
},
});
export const AccountName: FC<{ accountId: string }> = ({ accountId }) => {
@@ -64,14 +71,12 @@ export const AccountName: FC<{ accountId: string }> = ({ accountId }) => {
/>
)}
</div>
<p className={classes.username}>
@{username}@{domain}
<AccountNameHelp
username={username}
domain={domain}
isSelf={account.id === me}
/>
</p>
<AccountNameHelp
username={username}
domain={domain}
isSelf={account.id === me}
/>
</div>
);
};
@@ -90,6 +95,19 @@ const AccountNameHelp: FC<{
setOpen((prev) => !prev);
}, []);
const handle = `@${username}@${domain}`;
const dispatch = useAppDispatch();
const [copied, setCopied] = useState(false);
const handleCopy = useCallback(() => {
void navigator.clipboard.writeText(handle);
setCopied(true);
dispatch(showAlert({ message: messages.copied }));
setTimeout(() => {
setCopied(false);
}, 700);
}, [handle, dispatch]);
return (
<>
<button
@@ -100,6 +118,8 @@ const AccountNameHelp: FC<{
aria-expanded={open}
aria-controls={accessibilityId}
>
{handle}
<Icon
id='help'
icon={HelpIcon}
@@ -169,6 +189,22 @@ const AccountNameHelp: FC<{
defaultMessage='Just like you can send emails to people using different email clients, you can interact with people on other Mastodon servers – and with anyone on other social apps powered by the same set of rules as Mastodon uses (the ActivityPub protocol).'
tagName='p'
/>
<Button onClick={handleCopy} className={classes.handleCopy}>
<Icon id='copy' icon={ContentCopyIcon} />
{!copied && (
<FormattedMessage
id='account.name.copy'
defaultMessage='Copy handle'
/>
)}
{copied && (
<FormattedMessage
id='copypaste.copied'
defaultMessage='Copied'
/>
)}
</Button>
</div>
)}
</Overlay>
@@ -12,13 +12,10 @@ import type {
ValidationErrorResponse,
ValidationError,
} from 'mastodon/api_types/errors';
import { A11yLiveRegion } from 'mastodon/components/a11y_live_region';
import { Button } from 'mastodon/components/button';
import { CalloutInline } from 'mastodon/components/callout_inline';
import { DisplayName } from 'mastodon/components/display_name';
import type { FieldStatus } from 'mastodon/components/form_fields';
import formFieldClasses from 'mastodon/components/form_fields/form_field_wrapper.module.scss';
import { TextInput } from 'mastodon/components/form_fields/text_input_field';
import { TextInputField } from 'mastodon/components/form_fields/text_input_field';
import { useAppSelector } from 'mastodon/store';
import classes from './redesign.module.scss';
@@ -34,7 +31,7 @@ const messages = defineMessages({
},
email: {
id: 'email_subscriptions.email',
defaultMessage: 'Email address',
defaultMessage: 'Email',
},
});
@@ -159,33 +156,19 @@ export const AccountSubscriptionForm: React.FC<{ accountId: string }> = ({
}}
/>
</h2>
<FormattedMessage
id='email_subscriptions.form.lead'
defaultMessage='Get posts in your inbox without creating a Mastodon account.'
/>
</div>
<div className={classes.bannerInputButton}>
<div className={formFieldClasses.wrapper}>
<TextInput
id={`${accessibilityId}-input`}
type='email'
value={email}
onChange={handleChange}
placeholder='name@email.com'
aria-label={intl.formatMessage(messages.email)}
aria-describedby={errors.email ? `${accessibilityId}-status` : ''}
/>
<A11yLiveRegion
className={formFieldClasses.status}
id={`${accessibilityId}-status`}
>
{errors.email && (
<CalloutInline {...fieldStatusFromErrors(intl, errors.email)} />
)}
</A11yLiveRegion>
</div>
<TextInputField
id={`${accessibilityId}-input`}
type='email'
value={email}
onChange={handleChange}
label={intl.formatMessage(messages.email)}
status={
errors.email ? fieldStatusFromErrors(intl, errors.email) : undefined
}
/>
<Button type='submit' loading={submitting}>
<FormattedMessage
@@ -197,8 +180,8 @@ export const AccountSubscriptionForm: React.FC<{ accountId: string }> = ({
<div className={classes.bannerDisclaimer}>
<FormattedMessage
id='email_subscriptions.form.disclaimer'
defaultMessage='You can unsubscribe at any time. For more information, refer to the <a>Privacy Policy</a>.'
id='email_subscriptions.form.bottom'
defaultMessage='Get posts in your inbox without creating a Mastodon account. Unsubscribe at any time. For more information, refer to the <a>Privacy Policy</a>.'
values={{ a: (str) => <Link to='/privacy-policy'>{str}</Link> }}
/>
</div>
@@ -43,30 +43,22 @@
color: var(--color-text-secondary);
}
.username {
display: flex;
font-size: 13px;
color: var(--color-text-secondary);
align-items: center;
user-select: all;
margin-top: 4px;
}
.handleHelpButton {
appearance: none;
border: none;
background: none;
display: flex;
gap: 2px;
padding: 0;
color: inherit;
font-size: 1em;
margin-left: 2px;
width: 16px;
height: 16px;
margin-top: 4px;
align-items: center;
appearance: none;
background: none;
border: none;
color: var(--color-text-secondary);
font-size: 13px;
transition: color 0.2s ease-in-out;
> svg {
width: 100%;
height: 100%;
width: 16px;
height: 16px;
}
&:hover,
@@ -84,6 +76,10 @@
max-width: 400px;
box-sizing: border-box;
[data-color-scheme='dark'] & {
border: 1px solid var(--color-border-primary);
}
> h3 {
font-size: 17px;
font-weight: 600;
@@ -101,15 +97,15 @@
&:first-child {
margin-bottom: 12px;
}
}
svg {
background: var(--color-bg-brand-softest);
width: 28px;
height: 28px;
padding: 5px;
border-radius: 9999px;
box-sizing: border-box;
> svg {
background: var(--color-bg-brand-softest);
width: 28px;
height: 28px;
padding: 5px;
border-radius: 9999px;
box-sizing: border-box;
}
}
strong {
@@ -132,6 +128,26 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
}
}
.handleCopy {
border: 1px solid var(--color-border-primary);
border-radius: 8px;
box-sizing: border-box;
padding: 4px 8px;
background-color: var(--color-bg-primary);
color: var(--color-text-primary);
font-size: 13px;
transition:
color 0.2s ease-in-out,
background-color 0.2s ease-in-out;
margin-top: 12px;
&:active,
&:focus,
&:hover {
background-color: var(--color-bg-brand-softest);
}
}
.buttonsMobile {
position: sticky;
bottom: var(--mobile-bottom-nav-height);
@@ -251,6 +267,10 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
.fieldVerified {
background-color: var(--color-bg-success-softest);
&.fieldItem {
border-color: var(--color-border-success-soft);
}
dt {
padding-right: 24px;
}
@@ -336,7 +356,7 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
.tabs {
display: flex;
gap: 12px;
gap: 16px;
padding: 0 16px;
@container (width < 500px) {
@@ -350,7 +370,7 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
display: block;
font-size: 15px;
font-weight: 500;
padding: 18px 4px;
padding: 18px 0;
text-decoration: none;
color: var(--color-text-primary);
border-radius: 0;
@@ -401,9 +421,6 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
}
.bannerDisclaimer {
color: var(--color-text-secondary);
font-size: 11px;
a {
color: inherit;
}
@@ -429,6 +446,14 @@ $button-fallback-breakpoint: $button-breakpoint + 55px;
flex-grow: 1;
}
label {
font-weight: 400;
}
:global(.button) {
margin-top: 24px; // To align with input under label
}
input[type='email'] {
padding: 7px 8px; // To align size with button
background: var(--color-bg-primary);
@@ -27,8 +27,8 @@ export const AccountTimelineProvider: FC<{
children: ReactNode;
}> = ({ accountId, children }) => {
const storageOptions = {
type: 'session',
prefix: `filters-${accountId}:`,
type: 'local',
prefix: 'account-filters',
} as const;
const [boosts, setBoosts] = useStorageState<boolean>(
@@ -14,20 +14,27 @@ import {
fetchSuggestedTags,
addFeaturedTags,
} from '@/mastodon/reducers/slices/profile_edit';
import { useAppSelector, useAppDispatch } from '@/mastodon/store';
import {
useAppSelector,
useAppDispatch,
createAppSelector,
} from '@/mastodon/store';
import classes from './styles.module.scss';
const MAX_SUGGESTED_TAGS = 3;
const selectSuggestedTags = createAppSelector(
[(state) => state.profileEdit.tagSuggestions],
(tagSuggestions) => tagSuggestions?.slice(0, MAX_SUGGESTED_TAGS),
);
export const TagSuggestions: FC = () => {
const { dismiss, wasDismissed } = useDismissible(
'profile/featured_tag_suggestions',
);
const suggestedTags = useAppSelector((state) =>
state.profileEdit.tagSuggestions?.slice(0, MAX_SUGGESTED_TAGS),
);
const suggestedTags = useAppSelector(selectSuggestedTags);
const existingTagCount = useAppSelector(
(state) => state.profileEdit.profile?.featuredTags.length,
);
@@ -302,7 +302,8 @@ async function toLoadedLocale(localeString: string) {
}
if (!loadedLocales.has(locale)) {
log('Locale %s not loaded, importing...', locale);
const { importEmojiData } = await import('./loader');
// Ignore the INEFFECTIVE_DYNAMIC_IMPORT Vite warning, since the static import location is inside an inlined web worker.
const { importEmojiData } = await import(/* @vite-ignore */ './loader');
await importEmojiData(locale);
return locale;
}
@@ -1,4 +1,9 @@
import { EMOJI_DB_NAME_SHORTCODES, EMOJI_TYPE_CUSTOM } from './constants';
import {
importCustomEmojiData,
importEmojiData,
importLegacyShortcodes,
} from './loader';
addEventListener('message', handleMessage);
self.postMessage('ready'); // After the worker is ready, notify the main thread
@@ -11,8 +16,6 @@ function handleMessage(event: MessageEvent<{ locale: string }>) {
}
async function loadData(locale: string) {
const { importCustomEmojiData, importEmojiData, importLegacyShortcodes } =
await import('./loader');
let importCount: number | undefined;
if (locale === EMOJI_TYPE_CUSTOM) {
importCount = (await importCustomEmojiData())?.length;