0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Simplified time comparison in last-seen-at-updater

no issue

- The code had un-needed complexity
- Removing the extra complexity led to the same behavior, as validated by the unit tests
This commit is contained in:
Thibaut Patel 2022-03-01 13:07:37 +01:00
parent dafda42e0a
commit 36bb014fc0

View file

@ -40,7 +40,7 @@ class LastSeenAtUpdater {
*/
async updateLastSeenAt(memberId, memberLastSeenAt, timestamp) {
const timezone = this._settingsCacheService.get('timezone');
if (memberLastSeenAt === null || moment(moment.utc(timestamp).tz(timezone).startOf('day')).isAfter(moment.utc(memberLastSeenAt).tz(timezone).startOf('day'))) {
if (memberLastSeenAt === null || moment(moment.utc(timestamp).tz(timezone).startOf('day')).isAfter(memberLastSeenAt)) {
await this._memberModel.update({
last_seen_at: moment.utc(timestamp).format('YYYY-MM-DD HH:mm:ss')
}, {