Use mixing for relative date in card sidebar

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-06-22 20:44:16 +02:00
parent c925a904ad
commit 6668cc7902
2 changed files with 2 additions and 14 deletions

View File

@@ -261,8 +261,6 @@ export default {
autosave: { enabled: false, uniqueId: 'unique' }, autosave: { enabled: false, uniqueId: 'unique' },
toolbar: false, toolbar: false,
}, },
lastModifiedRelative: null,
lastCreatedRemative: null,
descriptionSaveTimeout: null, descriptionSaveTimeout: null,
descriptionSaving: false, descriptionSaving: false,
hasActivity: capabilities && capabilities.activity, hasActivity: capabilities && capabilities.activity,
@@ -301,7 +299,7 @@ export default {
return this.$store.getters.cardById(this.id) return this.$store.getters.cardById(this.id)
}, },
subtitle() { subtitle() {
return t('deck', 'Modified') + ': ' + this.lastModifiedRelative + ' ' + t('deck', 'Created') + ': ' + this.lastCreatedRemative return t('deck', 'Modified') + ': ' + this.relativeDate(this.currentCard.lastModified * 1000) + ' ' + t('deck', 'Created') + ': ' + this.relativeDate(this.currentCard.createdAt * 1000)
}, },
formatedAssignables() { formatedAssignables() {
return this.assignables.map(item => { return this.assignables.map(item => {
@@ -348,12 +346,6 @@ export default {
this.initialize() this.initialize()
}, },
}, },
created() {
setInterval(this.updateRelativeTimestamps, 10000)
},
destroyed() {
clearInterval(this.updateRelativeTimestamps)
},
mounted() { mounted() {
this.initialize() this.initialize()
}, },
@@ -381,7 +373,6 @@ export default {
} }
this.desc = this.currentCard.description this.desc = this.currentCard.description
this.updateRelativeTimestamps()
}, },
showEditor() { showEditor() {
if (!this.canEdit) { if (!this.canEdit) {
@@ -426,10 +417,6 @@ export default {
this.updateDescription(updatedDescription) this.updateDescription(updatedDescription)
} }
}, },
updateRelativeTimestamps() {
this.lastModifiedRelative = OC.Util.relativeModifiedDate(this.currentCard.lastModified * 1000)
this.lastCreatedRemative = OC.Util.relativeModifiedDate(this.currentCard.createdAt * 1000)
},
setDue() { setDue() {
this.$store.dispatch('updateCardDue', this.copiedCard) this.$store.dispatch('updateCardDue', this.copiedCard)
}, },

View File

@@ -147,6 +147,7 @@ export default {
if (existingIndex !== -1) { if (existingIndex !== -1) {
Vue.set(state.cards[existingIndex], property, card[property]) Vue.set(state.cards[existingIndex], property, card[property])
} }
Vue.set(state.cards[existingIndex], 'lastModified', Date.now() / 1000)
}, },
cardIncreaseAttachmentCount(state, cardId) { cardIncreaseAttachmentCount(state, cardId) {
const existingIndex = state.cards.findIndex(_card => _card.id === cardId) const existingIndex = state.cards.findIndex(_card => _card.id === cardId)