mirror of
https://github.com/flarum/core.git
synced 2025-08-03 23:17:43 +02:00
feat: make it easier to add content after the first post (#4186)
This commit is contained in:
@@ -78,11 +78,22 @@ export default class PostStream extends Component {
|
||||
content = <LoadingPost />;
|
||||
}
|
||||
|
||||
return (
|
||||
const postStreamElement = (
|
||||
<div className="PostStream-item" {...attrs}>
|
||||
{content}
|
||||
</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]) {
|
||||
@@ -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>}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user