add last message to peers
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-03-05 20:15:48 +01:00
parent b47ef2480c
commit f40f6520d2
2 changed files with 17 additions and 12 deletions

View File

@ -73,10 +73,17 @@ func StoreMessage(peer *Peer, usermessage *meowlib.UserMessage, filenames []stri
if err != nil {
return err
}
_, err = statement.Exec(encData)
result, err := statement.Exec(encData)
if err != nil {
return err
}
id, err := result.LastInsertId()
if err != nil {
return err
}
ium := DbMessageToInternalUserMessage(id, dbid, dbm)
peer.LastMessage = ium
GetConfig().me.Save()
return nil
}

View File

@ -35,9 +35,7 @@ type Peer struct {
InvitationUrl string `json:"invitation_url,omitempty"`
InvitationMessage string `json:"invitation_message,omitempty"`
InvitationExpiry time.Time `json:"invitation_expiry,omitempty"`
LastMessage string `json:"last_message,omitempty"`
LastMessageDate int64 `json:"last_message_date,omitempty"`
LastMessageStatus string `json:"last_message_status,omitempty"`
LastMessage *InternalUserMessage `json:"last_message,omitempty"`
// Internal management attributes
Visible bool `json:"visible,omitempty"`
VisiblePassword string `json:"visible_password,omitempty"`