mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Remove GhScheduledPostCountdown component
This commit is contained in:
parent
f5dd75e2e5
commit
e56b10a728
2 changed files with 0 additions and 31 deletions
|
@ -1,28 +0,0 @@
|
|||
import Component from '@ember/component';
|
||||
import moment from 'moment';
|
||||
import {computed} from '@ember/object';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default Component.extend({
|
||||
clock: service(),
|
||||
|
||||
post: null,
|
||||
|
||||
// countdown timer to show the time left until publish time for a scheduled post
|
||||
// starts 15 minutes before scheduled time
|
||||
countdown: computed('post.{publishedAtUTC,isScheduled}', 'clock.second', function () {
|
||||
let isScheduled = this.get('post.isScheduled');
|
||||
let publishTime = this.get('post.publishedAtUTC') || moment.utc();
|
||||
let timeUntilPublished = publishTime.diff(moment.utc(), 'minutes', true);
|
||||
let isPublishedSoon = timeUntilPublished > 0 && timeUntilPublished < 15;
|
||||
|
||||
// force a recompute
|
||||
this.get('clock.second');
|
||||
|
||||
if (isScheduled && isPublishedSoon) {
|
||||
return moment(publishTime).fromNow();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
|
@ -1,3 +0,0 @@
|
|||
{{#if countdown}}
|
||||
{{yield post countdown}}
|
||||
{{/if}}
|
Loading…
Add table
Reference in a new issue