mirror of
https://github.com/discourse/discourse.git
synced 2025-02-19 18:11:18 +00:00
FIX: prevents rendering empty timeline-controls (#9304)
The streamlength/height code when true would return just after we had inserted the timeline-controls, resulting, on topic-progress event to display an empty timeline-controls when clicked. I think this code in unecessary and we should only rely on the code in `hideProgress` which will currenly hide the progress is the stream has only one post displayed on desktop (always shown on mobile).
This commit is contained in:
parent
aeaea3c154
commit
a3345057f2
@ -34,11 +34,8 @@ export default Component.extend({
|
|||||||
"postStream.filteredPostsCount"
|
"postStream.filteredPostsCount"
|
||||||
)
|
)
|
||||||
hideProgress(loaded, currentPost, filteredPostsCount) {
|
hideProgress(loaded, currentPost, filteredPostsCount) {
|
||||||
return (
|
const hideOnShortStream = !this.site.mobileView && filteredPostsCount < 2;
|
||||||
!loaded ||
|
return !loaded || !currentPost || hideOnShortStream;
|
||||||
!currentPost ||
|
|
||||||
(!this.site.mobileView && filteredPostsCount < 2)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("postStream.filteredPostsCount")
|
@discourseComputed("postStream.filteredPostsCount")
|
||||||
|
@ -442,7 +442,6 @@ export default createWidget("topic-timeline", {
|
|||||||
html(attrs) {
|
html(attrs) {
|
||||||
const { topic } = attrs;
|
const { topic } = attrs;
|
||||||
const createdAt = new Date(topic.created_at);
|
const createdAt = new Date(topic.created_at);
|
||||||
const stream = attrs.topic.get("postStream.stream");
|
|
||||||
const { currentUser } = this;
|
const { currentUser } = this;
|
||||||
const { tagging_enabled, topic_featured_link_enabled } = this.siteSettings;
|
const { tagging_enabled, topic_featured_link_enabled } = this.siteSettings;
|
||||||
|
|
||||||
@ -517,15 +516,6 @@ export default createWidget("topic-timeline", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result.push(this.attach("timeline-controls", attrs));
|
result.push(this.attach("timeline-controls", attrs));
|
||||||
const streamLength = stream.length;
|
|
||||||
|
|
||||||
if (streamLength !== 0 && streamLength < 3) {
|
|
||||||
const topicHeight = $("#topic").height();
|
|
||||||
const windowHeight = $(window).height();
|
|
||||||
if (topicHeight / windowHeight < 2.0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const bottomAge = relativeAge(new Date(topic.last_posted_at), {
|
const bottomAge = relativeAge(new Date(topic.last_posted_at), {
|
||||||
addAgo: true,
|
addAgo: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user