1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 15:37:51 +02:00

feat: make it easier to add content after the first post (#4186)

This commit is contained in:
Davide Iadeluca
2025-02-14 09:27:10 +01:00
committed by GitHub
parent 60feaa0184
commit 9758592daa

View File

@@ -78,11 +78,22 @@ export default class PostStream extends Component {
content = <LoadingPost />; content = <LoadingPost />;
} }
return ( const postStreamElement = (
<div className="PostStream-item" {...attrs}> <div className="PostStream-item" {...attrs}>
{content} {content}
</div> </div>
); );
if (post && post.id() === this.discussion.data.relationships.firstPost?.data.id && this.afterFirstPostItems().toArray().length > 0) {
return m.fragment({ ...attrs }, [
postStreamElement,
<div className="PostStream-item PostStream-afterFirstPost" key="afterFirstPost">
{this.afterFirstPostItems().toArray()}
</div>,
]);
}
return postStreamElement;
}); });
if (!viewingEnd && posts[this.stream.visibleEnd - this.stream.visibleStart - 1]) { if (!viewingEnd && posts[this.stream.visibleEnd - this.stream.visibleStart - 1]) {
@@ -117,6 +128,15 @@ export default class PostStream extends Component {
); );
} }
/**
* @returns {ItemList<import('mithril').Children>}
*/
afterFirstPostItems() {
const items = new ItemList();
return items;
}
/** /**
* @returns {ItemList<import('mithril').Children>} * @returns {ItemList<import('mithril').Children>}
*/ */