From a8ed7e9ceb51326bad4f403abffa59ec2be8da82 Mon Sep 17 00:00:00 2001 From: Robin Ward <robin.ward@gmail.com> Date: Thu, 19 May 2016 12:50:51 -0400 Subject: [PATCH] FIX: Don't show timeline when less than 3 posts --- .../discourse/widgets/topic-timeline.js.es6 | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 b/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 index 275deb539..e32e7c8f9 100644 --- a/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 +++ b/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 @@ -205,19 +205,26 @@ export default createWidget('topic-timeline', { })); } - return [h('div.timeline-controls', controls), - this.attach('link', { - className: 'start-date', - rawLabel: tinyDateYear(createdAt), - action: 'jumpTop' - }), - this.attach('timeline-scrollarea', attrs), - this.attach('link', { - className: 'now-date', - icon: 'dot-circle-o', - label: 'topic.timeline.now', - action: 'jumpBottom' - }) - ]; + + const result = [ h('div.timeline-controls', controls) ]; + const stream = attrs.topic.get('postStream.stream'); + if (stream.length > 2) { + return result.concat([ + this.attach('link', { + className: 'start-date', + rawLabel: tinyDateYear(createdAt), + action: 'jumpTop' + }), + this.attach('timeline-scrollarea', attrs), + this.attach('link', { + className: 'now-date', + icon: 'dot-circle-o', + label: 'topic.timeline.now', + action: 'jumpBottom' + }) + ]); + } + + return result; } });