From f5c397876b75874b64f4c2df93d73c888a52258b Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 May 2023 13:02:58 -0700 Subject: [PATCH] Update Conversation Timestamp --- peer/cwtch_peer.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index 57c28d2..d1671e5 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -2,19 +2,11 @@ package peer import ( "crypto/rand" - "cwtch.im/cwtch/model/constants" - "cwtch.im/cwtch/protocol/groups" - "cwtch.im/cwtch/settings" "encoding/base64" "encoding/hex" "encoding/json" "errors" "fmt" - "git.openprivacy.ca/cwtch.im/tapir/primitives" - "git.openprivacy.ca/cwtch.im/tapir/primitives/privacypass" - "git.openprivacy.ca/openprivacy/connectivity" - "git.openprivacy.ca/openprivacy/connectivity/tor" - "golang.org/x/crypto/ed25519" "os" path "path/filepath" "sort" @@ -23,6 +15,15 @@ import ( "sync" "time" + "cwtch.im/cwtch/model/constants" + "cwtch.im/cwtch/protocol/groups" + "cwtch.im/cwtch/settings" + "git.openprivacy.ca/cwtch.im/tapir/primitives" + "git.openprivacy.ca/cwtch.im/tapir/primitives/privacypass" + "git.openprivacy.ca/openprivacy/connectivity" + "git.openprivacy.ca/openprivacy/connectivity/tor" + "golang.org/x/crypto/ed25519" + "cwtch.im/cwtch/event" "cwtch.im/cwtch/model" "cwtch.im/cwtch/model/attr" @@ -672,6 +673,7 @@ func (cp *cwtchPeer) NewContactConversation(handle string, acl model.AccessContr conversationInfo, _ := cp.storage.GetConversationByHandle(handle) if conversationInfo == nil { conversationID, err := cp.storage.NewConversation(handle, model.Attributes{event.SaveHistoryKey: event.DeleteHistoryDefault}, model.AccessControlList{handle: acl}, accepted) + cp.SetConversationAttribute(conversationID, attr.LocalScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants.AttrLastConnectionTime)), time.Now().Format(time.RFC3339Nano)) cp.eventBus.Publish(event.NewEvent(event.ContactCreated, map[event.Field]string{event.ConversationID: strconv.Itoa(conversationID), event.RemotePeer: handle})) return conversationID, err }