|
@@ -132,11 +132,14 @@ module.exports = async (dbName='graphql-chat') => {
|
|
|
this.___permissions.read.push(chatId)
|
|
|
this.___permissions.read = [...new Set(this.___permissions.read)]
|
|
|
|
|
|
+ let newMsg = !this._id
|
|
|
|
|
|
let result = await super.save(...params)
|
|
|
|
|
|
await this.chat
|
|
|
- this.chat.lastModified = this.createdAt.getTime()
|
|
|
+ if (newMsg){
|
|
|
+ this.chat.lastModified = this.createdAt.getTime()
|
|
|
+ }
|
|
|
await Savable.prototype.save.call(this.chat)
|
|
|
|
|
|
|