From 934842ab9bae1addf55dca0ed75a532d63a7ad30 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 22 Mar 2020 22:48:20 -0400 Subject: [PATCH] fix: history - handle path move between live and latest versions --- client/components/history.vue | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/client/components/history.vue b/client/components/history.vue index bdc5dbf9..ac9cdc61 100644 --- a/client/components/history.vue +++ b/client/components/history.vue @@ -226,16 +226,25 @@ export default { computed: { darkMode: get('site/dark'), fullTrail () { + const liveTrailItem = { + versionId: 0, + authorId: this.authorId, + authorName: this.authorName, + actionType: 'live', + valueBefore: null, + valueAfter: null, + versionDate: this.updatedAt + } + // -> Check for move between latest and live + const prevPage = _.find(this.cache, ['versionId', _.get(this.trail, '[0].versionId', -1)]) + if (prevPage && this.path !== prevPage.path) { + liveTrailItem.actionType = 'move' + liveTrailItem.valueBefore = prevPage.path + liveTrailItem.valueAfter = this.path + } + // -> Combine trail with live return [ - { - versionId: 0, - authorId: this.authorId, - authorName: this.authorName, - actionType: 'live', - valueBefore: null, - valueAfter: null, - versionDate: this.updatedAt - }, + liveTrailItem, ...this.trail ] }, @@ -480,7 +489,7 @@ export default { case 'edit': return '' // 'mdi-pencil' case 'move': - return 'forward' + return 'mdi-forward' case 'initial': return 'mdi-plus' case 'live':