Skip to content

Commit

Permalink
FIX: prevents rendering empty timeline-controls (#9304)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
jjaffeux committed Mar 30, 2020
1 parent aeaea3c commit a334505
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
7 changes: 2 additions & 5 deletions app/assets/javascripts/discourse/components/topic-progress.js
Expand Up @@ -34,11 +34,8 @@ export default Component.extend({
"postStream.filteredPostsCount"
)
hideProgress(loaded, currentPost, filteredPostsCount) {
return (
!loaded ||
!currentPost ||
(!this.site.mobileView && filteredPostsCount < 2)
);
const hideOnShortStream = !this.site.mobileView && filteredPostsCount < 2;
return !loaded || !currentPost || hideOnShortStream;
},

@discourseComputed("postStream.filteredPostsCount")
Expand Down
10 changes: 0 additions & 10 deletions app/assets/javascripts/discourse/widgets/topic-timeline.js
Expand Up @@ -442,7 +442,6 @@ export default createWidget("topic-timeline", {
html(attrs) {
const { topic } = attrs;
const createdAt = new Date(topic.created_at);
const stream = attrs.topic.get("postStream.stream");
const { currentUser } = this;
const { tagging_enabled, topic_featured_link_enabled } = this.siteSettings;

Expand Down Expand Up @@ -517,15 +516,6 @@ export default createWidget("topic-timeline", {
}

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), {
addAgo: true,
Expand Down

1 comment on commit a334505

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/timeline-overlapping-suggested-topics/146855/15

Please sign in to comment.