Fixes collection notification urls (#39127)

This commit is contained in:
Echo authored and GitHub committed 2026-05-21 13:17:35 +00:00
1 parent dc3ffac4a2
commit 6735902c1a
5 files changed
+32 -19

No files matched your search

@@ -24,11 +24,13 @@ import classes from './share_modal.module.scss';
const messages = defineMessages({
shareTextOwn: {
id: 'collection.share_template_own',
defaultMessage: 'Check out my new collection: {link}',
defaultMessage: 'Check out my new collection:',
description: 'Collection links are appended after a new line',
},
shareTextOther: {
id: 'collection.share_template_other',
defaultMessage: 'Check out this cool collection: {link}',
defaultMessage: 'Check out this cool collection:',
description: 'Collection links are appended after a new line',
},
});
@@ -51,13 +53,10 @@ export const CollectionShareModal: React.FC<{
}, [collectionLink]);
const handleShareViaPost = useCallback(() => {
const shareMessage = isOwnCollection
? intl.formatMessage(messages.shareTextOwn, {
link: collectionLink,
})
: intl.formatMessage(messages.shareTextOther, {
link: collectionLink,
});
let shareMessage = isOwnCollection
? intl.formatMessage(messages.shareTextOwn)
: intl.formatMessage(messages.shareTextOther);
shareMessage += `\n\n${collectionLink}`;
onClose();
dispatch(changeCompose(shareMessage));
@@ -1,6 +1,6 @@
import { useCallback, useMemo } from 'react';
import type { List } from 'immutable';
import type { List, Map } from 'immutable';
import { EmojiHTML } from '@/mastodon/components/emoji/html';
import { useElementHandledLink } from '@/mastodon/components/status/handled_link';
@@ -23,8 +23,19 @@ export const EmbeddedStatusContent: React.FC<{
},
[mentions],
);
const hrefToCollection = useCallback(
(href: string) => {
const collections = status.get('tagged_collections') as List<
Map<'url' | 'id', string>
>;
const collection = collections.find((item) => item.get('url') === href);
return collection?.get('id');
},
[status],
);
const htmlHandlers = useElementHandledLink({
hashtagAccountId: status.get('account') as string | undefined,
hrefToCollectionId: hrefToCollection,
hrefToMention,
});