diff options
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/contact.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/models/contact.js b/src/models/contact.js index d284e7fc..82b418e5 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -67,6 +67,13 @@ export default class Contact { console.info('This contact did not have a proper uid. Setting a new one for ', this) this.vCard.addPropertyWithValue('uid', uuid()) } + + // if no rev set, init one + if (!this.vCard.hasProperty('rev')) { + const rev = new ICAL.VCardTime() + rev.fromUnixTime(Date.now() / 1000) + this.rev = rev + } } /** @@ -138,6 +145,27 @@ export default class Contact { } /** + * Return the rev + * + * @readonly + * @memberof Contact + */ + get rev() { + return this.vCard.getFirstPropertyValue('rev') + } + + /** + * Set the rev + * + * @param {string} rev the rev to set + * @memberof Contact + */ + set rev(rev) { + this.vCard.updatePropertyWithValue('rev', rev) + return true + } + + /** * Return the key * * @readonly |