From 22cbad874cd01cfe19740391c991e3d81a598508 Mon Sep 17 00:00:00 2001 From: Sodbileg Gansukh Date: Thu, 8 Aug 2024 19:43:28 +0800 Subject: [PATCH] Added a toast to the refresh button --- ghost/admin/app/components/posts/analytics.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ghost/admin/app/components/posts/analytics.js b/ghost/admin/app/components/posts/analytics.js index 207d6c9839..59341edd20 100644 --- a/ghost/admin/app/components/posts/analytics.js +++ b/ghost/admin/app/components/posts/analytics.js @@ -1,5 +1,6 @@ import Component from '@glimmer/component'; import DeletePostModal from '../modals/delete-post'; +// import moment from 'moment-timezone'; import {action} from '@ember/object'; import {didCancel, task} from 'ember-concurrency'; import {inject as service} from '@ember/service'; @@ -27,6 +28,7 @@ export default class Analytics extends Component { @service store; @service router; @service modals; + @service notifications; @tracked sources = null; @tracked links = null; @@ -356,6 +358,17 @@ export default class Analytics extends Component { *fetchPostTask() { const result = yield this.store.query('post', {filter: `id:${this.post.id}`, limit: 1}); this.post = result.toArray()[0]; + + // const publishedAt = this.post.publishedAtUTC; + // const fiveMinutesAgo = moment().subtract(5, 'minutes'); + + // if (this.post.email && this.post.email.openedCount === 0 && publishedAt.isAfter(fiveMinutesAgo)) { + if (this.post.email) { + this.notifications.showNotification('Post analytics refreshing', { + description: 'It can take up to five minutes for all data to show.', + type: 'success' + }); + } } get showLinks() {