1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 07:41:22 +02:00

Add reply placeholder to bottom of post stream

This commit is contained in:
Toby Zerner
2015-06-01 10:28:24 +09:30
parent 3f6a3de863
commit 56981c1297
5 changed files with 42 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ import PostLoading from 'flarum/components/post-loading';
import anchorScroll from 'flarum/utils/anchor-scroll';
import mixin from 'flarum/utils/mixin';
import evented from 'flarum/utils/evented';
import ReplyPlaceholder from 'flarum/components/reply-placeholder';
class PostStream extends mixin(Component, evented) {
constructor(props) {
@@ -170,7 +171,15 @@ class PostStream extends mixin(Component, evented) {
}
return m('div.item', attributes, content);
})
}),
// If we're viewing the end of the discussion, the user can reply, and
// is not already doing so, then show a 'write a reply' placeholder.
this.visibleEnd === this.count() &&
(!app.session.user() || this.discussion.canReply()) &&
!app.composingReplyTo(this.discussion)
? m('div.item', ReplyPlaceholder.component({discussion: this.discussion}))
: ''
);
}
@@ -376,7 +385,9 @@ class PostStream extends mixin(Component, evented) {
}
if (top + height < scrollTop + viewportHeight) {
endNumber = $item.data('number');
if ($item.data('number')) {
endNumber = $item.data('number');
}
} else {
return false;
}