From d399244d4de929b94ae192d285df2653f0b4eb29 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 3 Mar 2025 09:24:06 +0100 Subject: [PATCH] Fix moved notice on profiles in web UI (#34052) --- .../components/account_header.tsx | 6 +-- .../{memorial_note.jsx => memorial_note.tsx} | 9 ++-- .../components/moved_note.jsx | 39 -------------- .../components/moved_note.tsx | 53 +++++++++++++++++++ 4 files changed, 61 insertions(+), 46 deletions(-) rename app/javascript/mastodon/features/account_timeline/components/{memorial_note.jsx => memorial_note.tsx} (53%) delete mode 100644 app/javascript/mastodon/features/account_timeline/components/moved_note.jsx create mode 100644 app/javascript/mastodon/features/account_timeline/components/moved_note.tsx diff --git a/app/javascript/mastodon/features/account_timeline/components/account_header.tsx b/app/javascript/mastodon/features/account_timeline/components/account_header.tsx index 9970e27d06..f9c01eba6b 100644 --- a/app/javascript/mastodon/features/account_timeline/components/account_header.tsx +++ b/app/javascript/mastodon/features/account_timeline/components/account_header.tsx @@ -58,8 +58,8 @@ import { import { getAccountHidden } from 'mastodon/selectors/accounts'; import { useAppSelector, useAppDispatch } from 'mastodon/store'; -import MemorialNote from './memorial_note'; -import MovedNote from './moved_note'; +import { MemorialNote } from './memorial_note'; +import { MovedNote } from './moved_note'; const messages = defineMessages({ unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, @@ -833,7 +833,7 @@ export const AccountHeader: React.FC<{
{!hidden && account.memorial && } {!hidden && account.moved && ( - + )}
( +export const MemorialNote: React.FC = () => (
- +
); - -export default MemorialNote; diff --git a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx b/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx deleted file mode 100644 index 2c996ff769..0000000000 --- a/app/javascript/mastodon/features/account_timeline/components/moved_note.jsx +++ /dev/null @@ -1,39 +0,0 @@ -import { FormattedMessage } from 'react-intl'; - -import { Link } from 'react-router-dom'; - -import ImmutablePropTypes from 'react-immutable-proptypes'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -import { AvatarOverlay } from '../../../components/avatar_overlay'; -import { DisplayName } from '../../../components/display_name'; - -export default class MovedNote extends ImmutablePureComponent { - - static propTypes = { - from: ImmutablePropTypes.map.isRequired, - to: ImmutablePropTypes.map.isRequired, - }; - - render () { - const { from, to } = this.props; - - return ( -
-
- }} /> -
- -
- -
- - - - -
-
- ); - } - -} diff --git a/app/javascript/mastodon/features/account_timeline/components/moved_note.tsx b/app/javascript/mastodon/features/account_timeline/components/moved_note.tsx new file mode 100644 index 0000000000..51dbb93c8b --- /dev/null +++ b/app/javascript/mastodon/features/account_timeline/components/moved_note.tsx @@ -0,0 +1,53 @@ +import { FormattedMessage } from 'react-intl'; + +import { Link } from 'react-router-dom'; + +import { AvatarOverlay } from 'mastodon/components/avatar_overlay'; +import { DisplayName } from 'mastodon/components/display_name'; +import { useAppSelector } from 'mastodon/store'; + +export const MovedNote: React.FC<{ + accountId: string; + targetAccountId: string; +}> = ({ accountId, targetAccountId }) => { + const from = useAppSelector((state) => state.accounts.get(accountId)); + const to = useAppSelector((state) => state.accounts.get(targetAccountId)); + + return ( +
+
+ + + + ), + }} + /> +
+ +
+ +
+ +
+ + + + + + +
+
+ ); +};