Set timestamp on group chat invitation

This commit is contained in:
Andrea Maria Piana 2021-05-24 10:27:56 +02:00
parent 92032c7158
commit 71f66f6806
4 changed files with 10 additions and 13 deletions

View File

@ -1 +1 @@
0.79.2
0.79.3

View File

@ -381,11 +381,16 @@ func CreateProfileChat(pubkey string, timesource common.TimeSource) *Chat {
}
func CreateGroupChat(timesource common.TimeSource) Chat {
timestamp := timesource.GetCurrentTime()
synced := uint32(timestamp / 1000)
return Chat{
Active: true,
Color: chatColors[rand.Intn(len(chatColors))], // nolint: gosec
Timestamp: int64(timesource.GetCurrentTime()),
ChatType: ChatTypePrivateGroupChat,
Active: true,
Color: chatColors[rand.Intn(len(chatColors))], // nolint: gosec
Timestamp: int64(timestamp),
SyncedTo: synced,
SyncedFrom: synced,
ChatType: ChatTypePrivateGroupChat,
}
}

View File

@ -128,9 +128,6 @@ func (m *MessageHandler) HandleMembershipUpdate(messageState *ReceivedMessageSta
// unless is coming from us or a contact
isActive := messageState.CurrentMessageState.Contact.IsAdded() || messageState.CurrentMessageState.Contact.ID == ourKey
newChat.Active = isActive
timestamp := uint32(newChat.Timestamp / 1000)
newChat.SyncedTo = timestamp
newChat.SyncedFrom = timestamp
chat = &newChat
} else {
existingGroup, err := newProtocolGroupFromChat(chat)

View File

@ -1185,11 +1185,6 @@ func (m *Messenger) CreateGroupChatWithMembers(ctx context.Context, name string,
return nil, err
}
timestamp := uint32(chat.Timestamp / 1000)
chat.SyncedTo = timestamp
chat.SyncedFrom = timestamp
m.allChats.Store(chat.ID, &chat)
_, err = m.dispatchMessage(ctx, common.RawMessage{