Merge pull request #3723 from tgxworld/remove_sequential_rendering_of_time_gap
FIX: Timegap only shows up for sequential posts.
This commit is contained in:
commit
8bcb22f52d
|
@ -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() {
|
||||
|
|
|
@ -5,10 +5,7 @@ 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) {
|
||||
if (date && p2) {
|
||||
const lastDate = p2.get('created_at');
|
||||
if (lastDate) {
|
||||
const delta = new Date(date).getTime() - new Date(lastDate).getTime();
|
||||
|
@ -18,8 +15,6 @@ function calcDayDiff(p1, p2) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const PostStream = RestModel.extend({
|
||||
loading: Em.computed.or('loadingAbove', 'loadingBelow', 'loadingFilter', 'stagingPost'),
|
||||
|
|
|
@ -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}}
|
||||
|
||||
<div class='row'>
|
||||
|
|
Loading…
Reference in New Issue