Fix preview for local collection links (#38793)
Some checks are pending
Check i18n / check-i18n (push) Waiting to run
Chromatic / Check for relevant changes (push) Waiting to run
Chromatic / Run Chromatic (push) Blocked by required conditions
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
CSS Linting / lint (push) Waiting to run
Haml Linting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / test (3.4) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.4) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.19.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.4, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions

This commit is contained in:
diondiondion
2026-04-23 13:47:31 +02:00
committed by GitHub
parent 478dae0ab3
commit d7b60a2cb6
4 changed files with 24 additions and 4 deletions

View File

@@ -31,6 +31,7 @@ import { getHashtagBarForStatus } from './hashtag_bar';
import StatusActionBar from './status_action_bar';
import StatusContent from './status_content';
import { StatusThreadLabel } from './status_thread_label';
import { CollectionPreviewCard } from '../features/collections/components/collection_preview_card';
const domParser = new DOMParser();
@@ -564,6 +565,13 @@ class Status extends ImmutablePureComponent {
/>
);
}
} else if (status.get('tagged_collections').size) {
const firstLinkedCollection = status.get('tagged_collections').first();
if (firstLinkedCollection) {
media = (
<CollectionPreviewCard collection={firstLinkedCollection.toJS()} />
);
}
}
const {statusContentProps, hashtagBar} = getHashtagBarForStatus(status);

View File

@@ -1,3 +1,5 @@
import classNames from 'classnames';
import type { CollectionLockupProps } from 'mastodon/features/collections/components/collection_lockup';
import { CollectionLockup } from 'mastodon/features/collections/components/collection_lockup';
@@ -13,7 +15,7 @@ export const CollectionPreviewCard: React.FC<CollectionPreviewCardProps> = ({
...otherProps
}) => {
return (
<div className={classes.wrapper}>
<div className={classNames(classes.wrapper, 'collection-preview')}>
<CollectionLockup collection={collection} {...otherProps} />
</div>
);

View File

@@ -282,6 +282,13 @@ export const DetailedStatus: React.FC<{
/>
);
}
} else if (status.get('tagged_collections').size) {
const firstLinkedCollection = status.get('tagged_collections').first();
if (firstLinkedCollection) {
media = (
<CollectionPreviewCard collection={firstLinkedCollection.toJS()} />
);
}
}
if (status.get('application')) {

View File

@@ -1499,8 +1499,9 @@ body > [data-popper-placement] {
.media-gallery,
.video-player,
.audio-player,
.attachment-list {
margin-top: 16px;
.attachment-list,
.collection-preview {
margin-top: 14px;
}
&--in-thread {
@@ -1517,6 +1518,7 @@ body > [data-popper-placement] {
& > .picture-in-picture-placeholder,
& > .more-from-author,
& > .status-card,
& > .collection-preview,
& > .hashtag-bar,
& > .content-warning,
& > .filter-warning,
@@ -1787,7 +1789,8 @@ body > [data-popper-placement] {
.media-gallery,
.video-player,
.audio-player {
.audio-player,
.collection-preview {
margin-top: 16px;
}