diff --git a/app/assets/javascripts/discourse/components/time-gap.js.es6 b/app/assets/javascripts/discourse/components/time-gap.js.es6 index 3cd887ec43a..9e410c4b73e 100644 --- a/app/assets/javascripts/discourse/components/time-gap.js.es6 +++ b/app/assets/javascripts/discourse/components/time-gap.js.es6 @@ -2,6 +2,8 @@ import SmallActionComponent from 'discourse/components/small-action'; export default SmallActionComponent.extend({ classNames: ['time-gap'], + classNameBindings: ['hideTimeGap::hidden'], + hideTimeGap: Em.computed.alias('postStream.hasNoFilters'), icon: 'clock-o', description: function() { diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index b2f903526e7..2e2dcf079fe 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -5,18 +5,13 @@ function calcDayDiff(p1, p2) { if (!p1) { return; } const date = p1.get('created_at'); - if (date) { - if (p2) { - const numDiff = p1.get('post_number') - p2.get('post_number'); - if (numDiff === 1) { - const lastDate = p2.get('created_at'); - if (lastDate) { - const delta = new Date(date).getTime() - new Date(lastDate).getTime(); - const days = Math.round(delta / (1000 * 60 * 60 * 24)); + if (date && p2) { + const lastDate = p2.get('created_at'); + if (lastDate) { + const delta = new Date(date).getTime() - new Date(lastDate).getTime(); + const days = Math.round(delta / (1000 * 60 * 60 * 24)); - p1.set('daysSincePrevious', days); - } - } + p1.set('daysSincePrevious', days); } } } diff --git a/app/assets/javascripts/discourse/templates/post.hbs b/app/assets/javascripts/discourse/templates/post.hbs index ff990eb66a0..abdde5fbc49 100644 --- a/app/assets/javascripts/discourse/templates/post.hbs +++ b/app/assets/javascripts/discourse/templates/post.hbs @@ -1,7 +1,7 @@ {{post-gap post=this postStream=controller.model.postStream before="true"}} {{#if hasTimeGap}} - {{time-gap daysAgo=daysSincePrevious}} + {{time-gap daysAgo=daysSincePrevious postStream=controller.model.postStream}} {{/if}}